Skip to content

Update xlsx.js #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions dist/xlsx.js
Original file line number Diff line number Diff line change
Expand Up @@ -7209,10 +7209,31 @@ var _ssfopts = {}; // spreadsheet formatting options

RELS.WS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";

function get_sst_id(sst, str) {
for(var i = 0, len = sst.length; i < len; ++i) if(sst[i].t === str) { sst.Count ++; return i; }
sst[len] = {t:str}; sst.Count ++; sst.Unique ++; return len;
}
function get_sst_id(sst, cell) {
var i, len;
i = 0;
len = sst.length;
while (i < len) {
if (sst[i].t === cell.v) {
sst.Count++;
return i;
}
++i;
}
if (cell.r && cell.r !== '') {
sst[len] = {
t: cell.v,
r: cell.r
};
} else {
sst[len] = {
t: cell.v
};
}
sst.Count++;
sst.Unique++;
return len;
};

function get_cell_style(styles, cell, opts) {
var z = opts.revssf[cell.z != null ? cell.z : "General"];
Expand Down Expand Up @@ -7416,7 +7437,7 @@ function write_ws_xml_cell(cell, ref, ws, opts, idx, wb) {
case 'e': o.t = "e"; break;
default:
if(opts.bookSST) {
v = writetag('v', ''+get_sst_id(opts.Strings, cell.v));
v = writetag('v', ''+get_sst_id(opts.Strings, cell));
o.t = "s"; break;
}
o.t = "str"; break;
Expand Down Expand Up @@ -7928,7 +7949,7 @@ function write_ws_bin_cell(ba, cell, R, C, opts) {
switch(cell.t) {
case 's': case 'str':
if(opts.bookSST) {
vv = get_sst_id(opts.Strings, cell.v);
vv = get_sst_id(opts.Strings, cell);
o.t = "s"; break;
}
o.t = "str"; break;
Expand Down