Using system; using system. collections. generic; using system. LINQ; using system. web; using npoi. hssf. usermodel; using npoi. SS. usermodel; using npoi. SS. formula. functions; using system. io; using system. text; namespace Import and Export Excel {// <summary> // abstract of the import and export in Excel /// </Summary> public class Excel import and export: ihttphandler {public void processrequest (httpcontext context) {context. response. contenttype = "text/plain"; hssfworkbook = new hssfworkbook (); // create an Excel file isheet sheet1 = hssfworkbook. createsheet ("sheet1"); // create a page // For (INT I = 0; I <10; I ++) // {// irow rows = sheet1.createrow (I); // create 10 rows //} irow rows = sheet1.createrow (0 ); // create row 0th // create a string-type cell in column 0th of row 0th and assign it "C Cup"; rows. createcell (0, celltype. string ). setcellvalue ("C Cup"); system. io. file. openwrite ("D:/excel.xls"); // get the file stream of an excel.xls file [openwrite () open an existing file for writing] using (Stream stream = system. io. file. openwrite ("D:/excel.xls") {// write this hssfworkbookfile to the file stream "excel.xls. write (Stream) ;}} public bool isreusable {get {return false ;}}}}