Problem opening exported ODS files in Excel #2425

Closed
opened 2021-10-18 14:09:32 +00:00 by amyb-hiveit · 1 comment
amyb-hiveit commented 2021-10-18 14:09:32 +00:00 (Migrated from github.com)

When I export a table as an ODS file and then try to open that file in Excel in editing mode I get the following error:
"We found a problem with some content in myfilename.ods. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes."

Clicking Yes results in the following message and the file opening correctly "Excel was able to open the file by repairing or removing the unreadable content."

Are there any known solutions or workarounds to this problem?

Recreating the problem
This occurs on the table export demo, so can be seen by going to https://sheetjs.com/demos/table.html, click export to ODS, open the downloaded file in Excel.

When I export a table as an ODS file and then try to open that file in Excel in editing mode I get the following error: "We found a problem with some content in myfilename.ods. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes." Clicking Yes results in the following message and the file opening correctly "Excel was able to open the file by repairing or removing the unreadable content." Are there any known solutions or workarounds to this problem? **Recreating the problem** This occurs on the table export demo, so can be seen by going to https://sheetjs.com/demos/table.html, click export to ODS, open the downloaded file in Excel.
SheetJSDev commented 2021-10-18 23:19:28 +00:00 (Migrated from github.com)

For ODS we check against LibreOffice. To make it work with Excel, it looks like a master page style is needed. We:

  1. uncomment the part in https://github.com/SheetJS/sheetjs/blob/master/bits/81_writeods.js#L164 to force style:master-page-name="mp1" in the table style

  2. add a predetermined master page style. https://github.com/SheetJS/sheetjs/blob/master/bits/81_writeods.js#L16 should have a style like

  <office:master-styles>
    <style:master-page style:name="mp1" style:page-layout-name="pm1">
      <style:header/>
      <style:header-left style:display="false"/>
      <style:footer/>
      <style:footer-left style:display="false"/>
    </style:master-page>
  </office:master-styles>
For ODS we check against LibreOffice. To make it work with Excel, it looks like a master page style is needed. We: 1) uncomment the part in https://github.com/SheetJS/sheetjs/blob/master/bits/81_writeods.js#L164 to force `style:master-page-name="mp1"` in the table style 2) add a predetermined master page style. https://github.com/SheetJS/sheetjs/blob/master/bits/81_writeods.js#L16 should have a style like ```xml <office:master-styles> <style:master-page style:name="mp1" style:page-layout-name="pm1"> <style:header/> <style:header-left style:display="false"/> <style:footer/> <style:footer-left style:display="false"/> </style:master-page> </office:master-styles> ```
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2425
No description provided.