Lines Matching refs:wb

5569 function write_meta_ods(/*:: wb: Workbook, opts: any*/)/*:string*/ {
6727 function write_BOF(wb/*:Workbook*/, t/*:number*/, o) { argument
8065 var wb = { Workbook: { WBProps: {}, Names: [] } }; class in SYLK
8081 if(d1904 >= 1 && d1904 <= 4) wb.Workbook.WBProps.date1904 = true;
8095 wb.Workbook.Names.push(nn);
8114 …= null && fmt_is_date(next_cell_format) && opts.cellDates) { val = numdate(wb.Workbook.WBProps.dat…
8117 if(!opts.cellDates) { cell_t = "n"; val = datenum(val, wb.Workbook.WBProps.date1904); }
8140 …ell_format) arr[R][C].w = SSF_format(arr[R][C].z, arr[R][C].v, { date1904: wb.Workbook.WBProps.dat…
8199 return [arr, sht, wb];
8204 var aoa = aoasht[0], ws = aoasht[1], wb = aoasht[2];
8205 var _opts = dup(opts); _opts.date1904 = (((wb||{}).Workbook || {}).WBProps || {}).date1904;
8209 keys(wb).forEach(function(k) { outwb[k] = wb[k]; });
8251 function sheet_to_sylk(ws/*:Worksheet*/, opts/*:?any*/, wb/*:?WorkBook*/)/*:string*/ {
8257 var d1904 = (((wb||{}).Workbook||{}).WBProps||{}).date1904;
8900 function book_to_wk3(wb/*:Workbook*/, opts/*:WriteOpts*/) {
8906 write_biff_rec(ba, 0x00, write_BOF_WK3(wb));
8908 …cnt = 0; i < wb.SheetNames.length; ++i) if((wb.Sheets[wb.SheetNames[i]] || {})["!ref"]) write_biff…
8911 for(i = 0; i < wb.SheetNames.length; ++i) {
8912 var ws = wb.Sheets[wb.SheetNames[i]];
8949 function write_BOF_WK3(wb/*:Workbook*/) {
8955 for(var i = 0; i < wb.SheetNames.length; ++i) {
8956 var name = wb.SheetNames[i];
8957 var ws = wb.Sheets[name];
9638 var wb = { SheetNames: [], Sheets: {} };
9691 book_append_sheet(wb, s, sname); // TODO: a barrel roll
9763 return wb;
10445 var wb = sheet_to_workbook(rtf_to_sheet(d, opts), opts);
10446 wb.bookType = "rtf";
10447 return wb;
11004 function write_sty_xml(wb/*:Workbook*/, opts)/*:string*/ { argument
11009 if(wb.SSF && (w = write_numFmts(wb.SSF)) != null) o[o.length] = w;
11398 function write_sty_bin(wb, opts) { argument
11401 write_FMTS_bin(ba, wb.SSF);
11402 write_FONTS_bin(ba, wb);
11403 write_FILLS_bin(ba, wb);
11404 write_BORDERS_bin(ba, wb);
11405 write_CELLSTYLEXFS_bin(ba, wb);
11407 write_STYLES_bin(ba, wb);
11408 write_DXFS_bin(ba, wb);
11409 write_TABLESTYLES_bin(ba, wb);
11410 write_COLORPALETTE_bin(ba, wb);
12501 function parse_ds_bin(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { r…
12502 function parse_ds_xml(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { r…
12503 function parse_ms_bin(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { r…
12504 function parse_ms_xml(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { r…
13806 function write_XLSBFormulaRef3D(str, wb) { argument
13816 …out.write_shift(2, 2 + wb.SheetNames.map(function(n) { return n.toLowerCase(); }).indexOf(sname.to…
13825 function write_XLSBFormulaRefErr3D(str, wb) { argument
13834 …out.write_shift(2, 2 + wb.SheetNames.map(function(n) { return n.toLowerCase(); }).indexOf(sname.to…
13872 function write_XLSBFormulaRangeWS(_str, wb) { argument
13885 …out.write_shift(2, 2 + wb.SheetNames.map(function(n) { return n.toLowerCase(); }).indexOf(sname.to…
13892 …out.write_shift(2, 2 + wb.SheetNames.map(function(n) { return n.toLowerCase(); }).indexOf(sname.to…
13905 function write_XLSBFormulaArea3D(_str, wb) { argument
13916 …out.write_shift(2, 2 + wb.SheetNames.map(function(n) { return n.toLowerCase(); }).indexOf(sname.to…
13929 function write_XLSBFormula(val/*:string|number*/, wb) { argument
13935 …|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) return write_XLSBFormulaArea3D(val, wb);
13936 …}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) return write_XLSBFormulaRef3D(val, wb);
13937 …1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) return write_XLSBFormulaRangeWS(val, wb);
13938 …\\\/?*\[\]:'`~!@#$%^()\-=+{}|;,<.>]*)!#REF!$/.test(val)) return write_XLSBFormulaRefErr3D(val, wb);
15257 function parse_ws_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*:WBWBProps*/, themes, style… argument
15275 if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx);
15276 …atch(sheetprregex2))) parse_ws_xml_sheetpr2(sheetPr[0], sheetPr[1]||"", s, wb, idx, styles, themes…
15287 if(svs && svs[1]) parse_ws_xml_sheetviews(svs[1], wb);
15344 function parse_ws_xml_sheetpr(sheetPr/*:string*/, s, wb/*:WBWBProps*/, idx/*:number*/) { argument
15346 if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
15347 if(data.codeName) wb.Sheets[idx].CodeName = unescapexml(utf8read(data.codeName));
15349 function parse_ws_xml_sheetpr2(sheetPr/*:string*/, body/*:string*/, s, wb/*:WBWBProps*/, idx/*:numb… argument
15350 parse_ws_xml_sheetpr(sheetPr.slice(0, sheetPr.indexOf(">")), s, wb, idx);
15352 function write_ws_xml_sheetpr(ws, wb, idx, opts, o) { argument
15355 if(opts.bookType !== 'xlsx' && wb.vbaraw) {
15356 var cname = wb.SheetNames[idx];
15357 try { if(wb.Workbook) cname = wb.Workbook.Sheets[idx].CodeName || cname; } catch(e) {}
15460 function write_ws_xml_autofilter(data, ws, wb, idx)/*:string*/ { argument
15462 if(!wb.Workbook) wb.Workbook = ({Sheets:[]}/*:any*/);
15463 if(!wb.Workbook.Names) wb.Workbook.Names = [];
15464 var names/*: Array<any> */ = wb.Workbook.Names;
15471 name.Ref = formula_quote_sheet_name(wb.SheetNames[idx]) + "!" + fix_range(ref); break;
15473 …if(i == names.length) names.push({ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: "'" + wb.SheetN…
15480 function parse_ws_xml_sheetviews(data, wb/*:WBWBProps*/) { argument
15481 if(!wb.Views) wb.Views = [{}];
15485 if(!wb.Views[i]) wb.Views[i] = {};
15487 if(+tag.zoomScale) wb.Views[i].zoom = +tag.zoomScale;
15489 if(tag.rightToLeft && parsexmlbool(tag.rightToLeft)) wb.Views[i].RTL = true;
15492 function write_ws_xml_sheetviews(ws, opts, idx, wb)/*:string*/ { argument
15495 …if((((wb||{}).Workbook||{}).Views||[])[0]) sview.rightToLeft = wb.Workbook.Views[0].RTL ? "1" : "0…
15499 function write_ws_xml_cell(cell/*:Cell*/, ref, ws, opts/*::, idx, wb*/)/*:string*/ {
15737 function write_ws_xml_data(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*//*::, rels*/)/*:s… argument
15749 if((cell = write_ws_xml_cell(_cell, ref, ws, opts, idx, wb)) != null) r.push(cell);
15781 function write_ws_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ { argument
15786 var s = wb.SheetNames[idx], sidx = 0, rdata = "";
15787 var ws = wb.Sheets[s];
15801 write_ws_xml_sheetpr(ws, wb, idx, opts, o);
15805 o[o.length] = write_ws_xml_sheetviews(ws, opts, idx, wb);
15819 rdata = write_ws_xml_data(ws, opts, idx, wb, rels);
15831 …if(ws['!autofilter'] != null) o[o.length] = write_ws_xml_autofilter(ws['!autofilter'], ws, wb, idx…
16407 function parse_ws_bin(data, _opts, idx, rels, wb/*:WBWBProps*/, themes, styles)/*:Worksheet*/ { argument
16428 var supbooks = opts.supbooks || /*::(*/wb/*:: :any)*/.supbooks || ([[]]/*:any*/);
16431 supbooks.SheetNames = wb.SheetNames || wb.Sheets.map(function(x) { return x.name; });
16434 if(wb.Names) for(var i = 0; i < wb.Names.length; ++i) supbooks[0][i+1] = wb.Names[i];
16596 if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
16597 if(val.name) wb.Sheets[idx].CodeName = val.name;
16602 if(!wb.Views) wb.Views = [{}];
16603 if(!wb.Views[0]) wb.Views[0] = {};
16604 if(val.RTL) wb.Views[0].RTL = true;
16763 function write_CELLTABLE(ba, ws/*:Worksheet*/, idx/*:number*/, opts/*::, wb:Workbook*/) {
16795 function write_COLINFOS(ba, ws/*:Worksheet*//*::, idx:number, opts, wb:Workbook*/) {
16827 function write_AUTOFILTER(ba, ws, wb, idx) { argument
16833 if(!wb.Workbook) wb.Workbook = ({Sheets:[]}/*:any*/);
16834 if(!wb.Workbook.Names) wb.Workbook.Names = [];
16835 var names/*: Array<any> */ = wb.Workbook.Names;
16842 name.Ref = formula_quote_sheet_name(wb.SheetNames[idx]) + "!" + fix_range(ref); break;
16844 …{ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: formula_quote_sheet_name(wb.SheetNames[idx]) + "…
16879 function write_ws_bin(idx/*:number*/, opts, wb/*:Workbook*/, rels) { argument
16881 var s = wb.SheetNames[idx], ws = wb.Sheets[s] || {};
16882 …var c/*:string*/ = s; try { if(wb && wb.Workbook) c = wb.Workbook.Sheets[idx].CodeName || c; } cat…
16893 …if(wb.vbaraw || ws['!outline']) write_record(ba, 0x0093 /* BrtWsProp */, write_BrtWsProp(c, ws['!o…
16895 write_WSVIEWS2(ba, ws, wb.Workbook);
16897 write_COLINFOS(ba, ws, idx, opts, wb);
16898 write_CELLTABLE(ba, ws, idx, opts, wb);
16903 write_AUTOFILTER(ba, ws, wb, idx);
16955 function parse_chart(data/*:?string*/, name/*:string*/, opts, rels, wb, csheet) { argument
16980 function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*::, themes, styles*/)/*:Wor… argument
16989 if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx);
16997 //function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
17016 function parse_cs_bin(data, opts, idx/*:number*/, rels, wb/*::, themes, styles*/)/*:Worksheet*/ { argument
17029 if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
17030 if(val.name) wb.Sheets[idx].CodeName = val.name;
17062 //function write_cs_bin(/*::idx:number, opts, wb:Workbook, rels*/) {
17179 function parse_wb_defaults(wb) { argument
17180 push_defaults(wb.WBProps, WBPropsDef);
17181 push_defaults(wb.CalcPr, CalcPrDef);
17183 push_defaults_array(wb.WBView, WBViewDef);
17184 push_defaults_array(wb.Sheets, SheetDef);
17186 _ssfopts.date1904 = parsexmlbool(wb.WBProps.date1904);
17189 function safe1904(wb/*:Workbook*/)/*:string*/ { argument
17191 if(!wb.Workbook) return "false";
17192 if(!wb.Workbook.WBProps) return "false";
17193 return parsexmlbool(wb.Workbook.WBProps.date1904) ? "true" : "false";
17217 function check_wb(wb) { argument
17218 if(!wb || !wb.SheetNames || !wb.Sheets) throw new Error("Invalid Workbook");
17219 if(!wb.SheetNames.length) throw new Error("Workbook is empty");
17220 var Sheets = (wb.Workbook && wb.Workbook.Sheets) || [];
17221 check_wb_names(wb.SheetNames, Sheets, !!wb.vbaraw);
17222 …for(var i = 0; i < wb.SheetNames.length; ++i) check_ws(wb.Sheets[wb.SheetNames[i]], wb.SheetNames[…
17223 wb.SheetNames.forEach(function(n, i) {
17224 var ws = wb.Sheets[n];
17227 if(!wb.Workbook) wb.Workbook = {};
17228 if(!wb.Workbook.Names) wb.Workbook.Names = [];
17229wb.Workbook.Names.forEach(function(dn) { if(dn.Name == "_xlnm._FilterDatabase" && dn.Sheet == i) D…
17232 else wb.Workbook.Names.push({Name: "_xlnm._FilterDatabase", Sheet: i, Ref: nn});
17240 …var wb = /*::(*/{ AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, Names:[], xmlns: "" … class in parse_wb_xml
17251 wb.xmlns = y[xmlns];
17256 case '<fileVersion': delete y[0]; wb.AppVersion = y; break;
17270 case "bool": wb.WBProps[w[0]] = parsexmlbool(y[w[0]]); break;
17271 case "int": wb.WBProps[w[0]] = parseInt(y[w[0]], 10); break;
17272 default: wb.WBProps[w[0]] = y[w[0]];
17275 if(y.codeName) wb.WBProps.CodeName = utf8read(y.codeName);
17287 case '<workbookView': case '<workbookView/>': delete y[0]; wb.WBView.push(y); break;
17301 delete y[0]; wb.Sheets.push(y); break;
17329 wb.Names.push(dname);
17334 case '<calcPr': delete y[0]; wb.CalcPr = y; break;
17335 case '<calcPr/>': delete y[0]; wb.CalcPr = y; break;
17389 if(XMLNS_main.indexOf(wb.xmlns) === -1) throw new Error("Unknown Namespace: " + wb.xmlns);
17391 parse_wb_defaults(wb);
17393 return wb;
17396 function write_wb_xml(wb/*:Workbook*//*::, opts:?WriteOpts*/)/*:string*/ { argument
17405 var write_names = (wb.Workbook && (wb.Workbook.Names||[]).length > 0);
17411 if(wb.Workbook && wb.Workbook.WBProps) {
17413 /*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */
17414 if((wb.Workbook.WBProps[x[0]]/*:any*/) == null) return;
17415 if((wb.Workbook.WBProps[x[0]]/*:any*/) == x[1]) return;
17416 workbookPr[x[0]] = (wb.Workbook.WBProps[x[0]]/*:any*/);
17418 /*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */
17419 …if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.CodeName; delete work…
17425 var sheets = wb.Workbook && wb.Workbook.Sheets || [];
17431 for(i = 0; i != wb.SheetNames.length; ++i) {
17435 if(i == wb.SheetNames.length) i = 0;
17441 for(i = 0; i != wb.SheetNames.length; ++i) {
17442 var sht = ({name:escapexml(wb.SheetNames[i].slice(0,31))}/*:any*/);
17458 if(wb.Workbook && wb.Workbook.Names) wb.Workbook.Names.forEach(function(n) {
17569 function write_BrtName(name, wb) { argument
17581 write_XLSBNameParsedFormula(name.Ref, wb)
17601 var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, xmlns: "" }; class in parse_wb_bin
17619 wb.Sheets.push(val); break;
17622 wb.WBProps = val; break;
17701 parse_wb_defaults(wb);
17704 wb.Names = Names;
17706 (wb/*:any*/).supbooks = supbooks;
17707 return wb;
17710 function write_BUNDLESHS(ba, wb/*::, opts*/) { argument
17712 for(var idx = 0; idx != wb.SheetNames.length; ++idx) {
17713 …var viz = wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx] && wb.Workbook.Sheets[idx].…
17714 var d = { Hidden: viz, iTabID: idx+1, strRelID: 'rId' + (idx+1), name: wb.SheetNames[idx] };
17746 function write_BOOKVIEWS(ba, wb/*::, opts*/) { argument
17748 if(!wb.Workbook || !wb.Workbook.Sheets) return;
17749 var sheets = wb.Workbook.Sheets;
17762 function write_BRTNAMES(ba, wb) { argument
17763 if(!wb.Workbook || !wb.Workbook.Names) return;
17764 wb.Workbook.Names.forEach(function(name) { try {
17766 write_record(ba, 0x0027 /* BrtName */, write_BrtName(name, wb));
17772 function write_SELF_EXTERNS_xlsb(wb) { argument
17773 var L = wb.SheetNames.length;
17783 function write_EXTERNALS_xlsb(ba, wb) { argument
17786 write_record(ba, 0x016A /* BrtExternSheet */, write_SELF_EXTERNS_xlsb(wb, 0));
17811 function write_wb_bin(wb, opts) { argument
17816 …write_record(ba, 0x0099 /* BrtWbProp */, write_BrtWbProp(wb.Workbook && wb.Workbook.WBProps || nul…
17819 write_BOOKVIEWS(ba, wb, opts);
17820 write_BUNDLESHS(ba, wb, opts);
17822 write_EXTERNALS_xlsb(ba, wb);
17823 if((wb.Workbook||{}).Names) write_BRTNAMES(ba, wb);
17844 function parse_ws(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Workshee… argument
17845 …if(name.slice(-4)===".bin") return parse_ws_bin((data/*:any*/), opts, idx, rels, wb, themes, style…
17846 return parse_ws_xml((data/*:any*/), opts, idx, rels, wb, themes, styles);
17849 function parse_cs(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Workshee… argument
17850 …if(name.slice(-4)===".bin") return parse_cs_bin((data/*:any*/), opts, idx, rels, wb, themes, style…
17851 return parse_cs_xml((data/*:any*/), opts, idx, rels, wb, themes, styles);
17854 function parse_ms(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Workshee… argument
17855 …if(name.slice(-4)===".bin") return parse_ms_bin((data/*:any*/), opts, idx, rels, wb, themes, style…
17856 return parse_ms_xml((data/*:any*/), opts, idx, rels, wb, themes, styles);
17859 function parse_ds(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Workshee… argument
17860 …if(name.slice(-4)===".bin") return parse_ds_bin((data/*:any*/), opts, idx, rels, wb, themes, style…
17861 return parse_ds_xml((data/*:any*/), opts, idx, rels, wb, themes, styles);
18829 function write_props_xlml(wb/*:Workbook*/, opts)/*:string*/ { argument
18832 if(wb.Props) o.push(xlml_write_docprops(wb.Props, opts));
18834 if(wb.Custprops) o.push(xlml_write_custprops(wb.Props, wb.Custprops, opts));
18838 function write_wb_xlml(wb/*::, opts*/)/*:string*/ { argument
18841 …if((((wb||{}).Workbook||{}).WBProps||{}).date1904) return '<ExcelWorkbook xmlns="urn:schemas-micro…
18845 function write_sty_xlml(wb, opts)/*:string*/ { argument
18858 function write_names_xlml(wb/*::, opts*/)/*:string*/ { argument
18859 if(!((wb||{}).Workbook||{}).Names) return "";
18860 /*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */
18861 var names/*:Array<any>*/ = wb.Workbook.Names;
18871 function write_ws_xlml_names(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ { argument
18873 if(!((wb||{}).Workbook||{}).Names) return "";
18874 /*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */
18875 var names/*:Array<any>*/ = wb.Workbook.Names;
18889 function write_ws_xlml_wsopts(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ { argument
18933 if(wb && wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx]) {
18935 …if(wb.Workbook.Sheets[idx].Hidden) o.push(writextag("Visible", (wb.Workbook.Sheets[idx].Hidden == …
18938 for(var i = 0; i < idx; ++i) if(wb.Workbook.Sheets[i] && !wb.Workbook.Sheets[i].Hidden) break;
18945 if(((((wb||{}).Workbook||{}).Views||[])[0]||{}).RTL) o.push("<DisplayRightToLeft/>");
19004 function write_ws_xlml_cell(cell, ref/*:string*/, ws, opts, idx/*:number*/, wb, addr)/*:string*/{ argument
19058 function write_ws_xlml_table(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ { argument
19088 row.push(write_ws_xlml_cell(cell, ref, ws, opts, idx, wb, addr));
19095 function write_ws_xlml(idx/*:number*/, opts, wb/*:Workbook*/)/*:string*/ { argument
19097 var s = wb.SheetNames[idx];
19098 var ws = wb.Sheets[s];
19100 var t/*:string*/ = ws ? write_ws_xlml_names(ws, opts, idx, wb) : "";
19104 t = ws ? write_ws_xlml_table(ws, opts, idx, wb) : "";
19108 o.push(write_ws_xlml_wsopts(ws, opts, idx, wb));
19114 function write_xlml(wb, opts)/*:string*/ { argument
19116 if(!wb.SSF) wb.SSF = dup(table_fmt);
19117 if(wb.SSF) {
19118 make_ssf(); SSF_load_table(wb.SSF);
19120 opts.revssf = evert_num(wb.SSF); opts.revssf[wb.SSF[65535]] = 0;
19121 opts.ssf = wb.SSF;
19126 d.push(write_props_xlml(wb, opts));
19127 d.push(write_wb_xlml(wb, opts));
19130 for(var i = 0; i < wb.SheetNames.length; ++i)
19131 …d.push(writextag("Worksheet", write_ws_xlml(i, opts, wb), {"ss:Name":escapexml(wb.SheetNames[i])})…
19132 d[2] = write_sty_xlml(wb, opts);
19133 d[3] = write_names_xlml(wb, opts);
19246 var wb = ({opts:{}}/*:any*/); class in parse_workbook
19373 wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break;
19374 case 0x0086 /* WriteProtect */: wb.opts.WriteProtect = true; break;
19396 case 0x01b7 /* RefreshAll */: wb.opts["RefreshAll"] = val; break;
19397 case 0x000c /* CalcCount */: wb.opts["CalcCount"] = val; break;
19398 case 0x0010 /* CalcDelta */: wb.opts["CalcDelta"] = val; break;
19399 case 0x0011 /* CalcIter */: wb.opts["CalcIter"] = val; break;
19400 case 0x000d /* CalcMode */: wb.opts["CalcMode"] = val; break;
19401 case 0x000e /* CalcPrecision */: wb.opts["CalcPrecision"] = val; break;
19402 case 0x005f /* CalcSaveRecalc */: wb.opts["CalcSaveRecalc"] = val; break;
19404 case 0x08a3 /* ForceFullCalculation */: wb.opts.FullCalc = val; break;
19515 safe_format_xf(temp_val, options, wb.opts.Date1904);
19521 safe_format_xf(temp_val, options, wb.opts.Date1904);
19527 safe_format_xf(temp_val, options, wb.opts.Date1904);
19535 safe_format_xf(temp_val, options, wb.opts.Date1904);
19553 safe_format_xf(temp_val, options, wb.opts.Date1904);
19566 safe_format_xf(temp_val, options, wb.opts.Date1904);
19597 safe_format_xf(temp_val, options, wb.opts.Date1904);
19603 safe_format_xf(temp_val, options, wb.opts.Date1904);
19611 safe_format_xf(temp_val, options, wb.opts.Date1904);
19620 safe_format_xf(temp_val, options, wb.opts.Date1904);
19732wb.SheetNames=keys(Directory).sort(function(a,b) { return Number(a) - Number(b); }).map(function(x…
19733 if(!options.bookSheets) wb.Sheets=Sheets;
19734 if(!wb.SheetNames.length && Preamble["!ref"]) {
19735 wb.SheetNames.push("Sheet1");
19737 if(wb.Sheets) wb.Sheets["Sheet1"] = Preamble;
19739 } else wb.Preamble=Preamble;
19740 …if(wb.Sheets) FilterDatabases.forEach(function(r,i) { wb.Sheets[wb.SheetNames[i]]['!autofilter'] =…
19741 wb.Strings = sst;
19742 wb.SSF = dup(table_fmt);
19743 if(opts.enc) wb.Encryption = opts.enc;
19744 if(themes) wb.Themes = themes;
19745 wb.Metadata = {};
19746 if(country !== undefined) wb.Metadata.Country = country;
19748 wb.Workbook = Workbook;
19749 return wb;
19778 function write_xls_props(wb/*:Workbook*/, cfb/*:CFBContainer*/) { argument
19783 if(wb.Props) {
19784 Keys = keys(wb.Props);
19786 ….hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]);
19788 if(wb.Custprops) {
19789 Keys = keys(wb.Custprops);
19791wb.Props||{}), Keys[i])) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries …
19851 function write_xlscfb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:CFBContainer*/ { argument
19864 CFB.utils.cfb_add(cfb, wbpath, write_biff_buf(wb, o));
19865 if(o.biff == 8 && (wb.Props || wb.Custprops)) write_xls_props(wb, cfb);
19867 …if(o.biff == 8 && wb.vbaraw) fill_vba_xls(cfb, CFB.read(wb.vbaraw, {type: typeof wb.vbaraw == "str…
21280 function write_ws_biff2(ba/*:BufArray*/, ws/*:Worksheet*/, idx/*:number*/, opts/*::, wb:Workbook*/)…
21303 function write_biff2_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) { argument
21308 for(var i=0;i<wb.SheetNames.length;++i) if(wb.SheetNames[i] == o.sheet) idx=i;
21309 …if(idx == 0 && !!o.sheet && wb.SheetNames[0] != o.sheet) throw new Error("Sheet not found: " + o.s…
21310 …write_biff_rec(ba, (o.biff == 4 ? 0x0409 : (o.biff == 3 ? 0x0209 : 0x0009)), write_BOF(wb, 0x10, o…
21312 write_ws_biff2(ba, wb.Sheets[wb.SheetNames[idx]], idx, o, wb);
21408 function write_ws_biff8(idx/*:number*/, opts, wb/*:Workbook*/) { argument
21410 var s = wb.SheetNames[idx], ws = wb.Sheets[s] || {};
21411 var _WB/*:WBWBProps*/ = ((wb||{}).Workbook||{}/*:any*/);
21424 write_biff_rec(ba, 0x0809, write_BOF(wb, 0x10, opts));
21481 function write_biff8_global(wb/*:Workbook*/, bufs, opts/*:WriteOpts*/) { argument
21483 var _WB/*:WBWBProps*/ = ((wb||{}).Workbook||{}/*:any*/);
21487 write_biff_rec(A, 0x0809, write_BOF(wb, 0x05, opts));
21500 write_biff_rec(A, 0x013d /* RRTabId */, write_RRTabId(wb.SheetNames.length));
21501 if(b8 && wb.vbaraw) write_biff_rec(A, 0x00d3 /* ObProj */);
21503 if(b8 && wb.vbaraw) {
21519 write_biff_rec(A, 0x0022 /* Date1904 */, writebool(safe1904(wb)=="true"));
21524 write_FONTS_biff8(A, wb, opts);
21525 write_FMTS_biff8(A, wb.SSF, opts);
21545 …for(j = 0; j < wb.SheetNames.length; ++j) blen += (b8 ? 12 : 11) + (b8 ? 2 : 1) * wb.SheetNames[j]…
21547 for(j = 0; j < wb.SheetNames.length; ++j) {
21549 …ndSheet8 */, write_BoundSheet8({pos:start, hs:_sheet.Hidden||0, dt:0, name:wb.SheetNames[j]}, opts…
21564 function write_biff8_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) { argument
21568 if(wb && !wb.SSF) {
21569 wb.SSF = dup(table_fmt);
21571 if(wb && wb.SSF) {
21572 make_ssf(); SSF_load_table(wb.SSF);
21574 o.revssf = evert_num(wb.SSF); o.revssf[wb.SSF[65535]] = 0;
21575 o.ssf = wb.SSF;
21584 if(!wb.Props) wb.Props = {};
21586 for(var i = 0; i < wb.SheetNames.length; ++i) bufs[bufs.length] = write_ws_biff8(i, o, wb);
21587 bufs.unshift(write_biff8_global(wb, bufs, o));
21591 function write_biff_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) { argument
21592 for(var i = 0; i <= wb.SheetNames.length; ++i) {
21593 var ws = wb.Sheets[wb.SheetNames[i]];
21597 …if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] …
21603 case 8: case 5: return write_biff8_buf(wb, opts);
21604 case 4: case 3: case 2: return write_biff2_buf(wb, opts);
21712 var wb = book_new();
21713 …mtch.forEach(function(s, idx) { book_append_sheet(wb, html_to_sheet(s, opts), "Sheet" + (idx+1)); …
21714 wb.bookType = "html";
21715 return wb;
21723 function sheet_to_html(ws/*:Worksheet*/, opts/*:?Sheet2HTMLOpts*//*, wb:?Workbook*/)/*:string*/ {
22621 var wb = parse_content_xml(utf8read(content), opts, Styles);
22622 if(safegetzipfile(zip, 'meta.xml')) wb.Props = parse_core_props(getzipdata(zip, 'meta.xml'));
22623 wb.bookType = "ods";
22624 return wb;
22627 var wb = parse_content_xml(data, opts);
22628 wb.bookType = "fods";
22629 return wb;
22633 var write_styles_ods/*:{(wb:any, opts:any):string}*/ = /* @__PURE__ */(function() {
22660 return function wso(/*::wb, opts*/) {
22827 var write_content_ods/*:{(wb:any, opts:any):string}*/ = /* @__PURE__ */(function() {
22839 var write_ws = function(ws, wb/*:Workbook*/, i/*:number*/, opts, nfs)/*:string*/ { argument
22842 …o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '" table:style-name="ta1"…
22920 if((wb.Workbook||{}).Names) o.push(write_names_ods(wb.Workbook.Names, wb.SheetNames, i));
22925 var write_automatic_styles_ods = function(o/*:Array<string>*/, wb) { argument
22930 wb.SheetNames.map(function(n) { return wb.Sheets[n]; }).forEach(function(ws) {
22949 wb.SheetNames.map(function(n) { return wb.Sheets[n]; }).forEach(function(ws) {
22979 wb.SheetNames.map(function(n) { return wb.Sheets[n]; }).forEach(function(ws) {
23002 return function wcx(wb, opts) { argument
23056 var nfs = write_automatic_styles_ods(o, wb);
23059 …if(((wb.Workbook||{}).WBProps||{}).date1904) o.push(' <table:calculation-settings table:case-…
23060 …for(var i = 0; i != wb.SheetNames.length; ++i) o.push(write_ws(wb.Sheets[wb.SheetNames[i]], wb, i,…
23061 if((wb.Workbook||{}).Names) o.push(write_names_ods(wb.Workbook.Names, wb.SheetNames, -1));
23070 function write_ods(wb/*:any*/, opts/*:any*/) { argument
23071 if(opts.bookType == "fods") return write_content_ods(wb, opts);
23085 zip_add_file(zip, f, write_content_ods(wb, opts));
23091 zip_add_file(zip, f, write_styles_ods(wb, opts));
23097 zip_add_file(zip, f, XML_HEADER + write_meta_ods(/*::wb, opts*/));
24351 function write_numbers_iwa(wb, opts) { argument
24362 wb.SheetNames.forEach(function(name, idx) {
24368 write_numbers_ws(cfb, deps, wb.Sheets[name], name, idx, sheetrefs[idx]);
25084 …*:string*/, sheet, idx/*:number*/, sheetRels, sheets, stype/*:string*/, opts, wb, themes, styles) { argument
25090 … case 'sheet': _ws = parse_ws(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break;
25091 case 'chart': _ws = parse_cs(data, path, idx, opts, sheetRels[sheet], wb, themes, styles);
25098 …ipstr(zip, chartp, true), chartp, opts, parse_rels(getzipstr(zip, crelsp, true), chartp), wb, _ws);
25100 … case 'macro': _ws = parse_ms(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break;
25101 … case 'dialog': _ws = parse_ds(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break;
25196 var wb = parse_wb(getzipdata(zip, strip_front_slash(dir.workbooks[0])), dir.workbooks[0], opts);
25219 if(wb.Sheets) sheets = wb.Sheets.map(function pluck(x){ return x.name; });
25235 var wbsheets = wb.Sheets;
25258 if(wbrels) wbrels = safe_parse_wbrels(wbrels, wb.Sheets);
25286 …safe_parse_sheet(zip, path, relsPath, props.SheetNames[i], i, sheetRels, sheets, stype, opts, wb, …
25291 Workbook: wb,
25371 function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ { argument
25372 if(wb && !wb.SSF) {
25373 wb.SSF = dup(table_fmt);
25375 if(wb && wb.SSF) {
25376 make_ssf(); SSF_load_table(wb.SSF);
25378 opts.revssf = evert_num(wb.SSF); opts.revssf[wb.SSF[65535]] = 0;
25379 opts.ssf = wb.SSF;
25395 if(!wb.Props) wb.Props = {};
25398 zip_add_file(zip, f, write_core_props(wb.Props, opts));
25402 /*::if(!wb.Props) throw "unreachable"; */
25404 if(wb.Props && wb.Props.SheetNames){/* empty */}
25405 else if(!wb.Workbook || !wb.Workbook.Sheets) wb.Props.SheetNames = wb.SheetNames;
25408 for(var _i = 0; _i < wb.SheetNames.length; ++_i)
25409 if((wb.Workbook.Sheets[_i]||{}).Hidden != 2) _sn.push(wb.SheetNames[_i]);
25410 wb.Props.SheetNames = _sn;
25412 wb.Props.Worksheets = wb.Props.SheetNames.length;
25413 zip_add_file(zip, f, write_ext_props(wb.Props, opts));
25417 if(wb.Custprops !== wb.Props && keys(wb.Custprops||{}).length > 0) {
25419 zip_add_file(zip, f, write_cust_props(wb.Custprops, opts));
25424 for(rId=1;rId <= wb.SheetNames.length; ++rId) {
25426 var ws = wb.Sheets[wb.SheetNames[rId-1]];
25433 zip_add_file(zip, f, write_ws_bin(rId-1, opts, wb, wsrels));
25467 zip_add_file(zip, f, write_wb_bin(wb, opts));
25474 var ww = write_theme(wb.Themes, opts);
25482 zip_add_file(zip, f, write_sty_bin(wb, opts));
25486 if(wb.vbaraw && vbafmt) {
25488 zip_add_file(zip, f, wb.vbaraw);
25506 function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ { argument
25507 if(wb && !wb.SSF) {
25508 wb.SSF = dup(table_fmt);
25510 if(wb && wb.SSF) {
25511 make_ssf(); SSF_load_table(wb.SSF);
25513 opts.revssf = evert_num(wb.SSF); opts.revssf[wb.SSF[65535]] = 0;
25514 opts.ssf = wb.SSF;
25530 if(!wb.Props) wb.Props = {};
25533 zip_add_file(zip, f, write_core_props(wb.Props, opts));
25537 /*::if(!wb.Props) throw "unreachable"; */
25539 if(wb.Props && wb.Props.SheetNames){/* empty */}
25540 else if(!wb.Workbook || !wb.Workbook.Sheets) wb.Props.SheetNames = wb.SheetNames;
25543 for(var _i = 0; _i < wb.SheetNames.length; ++_i)
25544 if((wb.Workbook.Sheets[_i]||{}).Hidden != 2) _sn.push(wb.SheetNames[_i]);
25545 wb.Props.SheetNames = _sn;
25547 wb.Props.Worksheets = wb.Props.SheetNames.length;
25548 zip_add_file(zip, f, write_ext_props(wb.Props, opts));
25552 if(wb.Custprops !== wb.Props && keys(wb.Custprops||{}).length > 0) {
25554 zip_add_file(zip, f, write_cust_props(wb.Custprops, opts));
25562 for(rId=1;rId <= wb.SheetNames.length; ++rId) {
25564 var ws = wb.Sheets[wb.SheetNames[rId-1]];
25571 zip_add_file(zip, f, write_ws_xml(rId-1, opts, wb, wsrels));
25616 zip_add_file(zip, f, write_wb_xml(wb, opts));
25623 zip_add_file(zip, f, write_theme(wb.Themes, opts));
25630 zip_add_file(zip, f, write_sty_xml(wb, opts));
25634 if(wb.vbaraw && vbafmt) {
25636 zip_add_file(zip, f, wb.vbaraw);
25796 function write_zip(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ { argument
25798 case "ods": return write_ods(wb, opts);
25799 case "numbers": return write_numbers_iwa(wb, opts);
25800 case "xlsb": return write_zip_xlsb(wb, opts);
25801 default: return write_zip_xlsx(wb, opts);
25806 function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ { argument
25808 var z = write_zip(wb, o);
25811 function write_zip_typeXLSX(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ { argument
25813 var z = write_zip_xlsx(wb, o);
25843 function write_cfb_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ { argument
25845 var cfb/*:CFBContainer*/ = write_xlscfb(wb, o);
25896 function writeSyncXLSX(wb/*:Workbook*/, opts/*:?WriteOpts*/) { argument
25898 check_wb(wb);
25901 …if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSyncXLSX(wb, o)/*:any*/); o.…
25902 return write_zip_typeXLSX(wb, o);
25905 function writeSync(wb/*:Workbook*/, opts/*:?WriteOpts*/) { argument
25907 check_wb(wb);
25910 …if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSync(wb, o)/*:any*/); o.type…
25914 else idx = wb.SheetNames.indexOf(o.sheet);
25915 if(!wb.SheetNames[idx]) throw new Error("Sheet not found: " + o.sheet + " : " + (typeof o.sheet));
25919 case 'xlml': return write_string_type(write_xlml(wb, o), o);
25921 case 'sylk': return write_string_type(SYLK.from_sheet(wb.Sheets[wb.SheetNames[idx]], o, wb), o);
25923 case 'html': return write_string_type(sheet_to_html(wb.Sheets[wb.SheetNames[idx]], o), o);
25924 case 'txt': return write_stxt_type(sheet_to_txt(wb.Sheets[wb.SheetNames[idx]], o), o);
25925 case 'csv': return write_string_type(sheet_to_csv(wb.Sheets[wb.SheetNames[idx]], o), o, "\ufeff");
25926 case 'dif': return write_string_type(DIF.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o);
25927 case 'dbf': return write_binary_type(DBF.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o);
25928 case 'prn': return write_string_type(PRN.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o);
25929 case 'rtf': return write_string_type(sheet_to_rtf(wb.Sheets[wb.SheetNames[idx]], o), o);
25930 case 'eth': return write_string_type(ETH.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o);
25931 case 'fods': return write_string_type(write_ods(wb, o), o);
25932 case 'wk1': return write_binary_type(WK_.sheet_to_wk1(wb.Sheets[wb.SheetNames[idx]], o), o);
25933 case 'wk3': return write_binary_type(WK_.book_to_wk3(wb, o), o);
25936 case 'biff4': if(!o.biff) o.biff = 4; return write_binary_type(write_biff_buf(wb, o), o);
25940 case 'xls': if(!o.biff) o.biff = 8; return write_cfb_type(wb, o);
25946 case 'ods': return write_zip_type(wb, o);
25965 function writeFileSync(wb/*:Workbook*/, filename/*:string*/, opts/*:?WriteFileOpts*/) { argument
25969 return writeSync(wb, o);
25972 function writeFileSyncXLSX(wb/*:Workbook*/, filename/*:string*/, opts/*:?WriteFileOpts*/) { argument
25976 return writeSyncXLSX(wb, o);
25980 function writeFileAsync(filename/*:string*/, wb/*:Workbook*/, opts/*:?WriteFileOpts*/, cb/*:?(e?:Er… argument
25986 return _fs.writeFile(filename, writeSync(wb, o), _cb);
26269 function wb_sheet_idx(wb/*:Workbook*/, sh/*:number|string*/) { argument
26271 if(sh >= 0 && wb.SheetNames.length > sh) return sh;
26274 var idx = wb.SheetNames.indexOf(sh);
26286 function book_append_sheet(wb/*:Workbook*/, ws/*:Worksheet*/, name/*:?string*/, roll/*:?boolean*/)/… argument
26288 …if(!name) for(; i <= 0xFFFF; ++i, name = undefined) if(wb.SheetNames.indexOf(name = "Sheet" + i) =…
26289 if(!name || wb.SheetNames.length >= 0xFFFF) throw new Error("Too many worksheets");
26290 if(roll && wb.SheetNames.indexOf(name) >= 0) {
26294 for(++i; i <= 0xFFFF; ++i) if(wb.SheetNames.indexOf(name = root + i) == -1) break;
26297 …if(wb.SheetNames.indexOf(name) >= 0) throw new Error("Worksheet with name |" + name + "| already e…
26299 wb.SheetNames.push(name);
26300 wb.Sheets[name] = ws;
26305 function book_set_sheet_visibility(wb/*:Workbook*/, sh/*:number|string*/, vis/*:number*/) { argument
26306 if(!wb.Workbook) wb.Workbook = {};
26307 if(!wb.Workbook.Sheets) wb.Workbook.Sheets = [];
26309 var idx = wb_sheet_idx(wb, sh);
26311 if(!wb.Workbook.Sheets[idx]) wb.Workbook.Sheets[idx] = {};
26318 wb.Workbook.Sheets[idx].Hidden = vis;