Excel file not opening on every plateform with Node
See original GitHub issueHello, I am currently struggling with opening the file generated by exceljs (v1.7.0) on MS Excel. I can open it but Excel (v16.21.1) says that some styling were not imported and no styling is taken into account. [EN Traduction] - “Sorry… We found a problem in the file, but we can try to recover as much content as we can. If you trust were the file came from, click yes”
That gives me this Excel that doesn’t take all my styling:
If I try to open the file in the browser with the extension Office Editing for Docs, Sheets & Slides
it shows me this error:
BUT if I manually create a Google spreadsheet and import from there my generated file, the file is correctly displayed and opens correctly:
And kind of weird, but I generate the file, opens it on Google spreadsheet, download it from there on xlsx format and opens this downloaded file, the file opens correctly. So Google must be doing something I am not. As most of my users will be using Excel, it’s kind of annoying to push them to use Spreadsheet.
Here is the code that I use to generate and style my file
const workbook = new Excel.Workbook()
// Worksheet
const worksheet = workbook.addWorksheet('Detailed capitalization table', {
pageSetup: { paperSize: 9, orientation: 'landscape', },
})
worksheet.views = [
{ state: 'frozen', ySplit: 4, topLeftCell: 'A3', },
{
showGridLines: false,
},
]
// Construction of columns
// Construction of frozen upper part
// Put data into columns
And later I do
workbook.xlsx.writeFile('path/to/file.xlsx') // With path to file
I tried without any styling but even then it doesn’t work. Still errors when i try to open the file. Thanks for reading, if you have any lead that would be super helpful!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:30 (2 by maintainers)
Top GitHub Comments
Hi, I’ve created a worksheet with nothing on it, but I still get the errors. Here is the code :
Here is the xml that results from the generated xlsx file:
And here is the xml when I import the xlsx on Google Spreadsheet and download it in xlsx from there:
As we can see this line is missing, and might be the cause of the problem:
I could fix my problem. For all who stumble upon this issue, maybe the following will help:
0%
)autoFilter
feature on the table, which led to an error. I switched to enabling the filter buttons directly for each column of the table