|
@@ -2,13 +2,14 @@
|
|
|
<html>
|
|
|
<head>
|
|
|
<meta charset="UTF-8" />
|
|
|
- <title>Hello xlsx!</title>
|
|
|
+ <title>xlsx在线预览</title>
|
|
|
<link rel='stylesheet' href='plugins/css/pluginsCss.css' />
|
|
|
<link rel='stylesheet' href='plugins/plugins.css' />
|
|
|
<link rel='stylesheet' href='css/luckysheet.css' />
|
|
|
<link rel='stylesheet' href='assets/iconfont/iconfont.css' />
|
|
|
<script src="plugins/js/plugin.js"></script>
|
|
|
<script src="luckysheet.umd.js"></script>
|
|
|
+ <script src="../js/base64.min.js" type="text/javascript"></script>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div id="lucky-mask-demo" style="position: absolute;z-index: 1000000;left: 0px;top: 0px;bottom: 0px;right: 0px; background: rgba(255, 255, 255, 0.8); text-align: center;font-size: 40px;align-items:center;justify-content: center;display: none;">Downloading</div>
|
|
@@ -17,56 +18,67 @@
|
|
|
<div id="luckysheet" style="margin:0px;padding:0px;position:absolute;width:100%;left: 0px;top: 50px;bottom: 0px;outline: none;"></div>
|
|
|
<script src="luckyexcel.umd.js"></script>
|
|
|
<script>
|
|
|
- function demoHandler(){
|
|
|
-
|
|
|
+ let str =location.search;
|
|
|
+ let search =str.substr(1);
|
|
|
+ //console.log(search);
|
|
|
+ search = Base64.decode(decodeURIComponent(search));
|
|
|
+ // console.log(search);
|
|
|
+
|
|
|
let mask = document.getElementById("lucky-mask-demo");
|
|
|
-
|
|
|
- window.onload = () => {
|
|
|
- var value = 'kex.xlsx';
|
|
|
- var name = 'xlsx';
|
|
|
+ function loadText() {
|
|
|
+ var value = search;
|
|
|
+ var name = 'xlsx.xlsx';
|
|
|
if(value==""){
|
|
|
return;
|
|
|
}
|
|
|
- // mask.style.display = "flex";
|
|
|
+ // mask.style.display = "flex";
|
|
|
LuckyExcel.transformExcelToLuckyByUrl(value, name, function(exportJson, luckysheetfile){
|
|
|
-
|
|
|
if(exportJson.sheets==null || exportJson.sheets.length==0){
|
|
|
- alert("Failed to read the content of the excel file, currently does not support xls files!");
|
|
|
+ alert("读取excel文件内容失败!");
|
|
|
return;
|
|
|
}
|
|
|
- // console.log(exportJson, luckysheetfile);
|
|
|
mask.style.display = "none";
|
|
|
window.luckysheet.destroy();
|
|
|
-
|
|
|
window.luckysheet.create({
|
|
|
- container: 'luckysheet', //luckysheet is the container id
|
|
|
- lang: "zh",
|
|
|
+ container: 'luckysheet', //luckysheet is the container id
|
|
|
+ lang: "zh",
|
|
|
+ showtoolbarConfig:{
|
|
|
+ image: true,
|
|
|
+ print: false, //关闭打印按钮 启用也不能用 等以后看情况而定
|
|
|
+ exportXlsx: false, //关闭导出按钮 启用也不能用 等以后看情况而定
|
|
|
+ },
|
|
|
+
|
|
|
allowCopy: true, // 是否允许拷贝
|
|
|
showtoolbar: true, // 是否显示工具栏
|
|
|
showinfobar: false, // 是否显示顶部信息栏
|
|
|
+ // myFolderUrl: "/",//作用:左上角<返回按钮的链接
|
|
|
showsheetbar: true, // 是否显示底部sheet页按钮
|
|
|
showstatisticBar: true, // 是否显示底部计数栏
|
|
|
- sheetBottomConfig: false, // sheet页下方的添加行按钮和回到顶部按钮配置
|
|
|
+ sheetBottomConfig: true, // sheet页下方的添加行按钮和回到顶部按钮配置
|
|
|
allowEdit: true, // 是否允许前台编辑
|
|
|
enableAddRow: false, // 允许增加行
|
|
|
enableAddCol: false, // 允许增加列
|
|
|
userInfo: false, // 右上角的用户信息展示样式
|
|
|
showRowBar: true, // 是否显示行号区域
|
|
|
showColumnBar: false, // 是否显示列号区域
|
|
|
- sheetFormulaBar: true, // 是否显示公式栏
|
|
|
+ sheetFormulaBar: false, // 是否显示公式栏
|
|
|
enableAddBackTop: true,//返回头部按钮
|
|
|
-
|
|
|
+ forceCalculation: false, //下面是导出插件 默认关闭
|
|
|
+ enableAddRow: false, // 允许增加行
|
|
|
+ plugins: [{ name: 'chart' }, { name: 'exportXlsx', config: { url: 'luckyToXlsx' } }, {
|
|
|
+ name: 'print', config: {
|
|
|
+ license: ''
|
|
|
+ }
|
|
|
+ }],
|
|
|
data:exportJson.sheets,
|
|
|
title:exportJson.info.name,
|
|
|
userInfo:exportJson.info.name.creator
|
|
|
});
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
- demoHandler();
|
|
|
+ loadText();
|
|
|
+
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|