从html写出有效的.xlsx [英] writing valid .xlsx from html

查看:248
本文介绍了从html写出有效的.xlsx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以xlsx格式从网页导出报告。我可以从html编写.xls并可以在Excel 2010中打开它们(尽管会出现一条警告消息)。用户希望以.xlsx格式使用它。从html编写有效的
xlsx的最佳方法/工作方式是什么?任何帮助将不胜感激。在此先感谢

解决方案

您好
Mushtaq077,


您之前提到过要从HTML导出报告。


但你没有提到你如何导出它。


我的意思是你使用了JavaScript,c#,VB。


这里我假设你正在使用JavaScript。


我试图找到相关的代码,但大多数都不起作用,如果工作,那么他们使用的是.xls格式。


最后我发现第三方脚本工作正常并能够以.xlsx格式保存。


代码如下所述。


< pre class ="prettyprint"> / *每种导出类型的默认类,内容和分隔符* /

/ * Excel Open XML电子表格(.xlsx)* /


.fn.tableExport.xlsx = {
defaultClass:" xlsx",
buttonContent:"导出到x lsx",
mimeType:" application / vnd.openxmlformats-officedocument.spreadsheetml.sheet",
fileExtension:" .xlsx"
};

/ * Excel二进制电子表格(.xls)* /


.fn.tableExport.xls = {
defaultClass:" xls",
buttonContent:" Export to xls",
separator:" \t",
mimeType:" application / vnd.ms-excel",
fileExtension:"的.xls"
};

/ *逗号分隔值(.csv)* /


I am trying to export reports from a web page in xlsx format. I am able to write .xls from html and can open those in Excel 2010 (though one warning message appears). Users want to have it in .xlsx format. What is the best way / work around to write valid xlsx from html??Any help would be appreciated. Thanks in advance

解决方案

Hi Mushtaq077,

you had mentioned that you are exporting the report from HTML.

but you did not mentioned that how you export it.

I mean did you use JavaScript, c#, VB.

here I assume that you are using JavaScript.

I try to find the related code but most of them are not working and if working then they are using .xls format.

at the end I find the third party script which is working fine and can able to save in .xlsx format.

code is mentioned below.

/* default class, content, and separator for each export type */

/* Excel Open XML spreadsheet (.xlsx) */


.fn.tableExport.xlsx = { defaultClass: "xlsx", buttonContent: "Export to xlsx", mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileExtension: ".xlsx" }; /* Excel Binary spreadsheet (.xls) */


.fn.tableExport.xls = { defaultClass: "xls", buttonContent: "Export to xls", separator: "\t", mimeType: "application/vnd.ms-excel", fileExtension: ".xls" }; /* Comma Separated Values (.csv) */


这篇关于从html写出有效的.xlsx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆