XLS文件已打开但未显示正确的数据

问题描述 投票:0回答:1

我正在使用模板生成xls文件。该文件已导出,可以使用LibreOffice或Open Office打开,但在尝试使用Numbers打开它时,我会获得this result 。这是我用来生成文件的模板。任何帮助将不胜感激!!!

TEMPLATE_XLS = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">' +
            '<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8"/>' +
            '<head><!--[if gte mso 9]>' +
            '<xml>' +
            '<x:ExcelWorkbook>' +
            '<x:ExcelWorksheets>' +
            '<x:ExcelWorksheet>' +
            '<x:Name>{title}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions>' +
            '</x:ExcelWorksheet>' +
            '</x:ExcelWorksheets>' +
            '</x:ExcelWorkbook></xml>' +
            '<![endif]--></head>' +
            '<body>{table}</body></html>';
javascript html macos xlsx xls
1个回答
0
投票

这个问题实际上是因为我试图用虚假扩展名(xls)打开一个html文件。我需要使用sheetjs库进行xlsx扩展的导出。

© www.soinside.com 2019 - 2024. All rights reserved.