user2541290
user2541290

Reputation: 11

OPEN XML to Export 2007/2010

In my application I already have functionality to export into 2003 format. Where I am constructing a string out of the template and write using System.IO.File.WriteAllText.

But it does not work with excel 2007/2010, that's why I wanted to convert it to Openxml in order to support 2007 and 2010.

I have string ready with creation of cells and rows from template.

I want advice on how to achieve or any body has reference link.

Please let me know.

Regards

Upvotes: 1

Views: 390

Answers (1)

alex.pulver
alex.pulver

Reputation: 2125

WriteAllText class will save you a text file. You are saving an html(text) based file with xls extension. This is not a real xls file (that is actually a binary file), but MS Excel recognize and interpret the html format.

An xlsx file is a binary file. You can use OpenXML Office library ( Excel.XlFileFormat.xlOpenXMLWorkbook ) or another .NET Excel library like EasyXLS. Check this sample of code for more details.

Upvotes: 1

Related Questions