// 导出单个sheet excel
export const exportSingleSheet = function(tableSelector, fileName) {
var excelContent = document.getElementById(tableSelector).innerHTML;
var excelFile =
"<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'>";
excelFile +=
"<head>" +
"<!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>sheet</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->" +
"<style>" +
".no-border{" +
"border:none;" +
"}" +
"td,tr {" +
" text-align: center;" +
" border: .5pt solid;" +
"}" +
"</style>" +
"</head>";
excelFile += "<body><table width='10%' border='1'>";
excelFil
html table导出为excel
最新推荐文章于 2025-07-31 16:15:14 发布
本文详细介绍了如何使用HTML和JavaScript技术将网页中的表格数据导出为Excel文件,包括关键代码示例和实现步骤,帮助开发者实现网页数据快速导出的功能。

最低0.47元/天 解锁文章
3933

被折叠的 条评论
为什么被折叠?



