ctrl-ling / xlsx-style-utils Goto Github PK
View Code? Open in Web Editor NEW基于SheetJS以及XLSX-Style的纯前端带样式导出表格为Excel的工具包
基于SheetJS以及XLSX-Style的纯前端带样式导出表格为Excel的工具包
这个工具库做的还是很不错的,建议做成依赖xlsx包的npm包,这样方便使用
我在Sheets里面设置了一个!rows字段,格式是{hpx:40},但导出后没效果
我的代码:
<!DOCTYPE html>
<html>
<head>
<title>SheetJS JS-XLSX In-Browser HTML Table Export Demo</title>
<meta charset="utf-8" />
<script type="text/javascript" src="./xlsx.core.min.js"></script>
<script type="text/javascript" src="./xlsxStyle.core.min.js"></script>
<script type="text/javascript" src="./xlsxStyle.utils.js"></script>
<script type="text/javascript" src="./FileSaver.js"></script>
</head>
<body>
<input type="file" onchange="handleFile(this)">
<script type="text/javascript">
function handleFile(e) {
var files = e.files,
f = files[0];
var reader = new FileReader();
reader.onload = function (e) {
var data = new Uint8Array(e.target.result);
var workbook = xlsxStyle.read(data, {
type: 'array'
});
var wbout = xlsxStyle.write(workbook, {
bookType: 'xlsx',
bookSST: false,
type: 'binary'
})
//保存,使用FileSaver.js
return saveAs(new Blob([XSU.s2ab(wbout)], {
type: ""
}), "test.xlsx");
};
reader.readAsArrayBuffer(f);
}
</script>
</body>
</html>
想问下,是什么原因?
因为一些原因,只能在IE里面打开页面,但是导出的时候报错:“XSU”未定义
如题
打开示例代码中下载的xlsx文件,Office提示“发现test.xlsx”中的部分内容有问题。“,office版本: 2016
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.