新增前端解析xlsx方法

This commit is contained in:
gaoxiongzaq
2023-06-02 14:55:32 +08:00
parent 8135fce136
commit b9f438bc01
69 changed files with 56978 additions and 5 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@@ -0,0 +1,42 @@
// Features specially written for demo
(function() {
// language
function language(params) {
var lang = navigator.language||navigator.userLanguage;//常规浏览器语言和IE浏览器
lang = lang.substr(0, 2);//截取lang前2位字符
return lang;
}
// Tencent Forum Link Button
function supportButton() {
const text = language() === 'zh' ? '反馈' : 'Forum';
const link = language() === 'zh' ? 'https://support.qq.com/product/288322' : 'https://groups.google.com/g/luckysheet';
document.querySelector("body").insertAdjacentHTML('beforeend', '<a id="container" href="'+ link +'" target="_blank" style="z-index:2;width:50px;height:50px;line-height:50px;position:fixed;right:40px;bottom:86px;border-radius:50px;cursor:pointer;background:rgb(71,133,249);color:#fff;text-align:center;text-decoration:none;">'+ text +'</a>');
}
supportButton()
/**
* Get url parameters
*/
function getRequest() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,
function(m,key,value) {
vars[key] = value;
});
return vars;
}
window.luckysheetDemoUtil = {
language:language,
getRequest:getRequest
}
})()

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
window.sheetComment = {
"name": "Comment",
"color": "",
"config": {
"columnlen": {
"2": 102
}
},
"index": "5",
"chart": [],
"status": 0,
"order": "5",
"column": 18,
"row": 36,
"celldata": [{
"r": 2,
"c": 2,
"v": {
"m": "HoverShown",
"ct": {
"fa": "General",
"t": "g"
},
"v": "HoverShown",
"bl": 1,
"ps": {
"left": null,
"top": null,
"width": null,
"height": null,
"value": "Hello world!",
"isshow": false
}
}
}, {
"r": 7,
"c": 2,
"v": {
"m": "Size",
"ct": {
"fa": "General",
"t": "g"
},
"v": "Size",
"bl": 1,
"ps": {
"left": null,
"top": null,
"width": null,
"height": null,
"value": "Hello,world!",
"isshow": true
}
}
}],
"ch_width": 4748,
"rh_height": 1790,
"luckysheet_select_save": [{
"row": [0, 0],
"column": [0, 0]
}],
"luckysheet_selection_range": [],
"scrollLeft": 0,
"scrollTop": 0
}
// export default sheetComment;

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,189 @@
window.sheetPivotTable = {
"name": "PivotTable",
"color": "",
"config": {},
"index": "7",
"chart": [],
"status": 0,
"order": "7",
"column": 18,
"row": 36,
"celldata": [{
"r": 0,
"c": 0,
"v": "count:score"
}, {
"r": 0,
"c": 1,
"v": "science"
}, {
"r": 0,
"c": 2,
"v": "mathematics"
}, {
"r": 0,
"c": 3,
"v": "foreign language"
}, {
"r": 0,
"c": 4,
"v": "English"
}, {
"r": 0,
"c": 5,
"v": "total"
}, {
"r": 1,
"c": 0,
"v": "Alex"
}, {
"r": 1,
"c": 1,
"v": 1
}, {
"r": 1,
"c": 2,
"v": 1
}, {
"r": 1,
"c": 3,
"v": 1
}, {
"r": 1,
"c": 4,
"v": 1
}, {
"r": 1,
"c": 5,
"v": 4
}, {
"r": 2,
"c": 0,
"v": "Joy"
}, {
"r": 2,
"c": 1,
"v": 1
}, {
"r": 2,
"c": 2,
"v": 1
}, {
"r": 2,
"c": 3,
"v": 1
}, {
"r": 2,
"c": 4,
"v": 1
}, {
"r": 2,
"c": 5,
"v": 4
}, {
"r": 3,
"c": 0,
"v": "Tim"
}, {
"r": 3,
"c": 1,
"v": 1
}, {
"r": 3,
"c": 2,
"v": 1
}, {
"r": 3,
"c": 3,
"v": 1
}, {
"r": 3,
"c": 4,
"v": 1
}, {
"r": 3,
"c": 5,
"v": 4
}, {
"r": 4,
"c": 0,
"v": "total"
}, {
"r": 4,
"c": 1,
"v": 3
}, {
"r": 4,
"c": 2,
"v": 3
}, {
"r": 4,
"c": 3,
"v": 3
}, {
"r": 4,
"c": 4,
"v": 3
}, {
"r": 4,
"c": 5,
"v": 12
}],
"ch_width": 4748,
"rh_height": 1790,
"luckysheet_select_save": [{
"row": [0, 0],
"column": [0, 0]
}],
"luckysheet_selection_range": [],
"scrollLeft": 0,
"scrollTop": 0,
"isPivotTable": true,
"pivotTable": {
"pivot_select_save": {
"left": 0,
"width": 73,
"top": 0,
"height": 19,
"left_move": 0,
"width_move": 369,
"top_move": 0,
"height_move": 259,
"row": [0, 12],
"column": [0, 4],
"row_focus": 0,
"column_focus": 0
},
"pivotDataSheetIndex": 6, //The sheet index where the source data is located
"column": [{
"index": 3,
"name": "subject",
"fullname": "subject"
}],
"row": [{
"index": 1,
"name": "student",
"fullname": "student"
}],
"filter": [],
"values": [{
"index": 4,
"name": "score",
"fullname": "count:score",
"sumtype": "COUNTA",
"nameindex": 0
}],
"showType": "column",
"pivotDatas": [
["count:score", "science", "mathematics", "foreign language", "English", "total"],
["Alex", 1, 1, 1, 1, 4],
["Joy", 1, 1, 1, 1, 4],
["Tim", 1, 1, 1, 1, 4],
["total", 3, 3, 3, 3, 12]
],
"drawPivotTable": false,
"pivotTableBoundary": [5, 6]
}
}
// export default sheetPivotTable;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
.luckysheet-datavisual-quick-menu{width:120px;overflow:auto;margin-top:15px}.luckysheet-datavisual-quick-menu::-webkit-scrollbar{display:none}.luckysheet-datavisual-quick-menu>div{text-align:left;padding:4px 4px;border-right:3px solid #fff;color:#777;cursor:pointer;line-height:1.4em;word-wrap:break-word}.luckysheet-datavisual-quick-menu>div:hover{color:#000}.luckysheet-datavisual-quick-menu>div i{width:15px}.luckysheet-datavisual-quick-menu>div:hover i{color:#ff7e7e}.luckysheet-datavisual-quick-menu>div.luckysheet-datavisual-quick-menu-active{border-right:3px solid #ff7e7e;color:#000;font-weight:700}.luckysheet-datavisual-quick-menu>div.luckysheet-datavisual-quick-menu-active:hover i{color:#000}.luckysheet-datavisual-quick-range{padding:5px 0}.luckysheet-datavisual-range-container{background:#fff;border:1px solid #d9d9d9;border-top:1px solid silver;min-width:20px;width:100%;max-width:200px;display:inline-block}.luckysheet-datavisual-range-container-focus{border:1px solid #4d90fe;box-shadow:inset 0 1px 2px rgba(0,0,0,.3);outline:none}.luckysheet-datavisual-range-input,.luckysheet-datavisual-range-input:focus{background:transparent!important;border:none!important;box-sizing:border-box;box-shadow:none;height:25px;margin:0;outline:none!important;padding:1px 8px!important;width:100%}.luckysheet-datavisual-range-button-container{overflow:hidden;padding:0 0 0 8px;text-align:right;width:21px}.luckysheet-datavisual-range-button-container div{padding:2px 10px 0 10px;font-size:18px;cursor:pointer;color:#6598f3}.luckysheet-datavisual-range-button-container div:hover{color:#ff7e7e}.luckysheet-datavisual-quick-m{margin-top:5px;min-height:500px;top:50px;font-size:12px}.luckysheet-datavisual-quick-list{left:110px;right:0;bottom:0;top:80px;position:absolute;overflow:auto;border-top:1px solid #e5e5e5;padding:5px 3px 35px 3px}.luckysheet-datavisual-quick-list-title{padding:4px 6px;background:#e5e5e5;margin-top:10px}.luckysheet-datavisual-quick-list-ul{overflow:hidden}.luckysheet-datavisual-quick-list-item{display:inline-block;margin:5px 8px;border:1px solid #dadada;width:100px;height:80px}.luckysheet-datavisual-quick-list-item:hover{border:1px solid #ff7e7e;box-shadow:0 0 20px #ff7e7e}.luckysheet-datavisual-quick-list-item img{display:inline-block;width:100px;height:80px}.luckysheet-datavisual-quick-list-item-active{border:1px solid #6598f3;box-shadow:0 0 20px #6598f3}.chart-base-slider .el-slider__runway.show-input{margin-right:72px}.chart-base-slider .el-slider__input.el-input-number--mini{width:56px}.chart-base-slider .input_content{margin:6px 0 0 5px}.title{font-weight:700}.el-row{font-size:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.chartSetting{width:100%;height:100%}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 434 KiB

View File

@@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello 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>
</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>
<p style="text-align:center;">
<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 mask = document.getElementById("lucky-mask-demo");
window.onload = () => {
var value = 'kex.xlsx';
var name = 'xlsx';
if(value==""){
return;
}
// 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!");
return;
}
// console.log(exportJson, luckysheetfile);
mask.style.display = "none";
window.luckysheet.destroy();
window.luckysheet.create({
container: 'luckysheet', //luckysheet is the container id
lang: "zh",
allowCopy: true, // 是否允许拷贝
showtoolbar: true, // 是否显示工具栏
showinfobar: false, // 是否显示顶部信息栏
showsheetbar: true, // 是否显示底部sheet页按钮
showstatisticBar: true, // 是否显示底部计数栏
sheetBottomConfig: false, // sheet页下方的添加行按钮和回到顶部按钮配置
allowEdit: true, // 是否允许前台编辑
enableAddRow: false, // 允许增加行
enableAddCol: false, // 允许增加列
userInfo: false, // 右上角的用户信息展示样式
showRowBar: true, // 是否显示行号区域
showColumnBar: false, // 是否显示列号区域
sheetFormulaBar: true, // 是否显示公式栏
enableAddBackTop: true,//返回头部按钮
data:exportJson.sheets,
title:exportJson.info.name,
userInfo:exportJson.info.name.creator
});
});
}
}
demoHandler();
</script>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Some files were not shown because too many files have changed in this diff Show More