Skip to content

CREATE EXCEL IN SERVER

Naman Joshi

Asked Jan 22, 2016, 8:13 AM EST1 answer
Share
LinkedInX
Hey Developers,
 
I will jump straight to the point, i want to create a excel file on the server, the scenario is i have textwriter instance which contains HTML String. Now, using this html string i want to create a excel(.xls or xlsx) file on the server. I tried EPPlus, NPOI but no luck as these all require a properly generated excel file, but here i have html string to pass, so i'm looking for something where it can take html string and then append it with .xls so that it can be open in workbook on the server by which i will be able to generate proper excel means i will be able to 'save as' to .xls or .xlsx format . i tried using itextsharp too but i faced many css issues. 
 
Your insights on this will be very much helpful.
 
Regards 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    One trick that you could try is to actually save that HTML content into a file which you would name with XLS extension. You see this trick works because MS Excel is actually able to detect that a file is of HTML format and will render it properly.
    However it may throw a warning message when opening it saying that the file's format and extension are not the same.
     
    If this is not something that you want then you could use GemBox.Spreadsheet:
    This library is able to load HTML content and save it as excel file:
    0