c# - Opening Excel File by ClosedXML.dll is showing error "Excel found unreadable content" -
hi have created excel file using closedxml.dll , when going open file, showing "excel found unreadable content" message. file content has swedish text. don't know root cause? there way set language? how remove warning please me. here code snap.
using (xlworkbook wb = new xlworkbook()) { wb.worksheets.add(dt); //dt datatable response.clear(); response.clearheaders(); response.buffer = true; response.charset = ""; response.contenttype = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; response.addheader("content-disposition", "attachment;filename="+filename+".xlsx"); response.contentencoding = encoding.utf8; using (memorystream mymemorystream = new memorystream()) { mymemorystream.capacity = (int)mymemorystream.length; wb.saveas(mymemorystream); mymemorystream.writeto(response.outputstream); response.flush(); response.end(); } }
after lot of stuff have found solution msdn blog site. is
response.flush(); response.suppresscontent = true;
even don't know inner works of suppresscontent property, works me. may remove styling of excel sheet , reducing size of file. , have removed response.end() throwing thread abort exception.
Comments
Post a Comment