1
- /* xlsx.js (C) 2013-present SheetJS -- http ://sheetjs.com */
2
- /*global Uint8Array, console */
1
+ /* xlsx.js (C) 2013-present SheetJS -- https ://sheetjs.com */
2
+ /* global Uint8Array, console */
3
3
/* exported export_xlsx */
4
4
/* eslint no-use-before-define:0 */
5
5
var XLSX = require ( 'xlsx' ) ;
@@ -19,16 +19,6 @@ var process_wb = (function() {
19
19
} ;
20
20
} ) ( ) ;
21
21
22
- var _gaq = _gaq || [ ] ;
23
- _gaq . push ( [ '_setAccount' , 'UA-36810333-1' ] ) ;
24
- _gaq . push ( [ '_trackPageview' ] ) ;
25
-
26
- ( function ( ) {
27
- var ga = document . createElement ( 'script' ) ; ga . type = 'text/javascript' ; ga . async = true ;
28
- ga . src = ( 'https:' == document . location . protocol ? 'https://ssl' : 'http://www' ) + '.google-analytics.com/ga.js' ;
29
- var s = document . getElementsByTagName ( 'script' ) [ 0 ] ; s . parentNode . insertBefore ( ga , s ) ;
30
- } ) ( ) ;
31
-
32
22
var do_file = ( function ( ) {
33
23
return function do_file ( files ) {
34
24
var f = files [ 0 ] ;
@@ -64,16 +54,16 @@ var do_file = (function() {
64
54
65
55
( function ( ) {
66
56
var readf = document . getElementById ( 'readf' ) ;
67
- function handleF ( /*e*/ ) {
68
- var o = electron . dialog . showOpenDialog ( {
57
+ async function handleF ( /*e*/ ) {
58
+ var o = await electron . dialog . showOpenDialog ( {
69
59
title : 'Select a file' ,
70
60
filters : [ {
71
61
name : "Spreadsheets" ,
72
62
extensions : "xls|xlsx|xlsm|xlsb|xml|xlw|xlc|csv|txt|dif|sylk|slk|prn|ods|fods|uos|dbf|wks|123|wq1|qpw|htm|html" . split ( "|" )
73
63
} ] ,
74
64
properties : [ 'openFile' ]
75
65
} ) ;
76
- if ( o . length > 0 ) process_wb ( XLSX . readFile ( o [ 0 ] ) ) ;
66
+ if ( o . filePaths . length > 0 ) process_wb ( XLSX . readFile ( o . filePaths [ 0 ] ) ) ;
77
67
}
78
68
readf . addEventListener ( 'click' , handleF , false ) ;
79
69
} ) ( ) ;
@@ -87,18 +77,18 @@ var do_file = (function() {
87
77
var export_xlsx = ( function ( ) {
88
78
var HTMLOUT = document . getElementById ( 'htmlout' ) ;
89
79
var XTENSION = "xls|xlsx|xlsm|xlsb|xml|csv|txt|dif|sylk|slk|prn|ods|fods|htm|html" . split ( "|" )
90
- return function ( ) {
80
+ return async function ( ) {
91
81
var wb = XLSX . utils . table_to_book ( HTMLOUT ) ;
92
- var o = electron . dialog . showSaveDialog ( {
82
+ var o = await electron . dialog . showSaveDialog ( {
93
83
title : 'Save file as' ,
94
84
filters : [ {
95
85
name : "Spreadsheets" ,
96
86
extensions : XTENSION
97
87
} ]
98
88
} ) ;
99
- console . log ( o ) ;
100
- XLSX . writeFile ( wb , o ) ;
101
- electron . dialog . showMessageBox ( { message : "Exported data to " + o , buttons : [ "OK" ] } ) ;
89
+ console . log ( o . filePath ) ;
90
+ XLSX . writeFile ( wb , o . filePath ) ;
91
+ electron . dialog . showMessageBox ( { message : "Exported data to " + o . filePath , buttons : [ "OK" ] } ) ;
102
92
} ;
103
93
} ) ( ) ;
104
94
void export_xlsx ;
0 commit comments