Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
publics
js-xlsx
Commits
509f7bf9
Commit
509f7bf9
authored
11 years ago
by
SheetJS
Browse files
Options
Download
Email Patches
Plain Diff
Worker HTML update [ci skip]
parent
33fbc389
master
0.11.5-actimo
update
v1.0
v0.8.0
v0.7.11
v0.7.10
v0.7.9
v0.7.7
v0.7.6
v0.7.6-i
v0.7.6-h
v0.7.6-a
v0.7.5
v0.7.4
v0.7.3
v0.7.2
v0.7.1
v0.5.10
v0.5.9
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
index.html
+13
-4
index.html
with
13 additions
and
4 deletions
+13
-4
index.html
+
13
-
4
View file @
509f7bf9
<!DOCTYPE html>
<!-- xlsx.js (C) 2013-2014 SheetJS http://sheetjs.com -->
<!-- vim: set ts=2: -->
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
...
...
@@ -34,6 +35,14 @@
<script
src=
"xlsx.js"
></script>
<script>
var
rABS
=
typeof
FileReader
!==
"
undefined
"
&&
typeof
FileReader
.
prototype
!==
"
undefined
"
&&
typeof
FileReader
.
prototype
.
readAsBinaryString
!==
"
undefined
"
;
function
fixdata
(
data
)
{
var
o
=
""
,
l
=
0
,
w
=
10240
;
for
(;
l
<
data
.
byteLength
/
w
;
++
l
)
o
+=
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
data
.
slice
(
l
*
w
,
l
*
w
+
w
)));
o
+=
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
data
.
slice
(
o
.
length
)));
return
o
;
}
function
xlsxworker
(
data
,
cb
)
{
var
worker
=
new
Worker
(
'
./xlsxworker.js
'
);
worker
.
onmessage
=
function
(
e
)
{
...
...
@@ -43,7 +52,7 @@ function xlsxworker(data, cb) {
case
'
xlsx
'
:
cb
(
JSON
.
parse
(
e
.
data
.
d
));
break
;
}
};
var
arr
=
rABS
?
data
:
btoa
(
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
data
))
)
;
var
arr
=
rABS
?
data
:
btoa
(
fixdata
(
data
));
worker
.
postMessage
({
d
:
arr
,
b
:
rABS
});
}
...
...
@@ -103,11 +112,11 @@ function process_wb(wb) {
var
output
=
""
;
switch
(
get_radio_value
(
"
format
"
))
{
case
"
json
"
:
output
=
JSON
.
stringify
(
to_json
(
wb
),
2
,
2
);
output
=
JSON
.
stringify
(
to_json
(
wb
),
2
,
2
);
break
;
case
"
form
"
:
output
=
to_formulae
(
wb
);
break
;
break
;
default
:
output
=
to_csv
(
wb
);
}
...
...
@@ -133,7 +142,7 @@ function handleDrop(e) {
if
(
rABS
)
{
wb
=
XLSX
.
read
(
data
,
{
type
:
'
binary
'
});
}
else
{
var
arr
=
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
data
)
)
;
var
arr
=
fixdata
(
data
);
wb
=
XLSX
.
read
(
btoa
(
arr
),
{
type
:
'
base64
'
});
}
process_wb
(
wb
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help