0

I create an Excel file (.xlsx) using the Aspose.Cells library. But I'm not able to read the data (retrieve rows) using OleDb commands after that, until I open the file and save it manually. I'm running something as simple as this one:

new OleDbDataAdapter("select * from [Sheet1$]", conn); // etc...

Saving the file increases the size of the file as well. Please note that this happens only with the .xlsx format, for the old .xls everything works fine. I even tried the demo code that they have on their website, but the result is the same. Am I missing something?

DeanOC
  • 7,142
  • 6
  • 42
  • 56
pangular
  • 699
  • 7
  • 27

1 Answers1

0

It seems you need to set the ExportCellName name property to true before saving to xlsx/xlsm format.

Please see the following sample.

//Create your workbook
Workbook workbook = new Workbook(filePath);

//Do your processing

//Save your workbook with export cell as true
OoxmlSaveOptions opts = new OoxmlSaveOptions();
opts.ExportCellName = true;
workbook.Save("output.xlsx", opts);

Note: I am working as Developer Evangelist at Aspose

shakeel
  • 1,717
  • 10
  • 14
  • Thanks for your answer. I'm using the version 4.8.1.0 and I cannot find the OoxmlSaveOptions class in the API. There's only the SaveOptions class which doesn't have the property described above. – pangular Jun 01 '15 at 09:26
  • Please give a try to latest version which you can download from Aspose because it might be a bug in the older version. – shakeel Jun 02 '15 at 15:00