Reputation: 21
I am using Open XML 2.0 (DocumentFormat.OpenXml.dll) to read xlsm file and update some cell values and save it as "Microsoft Excel 2007 XML (.xlsm)|*.xlsm". Programmatically all cells are written and it is opening charm using Microsoft Excel 2007 (even Libre Office as well) but not opening the file using Microsoft Excel 2010.
I am getting the below error.
"Excel found unreadable content in 'Test.xlsm'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes."
Say Yes to the alert, file is repaired and showing below warning alert. Sheet becomes empty or some of the data are not updated.
"Replaced Part: /xl/worksheets/sheet1.xml part with XML error. Load error. Line 1, column 0. Removed Records: Formula from /xl/calcChain.xml part (Calculation properties) "
Whether Open XML 2.0 is intended for 2007 format? If so, please guide me to choose right SDK to export data to 2010 format.
Thank you,
Regards,
Ravi.
Upvotes: 0
Views: 727
Reputation: 21
I found the cause rather than answer to this question.
I used an xlsm file as template which will be read programmatically and update cell value from database and save the updated file as another xlsm file.
The actual problem is with the reference/template file has value in the same cell where I am updating data from database. Say, cell A14 has value in template and I am reading programmatically the template and update the value of the same cell A14.
Just clear A14 from template resolves my problem.
This is weird that the error message I got is no where related to the actual problem. Also I don't find any documentation (special code) on how to update the existing value using Open XML?
Upvotes: 0