How to open SpreadsheetDocument without calcchain.xml #1279
Replies: 3 comments 11 replies
-
@Distancehe Can you provide the sample document that is failing to open in Excel and also explain how this file was produced? Our implementer notes don't say anything about the requirement for the calcChain root or it's containing part calcchain.xml so I would have to research this a little to find out if it's supposed to be valid or not. But in the meantime, it would help to know how the workbook was created. |
Beta Was this translation helpful? Give feedback.
-
@Distancehe so Excel will also add the calcChain.xml part back into the package on save, but with some kind of "correct" content. After looking at what Excel adds for the content, I'm not sure having SpreadsheetDocument.Open() add the missing part is the right way to go. Ignoring it might be possible but that would leave a missing part relationship and potentially important information that should have been added by the producer of the package. Excel is essentially saying that it can recreate the missing information but the SDK wouldn't have the logic that Excel has. (That's why it's Excel). Having said that, I will talk to our Excel team to find out what the ramifications of adding an empty calcChain.xml part (because the SDK doesn't want to process the whole workbook looking for formulas and adding cells) would be. For example, after opening with a blank calcChain.xml inserted but before saving the workbook with Excel, could it lead to incorrect formula computations? |
Beta Was this translation helpful? Give feedback.
-
@Distancehe I've submitted a fix in PR #1288, please test if you have time. This does leave the relationship intact vs removing it as I had mentioned before. I can rework if you think it should remove the relationship entry. |
Beta Was this translation helpful? Give feedback.
-
The Excel file itself do not contain calcchain.xml, but calcchain.xml is referenced from workbook.xml.rels as below snapshot. When trying to load the excel with SpreadsheetDocument.Open(), it will throw exception since the calcchain.xml is missing. The question is, how to open the excel file with calcchain.xml missing? Is there some way to ignore this and continue open the file ? Thanks !
Beta Was this translation helpful? Give feedback.
All reactions