@@ -42,23 +42,23 @@ Excel.prototype = {
42
42
return { }
43
43
} ,
44
44
readByData ( data ) {
45
- // 用于前端上传文件,如:上传按钮和拖拽上传
45
+ // 用于前端上传文件,如:上传按钮和拖拽上传
46
46
this . workbook = xlsx . read ( data , { type : 'binary' } )
47
47
} ,
48
48
readByPath ( filename ) {
49
- // 用于 Node 直接通过路径读取文件
49
+ // 用于 Node 直接通过路径读取文件
50
50
this . workbook = xlsx . readFile ( filename )
51
51
} ,
52
52
initData ( ) {
53
- // 表名列表
53
+ // 表名列表
54
54
this . sheetNameList = this . workbook . SheetNames
55
55
56
- // 插入每个sheet的数据(json格式)
56
+ // 插入每个sheet的数据(json格式)
57
57
this . sheetNameList . forEach ( ( curSheetName , index ) => {
58
58
this [ curSheetName ] = xlsx . utils . sheet_to_json ( this . workbook . Sheets [ curSheetName ] )
59
59
} )
60
60
61
- // 获取表头
61
+ // 获取表头
62
62
this . sheetNameList . forEach ( ( curSheetName , index ) => {
63
63
const curSheetData = this . workbook . Sheets [ curSheetName ]
64
64
const scope = this . workbook . Sheets [ curSheetName ] [ '!ref' ] . split ( ':' ) // A1 F5
@@ -87,14 +87,14 @@ Excel.prototype = {
87
87
wbTem = null
88
88
} )
89
89
sheetNameList = null
90
- // console.log(finalWB)
90
+ // console.log(finalWB)
91
91
ipcRenderer . send ( 'sync-saveFile-dialog' , {
92
92
filename : '过滤后的文件.xlsx' ,
93
93
data : finalWB
94
94
} )
95
- // console.log(xlsx.writeFile(finalWB, fileName)) // Node导出
96
- // let wbout = XLSX.write(finalWB, {bookType:'xlsx', bookSST:false, type: 'binary'});
97
- // saveAs(new Blob([s2ab(wbout)],{type:'application/octet-stream'}), fileName)
95
+ // console.log(xlsx.writeFile(finalWB, fileName)) // Node导出
96
+ // let wbout = XLSX.write(finalWB, {bookType:'xlsx', bookSST:false, type: 'binary'});
97
+ // saveAs(new Blob([s2ab(wbout)],{type:'application/octet-stream'}), fileName)
98
98
} ,
99
99
100
100
jsonToWBForOneSheet ( json , colkeys , sheetName ) {
0 commit comments