I'm creating a spreadsheet with the OpenXML SDK. The spreadsheet has several worksheets, styles, etc.
- When I open the file in Excel, it renders fine, with no errors, and displaying all cell formats and data correctly.
- When I open the file on a mobile device, depending on the app, I get errors that indicate the file is corrupt, or missing altogether.
I opened the .xlsx file in Excel and saved it off to another file; then I did a diff on the directory structures inside the corresponding zip files. I noticed:
- The new copy (the copy that went through Excel) now renders properly on all tested mobile apps.
- Only the new copy includes:
- /docProps
- /xl/theme
- docProps/app.xml
- docProps.core.xml
- docProps/theme1.xml
- Only the old copy includes:
- /xl/worksheets/_rels/
- sheet#.xml.rels
- Modified files:
- sheet#.xml
- sharedStrings.xml
- styles.xml
- workbook.xml
- [Content_Types].xml
What do I need to do to this file prior to saving to resolve these conflicts?
spreadsheet.WorkbookPart.WorkbookStylesPart.Stylesheet.Save();
. - Lukasz M