@justybase/spreadsheet-tasks 1.3.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +25 -16
- package/browser/browser-spreadsheet.js +3037 -0
- package/browser/justybase-spreadsheet.min.js +36 -0
- package/dist/cjs/index.d.ts +399 -0
- package/dist/cjs/index.js +3944 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/index.js +3889 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/docs/API.md +8 -9
- package/docs/PACKAGING.md +32 -0
- package/docs/PUBLISHING.md +8 -1
- package/examples/basic-read.ts +1 -1
- package/examples/formats-verify.ts +1 -2
- package/examples/large-dataset.ts +1 -1
- package/package.json +28 -13
- package/dist/BiffReaderWriter.d.ts +0 -44
- package/dist/BiffReaderWriter.d.ts.map +0 -1
- package/dist/BiffReaderWriter.js +0 -282
- package/dist/BiffReaderWriter.js.map +0 -1
- package/dist/BigBuffer.d.ts +0 -24
- package/dist/BigBuffer.d.ts.map +0 -1
- package/dist/BigBuffer.js +0 -120
- package/dist/BigBuffer.js.map +0 -1
- package/dist/ExcelReaderAbstract.d.ts +0 -17
- package/dist/ExcelReaderAbstract.d.ts.map +0 -1
- package/dist/ExcelReaderAbstract.js +0 -25
- package/dist/ExcelReaderAbstract.js.map +0 -1
- package/dist/Formats.d.ts +0 -34
- package/dist/Formats.d.ts.map +0 -1
- package/dist/Formats.js +0 -48
- package/dist/Formats.js.map +0 -1
- package/dist/ReaderFactory.d.ts +0 -6
- package/dist/ReaderFactory.d.ts.map +0 -1
- package/dist/ReaderFactory.js +0 -56
- package/dist/ReaderFactory.js.map +0 -1
- package/dist/XlsbReader.d.ts +0 -24
- package/dist/XlsbReader.d.ts.map +0 -1
- package/dist/XlsbReader.js +0 -186
- package/dist/XlsbReader.js.map +0 -1
- package/dist/XlsbWriter.d.ts +0 -80
- package/dist/XlsbWriter.d.ts.map +0 -1
- package/dist/XlsbWriter.js +0 -964
- package/dist/XlsbWriter.js.map +0 -1
- package/dist/XlsxReader.d.ts +0 -30
- package/dist/XlsxReader.d.ts.map +0 -1
- package/dist/XlsxReader.js +0 -341
- package/dist/XlsxReader.js.map +0 -1
- package/dist/XlsxWriter.d.ts +0 -51
- package/dist/XlsxWriter.d.ts.map +0 -1
- package/dist/XlsxWriter.js +0 -632
- package/dist/XlsxWriter.js.map +0 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -29
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";var JustybaseSpreadsheet=(()=>{var $=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var O=(d,t)=>{for(var e in t)$(d,e,{get:t[e],enumerable:!0})},H=(d,t,e,x)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of z(t))!b.call(d,s)&&s!==e&&$(d,s,{get:()=>t[s],enumerable:!(x=M(t,s))||x.enumerable});return d};var W=d=>H($({},"__esModule",{value:!0}),d);var G={};O(G,{BrowserBigBuffer:()=>y,BrowserXlsbWriter:()=>C,BrowserXlsxWriter:()=>S,BrowserZip:()=>F,F:()=>V,downloadXlsb:()=>q,downloadXlsbMultiSheet:()=>j,downloadXlsx:()=>X,downloadXlsxMultiSheet:()=>Y});var y=class{constructor(t=65536){this.chunkSize=t,this.chunks=[],this.currentBuffer=new Uint8Array(t),this.dataView=new DataView(this.currentBuffer.buffer),this.cursor=0,this._textEncoder=new TextEncoder}ensureCapacity(t){this.cursor+t>this.chunkSize&&this._flush()}_flush(){this.cursor>0&&(this.chunks.push(this.currentBuffer.slice(0,this.cursor)),this.currentBuffer=new Uint8Array(this.chunkSize),this.dataView=new DataView(this.currentBuffer.buffer),this.cursor=0)}write(t){let e=t.length,x=0;for(;e>0;){let s=this.chunkSize-this.cursor;s===0&&(this._flush(),s=this.chunkSize);let r=Math.min(e,s);this.currentBuffer.set(t.subarray(x,x+r),this.cursor),this.cursor+=r,x+=r,e-=r}}writeByte(t){this.ensureCapacity(1),this.currentBuffer[this.cursor]=t,this.cursor++}writeUnsafeByte(t){this.currentBuffer[this.cursor++]=t}writeInt32LE(t){this.ensureCapacity(4),this.dataView.setInt32(this.cursor,t,!0),this.cursor+=4}writeUnsafeInt32LE(t){this.dataView.setInt32(this.cursor,t,!0),this.cursor+=4}writeDoubleLE(t){this.ensureCapacity(8),this.dataView.setFloat64(this.cursor,t,!0),this.cursor+=8}writeUnsafeDoubleLE(t){this.dataView.setFloat64(this.cursor,t,!0),this.cursor+=8}writeString(t){let e=this._textEncoder.encode(t),x=e.length;if(this.cursor+x<=this.chunkSize){this.currentBuffer.set(e,this.cursor),this.cursor+=x;return}this._flush(),x>this.chunkSize?this.chunks.push(e):(this.currentBuffer.set(e,this.cursor),this.cursor+=x)}writeUtf16LE(t){let e=t.length*2;if(this.cursor+e<=this.chunkSize){for(let x=0;x<t.length;x++){let s=t.charCodeAt(x);this.currentBuffer[this.cursor++]=s&255,this.currentBuffer[this.cursor++]=s>>8&255}return}if(this._flush(),e>this.chunkSize){let x=new Uint8Array(e);for(let s=0;s<t.length;s++){let r=t.charCodeAt(s);x[s*2]=r&255,x[s*2+1]=r>>8&255}this.chunks.push(x)}else for(let x=0;x<t.length;x++){let s=t.charCodeAt(x);this.currentBuffer[this.cursor++]=s&255,this.currentBuffer[this.cursor++]=s>>8&255}}getChunks(){return this.cursor>0&&(this.chunks.push(this.currentBuffer.slice(0,this.cursor)),this.currentBuffer=new Uint8Array(this.chunkSize),this.dataView=new DataView(this.currentBuffer.buffer),this.cursor=0),this.chunks}toUint8Array(){let t=this.getChunks(),e=0;for(let r of t)e+=r.length;let x=new Uint8Array(e),s=0;for(let r of t)x.set(r,s),s+=r.length;return x}reset(){this.chunks=[],this.cursor=0}};var F=class d{constructor(){this.files=[]}addFile(t,e){let x;if(typeof e=="string")x=new TextEncoder().encode(e);else if(Array.isArray(e)){let s=0;for(let o of e)s+=o.length;x=new Uint8Array(s);let r=0;for(let o of e)x.set(o,r),r+=o.length}else x=e;this.files.push({name:t,data:x})}toBlob(){let t=[],e=[],x=0;for(let n of this.files){let f=new TextEncoder().encode(n.name),c=this._crc32(n.data),h=new Uint8Array(30+f.length),l=new DataView(h.buffer);l.setUint32(0,67324752,!0),l.setUint16(4,20,!0),l.setUint16(6,0,!0),l.setUint16(8,0,!0),l.setUint16(10,0,!0),l.setUint16(12,0,!0),l.setUint32(14,c,!0),l.setUint32(18,n.data.length,!0),l.setUint32(22,n.data.length,!0),l.setUint16(26,f.length,!0),l.setUint16(28,0,!0),h.set(f,30),t.push(h),t.push(n.data);let a=new Uint8Array(46+f.length),m=new DataView(a.buffer);m.setUint32(0,33639248,!0),m.setUint16(4,20,!0),m.setUint16(6,20,!0),m.setUint16(8,0,!0),m.setUint16(10,0,!0),m.setUint16(12,0,!0),m.setUint16(14,0,!0),m.setUint32(16,c,!0),m.setUint32(20,n.data.length,!0),m.setUint32(24,n.data.length,!0),m.setUint16(28,f.length,!0),m.setUint16(30,0,!0),m.setUint16(32,0,!0),m.setUint16(34,0,!0),m.setUint16(36,0,!0),m.setUint32(38,0,!0),m.setUint32(42,x,!0),a.set(f,46),e.push(a),x+=h.length+n.data.length}let s=x,r=0;for(let n of e)t.push(n),r+=n.length;let o=new Uint8Array(22),i=new DataView(o.buffer);return i.setUint32(0,101010256,!0),i.setUint16(4,0,!0),i.setUint16(6,0,!0),i.setUint16(8,this.files.length,!0),i.setUint16(10,this.files.length,!0),i.setUint32(12,r,!0),i.setUint32(16,s,!0),i.setUint16(20,0,!0),t.push(o),new Blob(t,{type:"application/octet-stream"})}_crc32(t){if(!d._crc32Table){d._crc32Table=new Uint32Array(256);for(let s=0;s<256;s++){let r=s;for(let o=0;o<8;o++)r=r&1?3988292384^r>>>1:r>>>1;d._crc32Table[s]=r}}let e=d._crc32Table,x=4294967295;for(let s=0;s<t.length;s++)x=e[(x^t[s])&255]^x>>>8;return(x^4294967295)>>>0}};F._crc32Table=null;var V={THOUSANDS_SEP:"#,##0",CURRENCY_PLN:'#,##0.00 "z\u0142"',CURRENCY_EUR:"#,##0.00 \u20AC",PERCENTAGE:"0%",SCIENTIFIC:"0.00E+00",TWO_DECIMALS:"#,##0.00",TEXT:"@",LEADING_ZEROS:"000000000",DATE_SHORT:"dd.mm.yyyy",DATE_LONG:"d mmmm yyyy",DATE_DAY_MONTH_YEAR:"dd-mm-yyyy",DATE_ISO:"yyyy-mm-dd",DATE_MONTH_YEAR:"mmmm yyyy",DATE_WEEKDAY:"dddd, d mmmm yyyy",DATE_DAY_MONTH:"d mmmm",DATE_YEAR_ONLY:"yyyy",DATETIME_SHORT:"dd.mm.yyyy hh:mm",DATETIME_LONG:"d mmmm yyyy hh:mm:ss",TIME_HH_MM:"hh:mm",TIME_HH_MM_SS:"hh:mm:ss",TIME_12H:"h:mm AM/PM",DATETIME_24H:"dd.mm.yyyy hh:mm:ss",DATETIME_ISO:'yyyy-mm-dd"T"hh:mm:ss',TIME_MS:"hh:mm:ss.000"};function A(d){return d!=null&&typeof d=="object"&&"format"in d&&typeof d.format=="string"}function D(d){return A(d)?d.value:d}function T(d){return A(d)?d.format:null}var N=(()=>{let d=[];for(let e=65;e<91;e++)d.push(String.fromCharCode(e));let t=[];for(let e of d)for(let x=65;x<91;x++)t.push(e+String.fromCharCode(x));return d.push(...t),d})(),S=class{constructor(){this._zip=new F,this._sc=0,this._sl=[],this._sstA=[],this._sstM=new Map,this._sstCnt=0,this._cw=[],this._afOn=!1,this._oaE=Date.UTC(1899,11,30),this._csb=null,this._csrn=0,this._csSC=0,this._csEC=0,this._csAF=!1,this._isS=!1,this._csCL=[],this._fmtReg=new Map,this._fmtXf=new Map,this._nextNfmt=165,this._nextXf=6}_cl(t){return t<N.length?N[t]:"A"}_san(t){if(!t||typeof t!="string")return`Sheet${this._sc+1}`;let e=t.replace(/[\\/*?[\]:]/g,"_");return e.length>31&&(e=e.substring(0,31)),e.trim()||(e=`Sheet${this._sc+1}`),e}_ex(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}_esc(t){if(typeof t!="string")return t;let e=!1;for(let x=0;x<t.length;x++){let s=t.charCodeAt(x);if(s===38||s===60||s===62||s===34||s===39||s>=0&&s<=8||s===11||s===12||s>=14&&s<=31){e=!0;break}}return e?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/[\x00-\x08\x0b\x0c\x0e-\x1f]/g,""):t}_fmn(t){return/[\s\-+=()!@#$%^&]/.test(t)||/^[0-9]/.test(t)?`'${t.replace(/'/g,"''")}'`:t}addSheet(t,e=!1){let x=this._san(t);this._sc++,this._sl.push({name:x,path:`xl/worksheets/sheet${this._sc}.xml`,hidden:e,fn:`sheet${this._sc}.xml`,id:this._sc,rId:`rId${this._sc}`,fhr:null})}_wsc(t,e,x,s,r){let o=this._sstM.get(e);o===void 0&&(o=this._sstA.length,this._sstA.push(e),this._sstM.set(e,o)),this._sstCnt++;let i=r!==void 0?` s="${r}"`:"";t.writeString(`<c r="${x}${s}" t="s"${i}><v>${o}</v></c>`)}_wscStyle(t,e,x,s,r){let o=this._sstM.get(e);o===void 0&&(o=this._sstA.length,this._sstA.push(e),this._sstM.set(e,o)),this._sstCnt++,t.writeString(`<c r="${x}${s}" t="s" s="${r}"><v>${o}</v></c>`)}_oa(t){return(t.getTime()-this._oaE)/864e5}_regFmt(t){if(this._fmtXf.has(t))return this._fmtXf.get(t);let e=this._nextNfmt++;this._fmtReg.set(t,e);let x=this._nextXf++;return this._fmtXf.set(t,x),x}_wcv(t,e,x,s){if(e==null)return;let r=T(e),o=r!==null?D(e):e,i=r!==null?this._regFmt(r):-1,n=i>=0?` s="${i}"`:"";if(typeof o=="number")Number.isFinite(o)?t.writeString(`<c r="${x}${s}"${n}><v>${o}</v></c>`):this._wsc(t,o.toString(),x,s,i>=0?i:void 0);else if(typeof o=="bigint")this._wsc(t,o.toString(),x,s,i>=0?i:void 0);else if(typeof o=="boolean")t.writeString(`<c r="${x}${s}" t="b"${n}><v>${o?1:0}</v></c>`);else if(o instanceof Date){let f=this._oa(o);Number.isFinite(f)?t.writeString(`<c r="${x}${s}" s="${i>=0?i:1}"><v>${f}</v></c>`):this._wsc(t,o.toString(),x,s,i>=0?i:void 0)}else this._wsc(t,o.toString(),x,s,i>=0?i:void 0)}_sheetHead(t,e,x,s){t.writeString('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),t.writeString('<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'),t.writeString('<dimension ref="A1"/>'),s?t.writeString(`<sheetViews><sheetView ${x?'tabSelected="1" ':""}workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/><selection pane="bottomLeft"/></sheetView></sheetViews><sheetFormatPr defaultRowHeight="15"/>`):t.writeString(`<sheetViews><sheetView ${x?'tabSelected="1" ':""}workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/>`),t.writeString("<cols>");for(let r=0;r<e;r++){let o=this._cw[r]>0?this._cw[r]:10;t.writeString(`<col min="${r+1}" max="${r+1}" width="${o}" bestFit="1" customWidth="1"/>`)}t.writeString("</cols><sheetData>")}startSheet(t,e,x,s={}){if(this._isS)throw new Error("Already streaming");let{hidden:r=!1,doAutofilter:o=!0,headerStyle:i="bold"}=s,n=3;i==="fill"?n=4:i==="bold+fill"&&(n=5),this.addSheet(t,r),this._isS=!0,this._csb=new y,this._csrn=0,this._csSC=0,this._csEC=e,this._csAF=o&&x!==void 0,this._cw=new Array(e).fill(-1);let f=new Array(e);for(let c=0;c<e;c++)f[c]=this._cl(c);if(this._csCL=f,x)for(let c=0;c<e;c++){let h=1.3*(x[c]?x[c].length:0)+3;h>80&&(h=80),this._cw[c]<h&&(this._cw[c]=h)}if(this._sheetHead(this._csb,e,this._sc===1,this._csAF),x){this._csrn++,this._csb.writeString(`<row r="${this._csrn}">`);for(let c=0;c<x.length;c++)this._wscStyle(this._csb,x[c],f[c],this._csrn,n);this._csb.writeString("</row>")}}writeRow(t){if(!this._isS)throw new Error("Not streaming");this._csrn++,this._csb.writeString(`<row r="${this._csrn}">`);for(let e=0;e<t.length;e++)this._wcv(this._csb,t[e],this._csCL[e],this._csrn);this._csb.writeString("</row>")}endSheet(){if(!this._isS)throw new Error("Not streaming");if(this._csb.writeString("</sheetData>"),this._csAF&&this._csEC>0){this._afOn=!0;let t=`A1:${this._csCL[this._csEC-1]}${this._csrn}`;this._csb.writeString(`<autoFilter ref="${t}"/>`);let e=this._sl[this._sc-1];e.fhr=`${this._fmn(e.name)}!$A$1:$${this._csCL[this._csEC-1]}$${this._csrn}`}this._csb.writeString("</worksheet>"),this._zip.addFile(this._sl[this._sc-1].path,this._csb.toUint8Array()),this._isS=!1,this._csb=null}writeSheet(t,e=null,x={}){let s=x.doAutofilter!==!1,r=x.headerStyle||"bold",o=3;r==="fill"?o=4:r==="bold+fill"&&(o=5);let i=new y,n=t.length>0?t[0].length:e?e.length:0;this._cw=new Array(n).fill(-1);let f=new Array(n);for(let l=0;l<n;l++)f[l]=this._cl(l);if(e)for(let l=0;l<n;l++){let a=1.3*(e[l]?e[l].length:0)+3;a>80&&(a=80),this._cw[l]<a&&(this._cw[l]=a)}for(let l=0;l<Math.min(t.length,100);l++)for(let a=0;a<t[l].length;a++){let m=t[l][a];if(m==null)continue;let g=A(m)?m.value:m,p=1.3*(g instanceof Date?10:g.toString().length)+3;p>80&&(p=80),this._cw[a]<p&&(this._cw[a]=p)}let c=t.length+(e?1:0);this._sheetHead(i,n,this._sc===1,s&&!!e);let h=0;if(e){h++,i.writeString(`<row r="${h}">`);for(let l=0;l<e.length;l++)this._wscStyle(i,e[l],f[l],h,o);i.writeString("</row>")}for(let l=0;l<t.length;l++){h++,i.writeString(`<row r="${h}">`);for(let a=0;a<t[l].length;a++)this._wcv(i,t[l][a],f[a],h);i.writeString("</row>")}if(i.writeString("</sheetData>"),s&&e&&n>0){this._afOn=!0;let l=`A1:${f[n-1]}${c}`;i.writeString(`<autoFilter ref="${l}"/>`);let a=this._sl[this._sc-1];a.fhr=`${this._fmn(a.name)}!$A$1:$${f[n-1]}$${c}`}i.writeString("</worksheet>"),this._zip.addFile(this._sl[this._sc-1].path,i.toUint8Array())}finalize(){return this._writeSst(),this._writeStyles(),this._writeWb(),this._writeCt(),this._writeRels(),this._zip.toBlob()}_writeSst(){let t=new y;t.writeString('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),t.writeString(`<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="${this._sstCnt}" uniqueCount="${this._sstA.length}">`);for(let e of this._sstA){let x=this._esc(e);x.length>0&&(x[0]===" "||x[x.length-1]===" "||/[\t\n\r]/.test(x))?t.writeString(`<si><t xml:space="preserve">${x}</t></si>`):t.writeString(`<si><t>${x}</t></si>`)}t.writeString("</sst>"),this._zip.addFile("xl/sharedStrings.xml",t.toUint8Array())}_writeStyles(){let t='<numFmt numFmtId="164" formatCode="yyyy\\-mm\\-dd\\ hh:mm:ss"/>',e=1,x=['<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>','<xf numFmtId="14" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>','<xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>','<xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/>','<xf numFmtId="0" fontId="0" fillId="1" borderId="0" xfId="0" applyFill="1"/>','<xf numFmtId="0" fontId="1" fillId="1" borderId="0" xfId="0" applyFont="1" applyFill="1"/>'];for(let[r,o]of this._fmtReg){let i=r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");t+=`<numFmt numFmtId="${o}" formatCode="${i}"/>`,e++}let s=[...this._fmtXf.entries()].sort((r,o)=>r[1]-o[1]);for(let[r]of s){let o=this._fmtReg.get(r);x.push(`<xf numFmtId="${o}" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>`)}this._zip.addFile("xl/styles.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
+
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
3
|
+
<numFmts count="${e}">${t}</numFmts>
|
|
4
|
+
<fonts count="2">
|
|
5
|
+
<font><sz val="11"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font>
|
|
6
|
+
<font><b/><sz val="11"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font>
|
|
7
|
+
</fonts>
|
|
8
|
+
<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>
|
|
9
|
+
<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>
|
|
10
|
+
<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
|
|
11
|
+
<cellXfs count="${x.length}">
|
|
12
|
+
${x.join(`
|
|
13
|
+
`)}
|
|
14
|
+
</cellXfs>
|
|
15
|
+
<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>
|
|
16
|
+
<dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium2" defaultPivotStyle="PivotStyleLight16"/>
|
|
17
|
+
</styleSheet>`)}_writeWb(){let t='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild="4505"/><workbookPr defaultThemeVersion="124226"/><bookViews><workbookView xWindow="240" yWindow="15" windowWidth="16095" windowHeight="9660"/></bookViews><sheets>';for(let e of this._sl)t+=`<sheet name="${this._ex(e.name)}" sheetId="${e.id}"${e.hidden?' state="hidden"':""} r:id="${e.rId}"/>`;if(t+="</sheets>",this._afOn){t+="<definedNames>";for(let e of this._sl)e.fhr&&(t+=`<definedName name="_xlnm._FilterDatabase" localSheetId="${e.id-1}" hidden="1">${this._esc(e.fhr)}</definedName>`);t+="</definedNames>"}t+='<calcPr calcId="124519" fullCalcOnLoad="1"/></workbook>',this._zip.addFile("xl/workbook.xml",t)}_writeCt(){let t='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/><Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>';for(let e of this._sl)t+=`<Override PartName="/${e.path}" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`;t+="</Types>",this._zip.addFile("[Content_Types].xml",t)}_writeRels(){this._zip.addFile("_rels/.rels",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>');let t='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">';for(let x of this._sl)t+=`<Relationship Id="${x.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/${x.fn}"/>`;let e=this._sl.length+1;t+=`<Relationship Id="rId${e++}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>`,t+=`<Relationship Id="rId${e++}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/>`,t+="</Relationships>",this._zip.addFile("xl/_rels/workbook.xml.rels",t)}};var P=/[\\/*?[\]:]/g,C=class{constructor(){this._zip=new F,this._sheetCount=0,this._sheetList=[],this._sstDic=new Map,this._sstCntUnique=0,this._sstCntAll=0,this._colWidths=[],this._autofilterIsOn=!1,this._oaEpoch=Date.UTC(1899,11,30),this._isStreaming=!1,this._currentSheetBuffer=null,this._currentSheetRowNum=0,this._currentSheetStartCol=0,this._currentSheetEndCol=0,this._currentSheetDoAutofilter=!1,this._fmtMap=new Map,this._nextNid=167,this._nextXf=4,this._sheet1Bytes=new Uint8Array([129,1,0,147,1,23,203,4,2,0,64,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,148,1,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,1,0,137,1,30,220,3,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,100,0,0,0,0,0,0,0,0,0,0,0,152,1,36,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,1,0,134,1,0,37,6,1,0,2,14,0,128,149,8,2,5,0,38,0,229,3,12,255,255,255,255,8,0,44,1,0,0,0,0,145,1,0,37,6,1,0,2,14,0,128,128,8,2,5,0,38,0,0,25,0,0,0,0,0,0,0,0,44,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,7,12,0,0,0,0,0,0,0,0,0,0,0,0,146,1,0,151,4,66,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,221,3,2,16,0,220,3,48,102,102,102,102,102,102,230,63,102,102,102,102,102,102,230,63,0,0,0,0,0,0,232,63,0,0,0,0,0,0,232,63,51,51,51,51,51,51,211,63,51,51,51,51,51,51,211,63,37,6,1,0,0,16,0,128,128,24,16,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,38,0,130,1,0]),this._workbookBinStart=new Uint8Array([131,1,0,128,1,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,120,0,108,0,1,0,0,0,55,0,1,0,0,0,54,0,5,0,0,0,50,0,52,0,51,0,50,0,54,0,153,1,12,32,0,1,0,0,0,0,0,0,0,0,0,37,6,1,0,3,15,0,128,151,16,52,24,0,0,0,67,0,58,0,92,0,115,0,113,0,108,0,115,0,92,0,84,0,101,0,115,0,116,0,121,0,90,0,97,0,112,0,105,0,115,0,117,0,88,0,108,0,115,0,98,0,92,0,38,0,37,6,1,0,0,16,0,128,129,24,130,1,0,0,0,0,0,0,0,0,47,0,0,0,49,0,51,0,95,0,110,0,99,0,114,0,58,0,49,0,95,0,123,0,49,0,54,0,53,0,48,0,56,0,68,0,54,0,57,0,45,0,67,0,70,0,56,0,55,0,45,0,52,0,55,0,54,0,57,0,45,0,56,0,52,0,53,0,54,0,45,0,68,0,52,0,65,0,52,0,48,0,49,0,49,0,51,0,49,0,53,0,54,0,55,0,125,0,47,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,0,135,1,0,37,6,1,0,2,16,0,128,128,24,16,0,0,0,0,13,0,0,0,255,255,255,255,0,0,0,0,38,0,158,1,29,0,0,0,0,158,22,0,0,180,105,0,0,232,38,0,0,88,2,0,0,0,0,0,0,0,0,0,0,120,136,1,0,143,1,0]),this._workbookBinMiddle=new Uint8Array([144,1,0]),this._workbookBinEnd=new Uint8Array([157,1,26,53,234,2,0,1,0,0,0,100,0,0,0,252,169,241,210,77,98,80,63,1,0,0,0,106,0,155,1,1,0,35,4,3,15,0,0,171,16,1,1,36,0,132,1,0]),this._stylesBin=new Uint8Array([150,2,0,231,4,4,2,0,0,0,44,44,164,0,19,0,0,0,121,0,121,0,121,0,121,0,92,0,45,0,109,0,109,0,92,0,45,0,100,0,100,0,92,0,32,0,104,0,104,0,58,0,109,0,109,0,44,30,166,0,12,0,0,0,121,0,121,0,121,0,121,0,92,0,45,0,109,0,109,0,92,0,45,0,100,0,100,0,232,4,0,227,4,4,2,0,0,0,43,39,220,0,0,0,144,1,0,0,0,2,0,0,7,1,0,0,0,0,0,255,2,7,0,0,0,67,0,97,0,108,0,105,0,98,0,114,0,105,0,43,39,220,0,1,0,188,2,0,0,0,2,238,0,7,1,0,0,0,0,0,255,2,7,0,0,0,67,0,97,0,108,0,105,0,98,0,114,0,105,0,37,6,1,0,2,14,0,128,129,8,0,38,0,228,4,0,219,4,4,2,0,0,0,45,68,0,0,0,0,3,64,0,0,0,0,0,255,3,65,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,68,17,0,0,0,3,64,0,0,0,0,0,255,3,65,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,220,4,0,229,4,4,1,0,0,0,46,51,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,230,4,0,242,4,4,1,0,0,0,47,16,255,255,0,0,0,0,0,0,0,0,0,0,16,16,0,0,243,4,0,233,4,4,6,0,0,0,47,16,0,0,0,0,0,0,0,0,0,0,0,0,16,16,0,0,47,16,0,0,164,0,0,0,0,0,0,0,0,0,16,16,1,0,47,16,0,0,166,0,0,0,0,0,0,0,0,0,16,16,1,0,47,16,0,0,0,0,1,0,0,0,0,0,0,0,16,16,1,0,47,16,0,0,0,0,0,0,1,0,0,0,0,0,16,16,1,0,47,16,0,0,0,0,1,0,1,0,0,0,0,0,16,16,1,0,234,4,0,235,4,4,1,0,0,0,37,6,1,0,2,17,0,128,128,24,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,0,48,28,0,0,0,0,1,0,0,0,8,0,0,0,78,0,111,0,114,0,109,0,97,0,108,0,110,0,121,0,236,4,0,249,3,4,0,0,0,0,250,3,0,252,3,80,0,0,0,0,17,0,0,0,84,0,97,0,98,0,108,0,101,0,83,0,116,0,121,0,108,0,101,0,77,0,101,0,100,0,105,0,117,0,109,0,50,0,17,0,0,0,80,0,105,0,118,0,111,0,116,0,83,0,116,0,121,0,108,0,101,0,76,0,105,0,103,0,104,0,116,0,49,0,54,0,253,3,0,35,4,2,14,0,0,235,8,0,246,8,42,0,0,0,0,17,0,0,0,83,0,108,0,105,0,99,0,101,0,114,0,83,0,116,0,121,0,108,0,101,0,76,0,105,0,103,0,104,0,116,0,49,0,247,8,0,236,8,0,36,0,35,4,3,15,0,0,176,16,0,178,16,50,0,0,0,0,21,0,0,0,84,0,105,0,109,0,101,0,83,0,108,0,105,0,99,0,101,0,114,0,83,0,116,0,121,0,108,0,101,0,76,0,105,0,103,0,104,0,116,0,49,0,179,16,0,177,16,0,36,0,151,2,0]),this._binaryIndexBin=new Uint8Array([42,24,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,149,2,0]),this._rRkIntegerLowerLimit=-1<<29,this._rRkIntegerUpperLimit=(1<<29)-1,this._autoFilterStartBytes=new Uint8Array([161,1,16]),this._autoFilterEndBytes=new Uint8Array([162,1,0]),this._stickHeaderA1bytes=new Uint8Array([151,1,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,63,1,0,0,0,0,0,0,0,2,0,0,0,3]),this._magicFilterExcel2016Fix0=new Uint8Array([225,2,0,229,2,0,234,2]),this._magicFilterExcel2016Fix1=new Uint8Array([39,70,33,0,0,0,0,255,0,0,0,15,0,0,0,95,0,70,0,105,0,108,0,116,0,101,0,114,0,68,0,97,0,116,0,97,0,98,0,97,0,115,0,101,0,15,0,0,0,59,255,0]),this._magicFilterExcel2016Fix2=new Uint8Array([0,0,0,0,255,255,255,255])}_sanitizeSheetName(t){if(!t||typeof t!="string")return`Sheet${this._sheetCount+1}`;let e=t.replace(P,"_");return e.length>31&&(e=e.substring(0,31)),e.trim().length===0&&(e=`Sheet${this._sheetCount+1}`),e}_registerFormat(t){if(this._fmtMap.has(t))return this._fmtMap.get(t).xf;let e=this._nextNid++,x=this._nextXf++;return this._fmtMap.set(t,{nid:e,xf:x}),x}_buildStylesBin(){if(this._fmtMap.size===0)return this._stylesBin;let t=this._stylesBin,e=-1;for(let u=3;u<t.length-3;u++)if(t[u]===232&&t[u+1]===4&&t[u+2]===0){e=u;break}let x=-1;for(let u=e+3;u<t.length-2;u++)if(t[u]===233&&t[u+1]===4){x=u;break}let s=-1;for(let u=x;u<t.length-3;u++)if(t[u]===234&&t[u+1]===4&&t[u+2]===0){s=u;break}let r=-1;for(let u=e+3;u<t.length-2;u++)if(t[u]===227&&t[u+1]===4){r=u;break}let o=2+this._fmtMap.size,i=4+this._fmtMap.size,n=[];function f(u){let w=[];for(;u>=128;)w.push(u&127|128),u>>>=7;return w.push(u&127),w}function c(u,w){return new Uint8Array([...f(u),...f(w.length),...w])}function h(u,w){let I=w.length,B=6+I*2,_=new Uint8Array(2+B);_[0]=44,_[1]=B;let U=new DataView(_.buffer);U.setUint16(2,u,!0),U.setUint32(4,I,!0);for(let E=0;E<I;E++){let L=w.charCodeAt(E);_[8+E*2]=L&255,_[8+E*2+1]=L>>8&255}return _}function l(u,w,I,B=0){let _=new Uint8Array(18),U=new DataView(_.buffer);return _[0]=47,_[1]=16,U.setUint16(2,u,!0),U.setUint16(4,w,!0),_[6]=B,_[14]=16,_[15]=16,U.setUint16(16,I,!0),_}n.push(t.subarray(0,3));let a=new Uint8Array(4);new DataView(a.buffer).setUint16(0,o,!0),n.push(c(615,a)),n.push(h(164,"yyyy\\-mm\\-dd\\ hh:mm:ss")),n.push(h(166,"yyyy\\-mm\\-dd"));for(let[u,w]of this._fmtMap)n.push(h(w.nid,u));n.push(c(616,new Uint8Array(0))),n.push(t.subarray(r,x));let m=new Uint8Array(4);new DataView(m.buffer).setUint16(0,i,!0),n.push(c(617,m)),n.push(l(0,0,0)),n.push(l(0,164,1)),n.push(l(0,166,1)),n.push(l(1,0,0,1));let g=[...this._fmtMap.entries()].sort((u,w)=>u[1].xf-w[1].xf);for(let[,u]of g)n.push(l(0,u.nid,1));n.push(c(618,new Uint8Array(0))),n.push(t.subarray(s+3));let p=0;for(let u of n)p+=u.length;let v=new Uint8Array(p),R=0;for(let u of n)v.set(u,R),R+=u.length;return v}addSheet(t,e=!1){let x=this._sanitizeSheetName(t);this._sheetCount++,this._sheetList.push({name:x,pathInArchive:`xl/worksheets/sheet${this._sheetCount}.bin`,hidden:e,nameInArchive:`sheet${this._sheetCount}.bin`,sheetId:this._sheetCount,filterHeaderRange:null})}startSheet(t,e,x,s={}){if(this._isStreaming)throw new Error("Already streaming");let{hidden:r=!1,doAutofilter:o=!0,headerStyle:i="bold"}=s,n=3;if(i==="fill"?n=4:i==="bold+fill"&&(n=5),this.addSheet(t,r),this._isStreaming=!0,this._currentSheetBuffer=new y,this._currentSheetRowNum=0,this._currentSheetStartCol=0,this._currentSheetEndCol=e,this._currentSheetDoAutofilter=o&&x!==void 0,this._colWidths=new Array(e).fill(-1),x)for(let f=0;f<e;f++){let h=1.3*(x[f]?x[f].length:0)+3;h>80&&(h=80),this._colWidths[f]<h&&(this._colWidths[f]=h)}if(this._writeSheetHeader(this._currentSheetBuffer,this._currentSheetStartCol,this._currentSheetEndCol,this._currentSheetDoAutofilter),x){this.createRowHeader(this._currentSheetBuffer,this._currentSheetRowNum,this._currentSheetStartCol,this._currentSheetEndCol);for(let f=0;f<x.length;f++)this.writeString(this._currentSheetBuffer,x[f],f,n);this._currentSheetRowNum++}}writeRow(t){if(!this._isStreaming)throw new Error("Not streaming");let e=this._currentSheetBuffer;this.createRowHeader(e,this._currentSheetRowNum,this._currentSheetStartCol,this._currentSheetEndCol);for(let x=0;x<t.length;x++)this._writeCell(e,t[x],x);this._currentSheetRowNum++}endSheet(){if(!this._isStreaming)throw new Error("Not streaming");let t=this._currentSheetBuffer;if(t.write(this._sheet1Bytes.subarray(218,290)),this._currentSheetDoAutofilter){this._autofilterIsOn=!0,t.write(this._autoFilterStartBytes);let e=new Uint8Array(8),x=new DataView(e.buffer);x.setInt32(0,0,!0),x.setInt32(4,this._currentSheetRowNum-1,!0),t.write(e);let s=new Uint8Array(8),r=new DataView(s.buffer);r.setInt32(0,this._currentSheetStartCol,!0),r.setInt32(4,this._currentSheetEndCol-1,!0),t.write(s),t.write(this._autoFilterEndBytes),this._sheetList[this._sheetCount-1].filterData={startRow:0,endRow:this._currentSheetRowNum-1,startColumn:this._currentSheetStartCol,endColumn:this._currentSheetEndCol-1}}t.write(this._sheet1Bytes.subarray(290)),this._zip.addFile(this._sheetList[this._sheetCount-1].pathInArchive,t.toUint8Array()),this._isStreaming=!1,this._currentSheetBuffer=null}writeSheet(t,e=null,x={}){let s=x.doAutofilter!==!1,r=x.headerStyle||"bold",o=3;r==="fill"?o=4:r==="bold+fill"&&(o=5);let i=new y,n=t.length>0?t[0].length:e?e.length:0;if(this._colWidths=new Array(n).fill(-1),e)for(let h=0;h<n;h++){let a=1.3*(e[h]?e[h].length:0)+3;a>80&&(a=80),this._colWidths[h]<a&&(this._colWidths[h]=a)}for(let h=0;h<Math.min(t.length,100);h++)for(let l=0;l<t[h].length;l++){let a=t[h][l];if(a==null)continue;let m=A(a)?a.value:a,p=1.3*(m instanceof Date?10:m.toString().length)+3;p>80&&(p=80),this._colWidths[l]<p&&(this._colWidths[l]=p)}let f=s&&!!e;this._writeSheetHeader(i,0,n,f);let c=0;if(e){this.createRowHeader(i,c,0,n);for(let h=0;h<e.length;h++)this.writeString(i,e[h],h,o);c++}for(let h=0;h<t.length;h++){this.createRowHeader(i,c,0,n);for(let l=0;l<t[h].length;l++)this._writeCell(i,t[h][l],l);c++}if(i.write(this._sheet1Bytes.subarray(218,290)),f){this._autofilterIsOn=!0,i.write(this._autoFilterStartBytes);let h=new Uint8Array(8),l=new DataView(h.buffer);l.setInt32(0,0,!0),l.setInt32(4,c-1,!0),i.write(h);let a=new Uint8Array(8),m=new DataView(a.buffer);m.setInt32(0,0,!0),m.setInt32(4,n-1,!0),i.write(a),i.write(this._autoFilterEndBytes),this._sheetList[this._sheetCount-1].filterData={startRow:0,endRow:c,startColumn:0,endColumn:n-1}}i.write(this._sheet1Bytes.subarray(290)),this._zip.addFile(this._sheetList[this._sheetCount-1].pathInArchive,i.toUint8Array())}_writeSheetHeader(t,e,x,s){let r=new Uint8Array(this._sheet1Bytes),o=new DataView(r.buffer);o.setInt32(40,e,!0),o.setInt32(44,x,!0),this._sheetCount!==1&&(r[54]=156),t.write(r.subarray(0,84)),s&&t.write(this._stickHeaderA1bytes),t.write(r.subarray(84,159)),t.writeByte(134),t.writeByte(3);for(let i=e;i<x;i++){t.writeByte(0),t.writeByte(60),t.writeByte(18),t.writeInt32LE(i),t.writeInt32LE(i);let n=this._colWidths[i]>0?this._colWidths[i]:10;t.writeInt32LE(Math.round(n*256)),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(2)}t.writeByte(0),t.writeByte(135),t.writeByte(3),t.writeByte(0),t.write(r.subarray(159,175)),t.write(new Uint8Array([38,0]))}_writeCell(t,e,x){if(e==null)return;let s=T(e),r=s!==null?D(e):e,o=s!==null?this._registerFormat(s):0;if(typeof r=="number")Number.isInteger(r)&&r>=this._rRkIntegerLowerLimit&&r<=this._rRkIntegerUpperLimit?this.writeRkNumberInteger(t,r,x,o):this.writeDouble(t,r,x,o);else if(typeof r=="bigint")this.writeString(t,r.toString(),x);else if(typeof r=="boolean")this.writeBool(t,r,x);else if(r instanceof Date){let i=(r.getTime()-this._oaEpoch)/864e5;this.writeDouble(t,i,x,s!==null?o:1)}else this.writeString(t,r.toString(),x,0,s!==null?o:void 0)}createRowHeader(t,e,x,s){t.ensureCapacity(27),t.writeUnsafeByte(0),t.writeUnsafeByte(25),t.writeUnsafeInt32LE(e),t.writeUnsafeInt32LE(0),t.writeUnsafeByte(44),t.writeUnsafeByte(1),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(1),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeInt32LE(x),t.writeUnsafeInt32LE(s)}writeRkNumberInteger(t,e,x,s=0){t.ensureCapacity(14),t.writeUnsafeByte(2),t.writeUnsafeByte(12),t.writeUnsafeInt32LE(x),t.writeUnsafeByte(s),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeInt32LE(e<<2|2)}writeDouble(t,e,x,s=0){t.ensureCapacity(18),t.writeUnsafeByte(5),t.writeUnsafeByte(16),t.writeUnsafeInt32LE(x),t.writeUnsafeByte(s),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeDoubleLE(e)}writeBool(t,e,x){t.ensureCapacity(13),t.writeUnsafeByte(4),t.writeUnsafeByte(9),t.writeUnsafeInt32LE(x),t.writeUnsafeInt32LE(0),t.writeUnsafeByte(e?1:0)}writeDateTime(t,e,x){this.writeDouble(t,(e.getTime()-this._oaEpoch)/864e5,x,1)}writeString(t,e,x,s=0,r=void 0){let o;this._sstDic.has(e)?o=this._sstDic.get(e):(o=this._sstCntUnique++,this._sstDic.set(e,o)),this._sstCntAll++;let i=r!==void 0?r:s;t.ensureCapacity(17),t.writeUnsafeByte(7),t.writeUnsafeByte(12),t.writeUnsafeInt32LE(x),t.writeUnsafeByte(i),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeInt32LE(o)}_saveSst(){let t=new y;t.writeByte(159),t.writeByte(1),t.writeByte(8),t.writeInt32LE(this._sstCntUnique),t.writeInt32LE(this._sstCntAll);for(let[e]of this._sstDic){let x=e.length;t.writeByte(19);let s=5+2*x;if(s>=128){t.writeByte(128+s%128);let r=s>>7;r>=256?t.writeByte(128+r%128):t.writeByte(r),t.writeByte(s>>14),s>>14>0&&t.writeByte(0)}else t.writeByte(s&255),t.writeByte(s>>8&255);t.writeInt32LE(x),t.writeUtf16LE(e)}t.writeByte(160),t.writeByte(1),t.writeByte(0),this._zip.addFile("xl/sharedStrings.bin",t.toUint8Array())}_writeFilterDefinedName(t,e,x){let s=e.filterData,r=new Uint8Array(this._magicFilterExcel2016Fix1);r[7]=e.sheetId-1,r[r.length-2]=x,t.push(r);let o=new Uint8Array(8),i=new DataView(o.buffer);i.setInt32(0,s.startRow,!0),i.setInt32(4,s.endRow,!0),t.push(o);let n=new Uint8Array(4),f=new DataView(n.buffer);f.setInt16(0,s.startColumn,!0),f.setInt16(2,s.endColumn,!0),t.push(n),t.push(this._magicFilterExcel2016Fix2)}finalize(){this._saveSst(),this._zip.addFile("xl/styles.bin",this._buildStylesBin());let t=[this._workbookBinStart];for(let i of this._sheetList){let n=`rId${i.sheetId}`,f=i.name,c=16+f.length*2+n.length*2,h=new Uint8Array(3+c),l=new DataView(h.buffer);h[0]=156,h[1]=1,h[2]=c;let a=3;l.setInt32(a,i.hidden?1:0,!0),a+=4,l.setInt32(a,i.sheetId,!0),a+=4,l.setInt32(a,n.length,!0),a+=4;for(let m=0;m<n.length;m++){let g=n.charCodeAt(m);h[a++]=g&255,h[a++]=g>>8&255}l.setInt32(a,f.length,!0),a+=4;for(let m=0;m<f.length;m++){let g=f.charCodeAt(m);h[a++]=g&255,h[a++]=g>>8&255}t.push(h)}if(t.push(this._workbookBinMiddle),this._autofilterIsOn){let i=this._sheetList.filter(n=>n.filterData);if(i.length>0){t.push(this._magicFilterExcel2016Fix0);let n=i.length,f=n<=20?16+(n-1)*12:128+(n-21)*12;t.push(n<=10?new Uint8Array([f,n,0,0,0]):new Uint8Array([f,Math.floor((n-1)/10),n,0,0,0]));for(let c=0;c<i.length;c++){let h=i[c].sheetId-1,l=new Uint8Array(12);l[4]=h,l[8]=h,t.push(l)}t.push(new Uint8Array([226,2,0]));for(let c=0;c<i.length;c++)this._writeFilterDefinedName(t,i[c],c)}}t.push(this._workbookBinEnd);let e=0;for(let i of t)e+=i.length;let x=new Uint8Array(e),s=0;for(let i of t)x.set(i,s),s+=i.length;this._zip.addFile("xl/workbook.bin",x);for(let i of this._sheetList)this._zip.addFile(`xl/worksheets/binaryIndex${i.sheetId}.bin`,this._binaryIndexBin);let r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
18
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
19
|
+
<Default Extension="bin" ContentType="application/vnd.ms-excel.sheet.binary.macroEnabled.main"/>
|
|
20
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
|
21
|
+
<Default Extension="xml" ContentType="application/xml"/>`;for(let i of this._sheetList)r+=`<Override PartName="/${i.pathInArchive}" ContentType="application/vnd.ms-excel.worksheet"/>
|
|
22
|
+
<Override PartName="/xl/worksheets/binaryIndex${i.sheetId}.bin" ContentType="application/vnd.ms-excel.binIndexWs"/>
|
|
23
|
+
`;r+=`<Override PartName="/xl/styles.bin" ContentType="application/vnd.ms-excel.styles"/>
|
|
24
|
+
<Override PartName="/xl/sharedStrings.bin" ContentType="application/vnd.ms-excel.sharedStrings"/>
|
|
25
|
+
</Types>`,this._zip.addFile("[Content_Types].xml",r);let o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
26
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
27
|
+
`;for(let i of this._sheetList)o+=`<Relationship Id="rId${i.sheetId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/${i.nameInArchive}"/>
|
|
28
|
+
`;o+=`<Relationship Id="rId${this._sheetList.length+2}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.bin"/>
|
|
29
|
+
<Relationship Id="rId${this._sheetList.length+3}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.bin"/>
|
|
30
|
+
</Relationships>`,this._zip.addFile("xl/_rels/workbook.bin.rels",o),this._zip.addFile("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
31
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
32
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.bin"/>
|
|
33
|
+
</Relationships>`);for(let i of this._sheetList)this._zip.addFile(`xl/worksheets/_rels/${i.nameInArchive}.rels`,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
34
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
35
|
+
<Relationship Id="rId1" Type="http://schemas.microsoft.com/office/2006/relationships/xlBinaryIndex" Target="binaryIndex${i.sheetId}.bin"/>
|
|
36
|
+
</Relationships>`);return this._zip.toBlob()}};function k(d,t){let e=URL.createObjectURL(d),x=document.createElement("a");x.href=e,x.download=t,document.body.appendChild(x),x.click(),document.body.removeChild(x),setTimeout(()=>URL.revokeObjectURL(e),5e3)}function X(d,t,e,x="Sheet1"){let s=new S;s.addSheet(x),s.writeSheet(t,e,{doAutofilter:!0}),k(s.finalize(),d)}function Y(d,t){let e=new S;for(let x of t)e.addSheet(x.name),e.writeSheet(x.rows,x.headers,{doAutofilter:!0});k(e.finalize(),d)}function q(d,t,e,x="Sheet1"){let s=new C;s.addSheet(x),s.writeSheet(t,e,{doAutofilter:!0}),k(s.finalize(),d)}function j(d,t){let e=new C;for(let x of t)e.addSheet(x.name),e.writeSheet(x.rows,x.headers,{doAutofilter:!0});k(e.finalize(),d)}return W(G);})();
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { Buffer as Buffer$1 } from 'buffer';
|
|
2
|
+
|
|
3
|
+
declare class BigBuffer {
|
|
4
|
+
private chunkSize;
|
|
5
|
+
private chunks;
|
|
6
|
+
private currentBuffer;
|
|
7
|
+
private cursor;
|
|
8
|
+
constructor(chunkSize?: number);
|
|
9
|
+
ensureCapacity(size: number): void;
|
|
10
|
+
private _ensureCapacity;
|
|
11
|
+
private _flush;
|
|
12
|
+
write(buffer: Buffer$1): void;
|
|
13
|
+
writeByte(val: number): void;
|
|
14
|
+
writeUnsafeByte(val: number): void;
|
|
15
|
+
writeInt32LE(val: number): void;
|
|
16
|
+
writeUnsafeInt32LE(val: number): void;
|
|
17
|
+
writeDoubleLE(val: number): void;
|
|
18
|
+
writeUnsafeDoubleLE(val: number): void;
|
|
19
|
+
writeString(str: string): void;
|
|
20
|
+
writeUtf16LE(str: string): void;
|
|
21
|
+
getChunks(): Buffer$1[];
|
|
22
|
+
reset(): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type PrimitiveCellValue = string | number | boolean | Date | bigint | null | undefined;
|
|
26
|
+
interface FormattedCell {
|
|
27
|
+
value: PrimitiveCellValue;
|
|
28
|
+
format: string;
|
|
29
|
+
}
|
|
30
|
+
type CellValue = PrimitiveCellValue | FormattedCell;
|
|
31
|
+
/** Built-in Excel number-format strings for {@link FormattedCell}. */
|
|
32
|
+
declare const F: {
|
|
33
|
+
THOUSANDS_SEP: string;
|
|
34
|
+
CURRENCY_PLN: string;
|
|
35
|
+
CURRENCY_EUR: string;
|
|
36
|
+
PERCENTAGE: string;
|
|
37
|
+
SCIENTIFIC: string;
|
|
38
|
+
TWO_DECIMALS: string;
|
|
39
|
+
TEXT: string;
|
|
40
|
+
LEADING_ZEROS: string;
|
|
41
|
+
DATE_SHORT: string;
|
|
42
|
+
DATE_LONG: string;
|
|
43
|
+
DATE_DAY_MONTH_YEAR: string;
|
|
44
|
+
DATE_ISO: string;
|
|
45
|
+
DATE_MONTH_YEAR: string;
|
|
46
|
+
DATE_WEEKDAY: string;
|
|
47
|
+
DATE_DAY_MONTH: string;
|
|
48
|
+
DATE_YEAR_ONLY: string;
|
|
49
|
+
DATETIME_SHORT: string;
|
|
50
|
+
DATETIME_LONG: string;
|
|
51
|
+
TIME_HH_MM: string;
|
|
52
|
+
TIME_HH_MM_SS: string;
|
|
53
|
+
TIME_12H: string;
|
|
54
|
+
DATETIME_24H: string;
|
|
55
|
+
DATETIME_ISO: string;
|
|
56
|
+
TIME_MS: string;
|
|
57
|
+
};
|
|
58
|
+
declare function isFormattedCell(val: unknown): val is FormattedCell;
|
|
59
|
+
declare function unwrapCell(val: CellValue): PrimitiveCellValue;
|
|
60
|
+
declare function getFormat(val: CellValue): string | null;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Shared reader surface for XLSB and XLSX.
|
|
64
|
+
* Always use `await reader.read()` — both formats are async in v2+.
|
|
65
|
+
*/
|
|
66
|
+
declare abstract class ExcelReaderAbstract {
|
|
67
|
+
fieldCount: number;
|
|
68
|
+
rowCount: number;
|
|
69
|
+
actualSheetName: string;
|
|
70
|
+
resultsCount: number;
|
|
71
|
+
protected _oaEpoch: number;
|
|
72
|
+
constructor();
|
|
73
|
+
/** Open a workbook file. */
|
|
74
|
+
abstract open(path: string, readSharedStrings?: boolean, updateMode?: boolean): Promise<void>;
|
|
75
|
+
close(): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Advance to the next row.
|
|
78
|
+
* @returns true if a row is available; false at EOF
|
|
79
|
+
*/
|
|
80
|
+
abstract read(): Promise<boolean>;
|
|
81
|
+
/** Worksheet names in workbook order. */
|
|
82
|
+
abstract getSheetNames(): string[];
|
|
83
|
+
/** Cell value for column index `i` of the current row (0-based). */
|
|
84
|
+
abstract getValue(i: number): CellValue;
|
|
85
|
+
dispose(): void;
|
|
86
|
+
getDateTimeFromOaDate(oaDate: number): Date;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare class BiffReaderWriter {
|
|
90
|
+
private buffer;
|
|
91
|
+
private pos;
|
|
92
|
+
private length;
|
|
93
|
+
_isSheet: boolean;
|
|
94
|
+
_workbookId: number;
|
|
95
|
+
_recId: string | null;
|
|
96
|
+
_workbookName: string | null;
|
|
97
|
+
private _inCellXf;
|
|
98
|
+
private _inNumberFormat;
|
|
99
|
+
private _numberFormatIndex;
|
|
100
|
+
private _format;
|
|
101
|
+
private _formatString;
|
|
102
|
+
_sharedStringValue: string | null;
|
|
103
|
+
_sharedStringUniqueCount: number;
|
|
104
|
+
_cellType: number;
|
|
105
|
+
_intValue: number;
|
|
106
|
+
_doubleVal: number;
|
|
107
|
+
_boolValue: boolean;
|
|
108
|
+
_stringValue: string | null;
|
|
109
|
+
_columnNum: number;
|
|
110
|
+
_xfIndex: number;
|
|
111
|
+
_readCell: boolean;
|
|
112
|
+
_rowIndex: number;
|
|
113
|
+
private _recordStart;
|
|
114
|
+
_xfIndexToNumFmtId: number[];
|
|
115
|
+
_customNumFmts: Set<number>;
|
|
116
|
+
constructor(buffer: Buffer);
|
|
117
|
+
private _tryReadVariableValue;
|
|
118
|
+
private _getDWord;
|
|
119
|
+
private _getInt32;
|
|
120
|
+
private _getWord;
|
|
121
|
+
private _getByte;
|
|
122
|
+
private _getDouble;
|
|
123
|
+
private _getString;
|
|
124
|
+
private _getNullableString;
|
|
125
|
+
readWorkbook(): boolean;
|
|
126
|
+
readSharedStrings(): boolean;
|
|
127
|
+
readStyles(): boolean;
|
|
128
|
+
private _getRkNumber;
|
|
129
|
+
readWorksheet(): boolean;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
declare class XlsbReader extends ExcelReaderAbstract {
|
|
133
|
+
private zip;
|
|
134
|
+
private sharedStrings;
|
|
135
|
+
private sheetNames;
|
|
136
|
+
private sheets;
|
|
137
|
+
private _currentSheetIndex;
|
|
138
|
+
private _reader;
|
|
139
|
+
private _currentRow;
|
|
140
|
+
private _pendingRowIndex;
|
|
141
|
+
private _eof;
|
|
142
|
+
xfIdToNumFmtId: number[];
|
|
143
|
+
customDateFormats: Set<number> | null;
|
|
144
|
+
constructor();
|
|
145
|
+
open(path: string, readSharedStrings?: boolean): Promise<void>;
|
|
146
|
+
private _readSharedStrings;
|
|
147
|
+
private _readStyles;
|
|
148
|
+
getSheetNames(): string[];
|
|
149
|
+
read(): Promise<boolean>;
|
|
150
|
+
private _initSheet;
|
|
151
|
+
getValue(i: number): CellValue;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare class XlsxReader extends ExcelReaderAbstract {
|
|
155
|
+
private zipfile;
|
|
156
|
+
private sharedStrings;
|
|
157
|
+
private sheetNames;
|
|
158
|
+
private sheets;
|
|
159
|
+
private entries;
|
|
160
|
+
private _currentSheetIndex;
|
|
161
|
+
private _sheetXml;
|
|
162
|
+
private _xmlPos;
|
|
163
|
+
private _currentRow;
|
|
164
|
+
xfIdToNumFmtId: number[];
|
|
165
|
+
customDateFormats: Set<number>;
|
|
166
|
+
constructor();
|
|
167
|
+
open(path: string, readSharedStrings?: boolean): Promise<void>;
|
|
168
|
+
close(): Promise<void>;
|
|
169
|
+
private _readZipEntryContent;
|
|
170
|
+
private _unescapeXml;
|
|
171
|
+
private _parseSharedStrings;
|
|
172
|
+
private _parseStyles;
|
|
173
|
+
getSheetNames(): string[];
|
|
174
|
+
read(): Promise<boolean>;
|
|
175
|
+
private _initSheet;
|
|
176
|
+
private _readNextRow;
|
|
177
|
+
private _parseRowByIndex;
|
|
178
|
+
private _columnLetterToIndex;
|
|
179
|
+
getValue(i: number): CellValue;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Create an XLSB or XLSX reader based on the file extension.
|
|
184
|
+
*/
|
|
185
|
+
declare class ReaderFactory {
|
|
186
|
+
/**
|
|
187
|
+
* @param filePath Path ending in `.xlsb` or `.xlsx`
|
|
188
|
+
* @throws if the extension is unsupported
|
|
189
|
+
*/
|
|
190
|
+
static create(filePath: string): ExcelReaderAbstract;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* High-performance XLSB (Excel Binary Workbook) writer.
|
|
195
|
+
* Prefer this format for large datasets — typically faster and smaller than XLSX.
|
|
196
|
+
*/
|
|
197
|
+
declare class XlsbWriter {
|
|
198
|
+
private output;
|
|
199
|
+
private archive;
|
|
200
|
+
private sheetCount;
|
|
201
|
+
private sheetList;
|
|
202
|
+
private sstDic;
|
|
203
|
+
private sstCntUnique;
|
|
204
|
+
private sstCntAll;
|
|
205
|
+
private _autofilterIsOn;
|
|
206
|
+
private _oaEpoch;
|
|
207
|
+
private _nextFmtId;
|
|
208
|
+
private _nextXfIdx;
|
|
209
|
+
private _stFmtRecords;
|
|
210
|
+
/** Worksheet binary template (BrtBeginSheet … dimension / views / cols placeholders). */
|
|
211
|
+
private _sheet1Bytes;
|
|
212
|
+
private _workbookBinStart;
|
|
213
|
+
private _workbookBinMiddle;
|
|
214
|
+
private _workbookBinEnd;
|
|
215
|
+
/** Default styles.bin template; extended when custom number formats are registered. */
|
|
216
|
+
private _stylesBin;
|
|
217
|
+
private _binaryIndexBin;
|
|
218
|
+
private _rRkIntegerLowerLimit;
|
|
219
|
+
private _rRkIntegerUpperLimit;
|
|
220
|
+
private _autoFilterStartBytes;
|
|
221
|
+
private _autoFilterEndBytes;
|
|
222
|
+
private _stickHeaderA1bytes;
|
|
223
|
+
/** Excel 2016+ autofilter compatibility stubs. */
|
|
224
|
+
private _magicFilterExcel2016Fix0;
|
|
225
|
+
private _magicFilterExcel2016Fix1;
|
|
226
|
+
private _magicFilterExcel2016Fix2;
|
|
227
|
+
private readonly stream;
|
|
228
|
+
/**
|
|
229
|
+
* @param filePath Destination `.xlsb` path on disk.
|
|
230
|
+
*/
|
|
231
|
+
constructor(filePath: string);
|
|
232
|
+
/** @deprecated Internal; kept for unit-test access. Prefer sanitizeSheetName(). */
|
|
233
|
+
private _sanitizeSheetName;
|
|
234
|
+
private _registerFormat;
|
|
235
|
+
private static _buildBrtRecord;
|
|
236
|
+
private static _encodeVlq;
|
|
237
|
+
private static _buildStFmtRecord;
|
|
238
|
+
private static _buildXfRecord;
|
|
239
|
+
private _buildStylesBin;
|
|
240
|
+
/**
|
|
241
|
+
* Register a worksheet (metadata only). Prefer `writeSheet` / `startSheet` for data.
|
|
242
|
+
* @param sheetName Display name (sanitized to Excel rules)
|
|
243
|
+
* @param hidden Whether the sheet is hidden in Excel
|
|
244
|
+
*/
|
|
245
|
+
addSheet(sheetName: string, hidden?: boolean): void;
|
|
246
|
+
/**
|
|
247
|
+
* Start a new sheet in streaming mode. Call writeRow() for each row, then endSheet() when done.
|
|
248
|
+
* @param sheetName Name of the sheet
|
|
249
|
+
* @param columnCount Number of columns in the sheet
|
|
250
|
+
* @param headers Optional header row
|
|
251
|
+
* @param options Optional settings (hidden, doAutofilter)
|
|
252
|
+
*/
|
|
253
|
+
startSheet(sheetName: string, columnCount: number, headers?: string[], options?: {
|
|
254
|
+
hidden?: boolean;
|
|
255
|
+
doAutofilter?: boolean;
|
|
256
|
+
sampleRows?: unknown[][];
|
|
257
|
+
}): void;
|
|
258
|
+
/**
|
|
259
|
+
* Write a single row in streaming mode. Must be called between startSheet() and endSheet().
|
|
260
|
+
* @param row Array of cell values
|
|
261
|
+
*/
|
|
262
|
+
writeRow(row: CellValue[]): void;
|
|
263
|
+
/**
|
|
264
|
+
* Finalize the current streaming sheet and add it to the archive.
|
|
265
|
+
* Must be called after startSheet() and writeRow() calls.
|
|
266
|
+
*/
|
|
267
|
+
endSheet(): void;
|
|
268
|
+
/**
|
|
269
|
+
* Write an entire sheet in one call (batch mode).
|
|
270
|
+
* @param rows Data rows (`CellValue` cells; null/undefined = blank)
|
|
271
|
+
* @param headers Optional header row (bold + frozen + autofilter when enabled)
|
|
272
|
+
* @param doAutofilter Enable autofilter when headers are present (default true)
|
|
273
|
+
*/
|
|
274
|
+
writeSheet(rows: CellValue[][], headers?: string[] | null, doAutofilter?: boolean): void;
|
|
275
|
+
createRowHeader(bigBuf: BigBuffer, rowNumber: number, startCol: number, endCol: number): void;
|
|
276
|
+
writeRkNumberInteger(bigBuf: BigBuffer, val: number, colNum: number, styleNum?: number): void;
|
|
277
|
+
writeDouble(bigBuf: BigBuffer, val: number, colNum: number, styleNum?: number): void;
|
|
278
|
+
writeBool(bigBuf: BigBuffer, val: boolean, colNum: number): void;
|
|
279
|
+
writeDateTime(bigBuf: BigBuffer, date: Date, colNum: number): void;
|
|
280
|
+
private _getDateWidth;
|
|
281
|
+
writeString(bigBuf: BigBuffer, val: string, colNum: number, bolded?: boolean, styleOverride?: number): void;
|
|
282
|
+
private saveSst;
|
|
283
|
+
private _writeFilterDefinedName;
|
|
284
|
+
/**
|
|
285
|
+
* Finalize the ZIP package and close the output stream.
|
|
286
|
+
* Must be awaited before the file is fully written.
|
|
287
|
+
*/
|
|
288
|
+
finalize(): Promise<void>;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* XLSX (Office Open XML) writer with streaming ZIP output.
|
|
293
|
+
*/
|
|
294
|
+
declare class XlsxWriter {
|
|
295
|
+
private output;
|
|
296
|
+
private archive;
|
|
297
|
+
private sheetCount;
|
|
298
|
+
private sheetList;
|
|
299
|
+
private sstArray;
|
|
300
|
+
private sstMap;
|
|
301
|
+
private sstCntAll;
|
|
302
|
+
private _autofilterIsOn;
|
|
303
|
+
private _oaEpoch;
|
|
304
|
+
private _formatRegistry;
|
|
305
|
+
private _formatXfMap;
|
|
306
|
+
private _nextNumfmtId;
|
|
307
|
+
private _nextXfIndex;
|
|
308
|
+
private readonly stream;
|
|
309
|
+
private currentColLetters;
|
|
310
|
+
/**
|
|
311
|
+
* @param filePath Destination `.xlsx` path on disk.
|
|
312
|
+
*/
|
|
313
|
+
constructor(filePath: string);
|
|
314
|
+
private _getColumnLetter;
|
|
315
|
+
/** @deprecated Internal; kept for unit-test access. Prefer sanitizeSheetName(). */
|
|
316
|
+
private _sanitizeSheetName;
|
|
317
|
+
private _escapeSheetNameForXml;
|
|
318
|
+
private _formatSheetNameForFormula;
|
|
319
|
+
/**
|
|
320
|
+
* Register a worksheet (metadata only). Prefer `writeSheet` / `startSheet` for data.
|
|
321
|
+
*/
|
|
322
|
+
addSheet(sheetName: string, hidden?: boolean): void;
|
|
323
|
+
private _needsEscape;
|
|
324
|
+
private _escape;
|
|
325
|
+
/**
|
|
326
|
+
* Start streaming a sheet. Call `writeRow` for each row, then `endSheet`.
|
|
327
|
+
*/
|
|
328
|
+
startSheet(sheetName: string, columnCount: number, headers?: string[], options?: {
|
|
329
|
+
hidden?: boolean;
|
|
330
|
+
doAutofilter?: boolean;
|
|
331
|
+
sampleRows?: unknown[][];
|
|
332
|
+
}): void;
|
|
333
|
+
/** Write one data row in streaming mode. */
|
|
334
|
+
writeRow(row: CellValue[]): void;
|
|
335
|
+
/** Finish the current streaming sheet and append it to the archive. */
|
|
336
|
+
endSheet(): void;
|
|
337
|
+
/**
|
|
338
|
+
* Write an entire sheet in one call (batch mode).
|
|
339
|
+
*/
|
|
340
|
+
writeSheet(rows: CellValue[][], headers?: string[] | null, doAutofilter?: boolean): void;
|
|
341
|
+
private _writeStringCell;
|
|
342
|
+
private _registerFormat;
|
|
343
|
+
private _toOADate;
|
|
344
|
+
private _getDateWidth;
|
|
345
|
+
/** Finalize the ZIP package and close the output stream. */
|
|
346
|
+
finalize(): Promise<void>;
|
|
347
|
+
private _writeSharedStrings;
|
|
348
|
+
private _writeStyles;
|
|
349
|
+
private _writeWorkbook;
|
|
350
|
+
private _writeContentTypes;
|
|
351
|
+
private _writeRels;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** Excel sheet name characters that must be replaced. */
|
|
355
|
+
declare const INVALID_SHEET_NAME_CHARS: RegExp;
|
|
356
|
+
/**
|
|
357
|
+
* Sanitize an Excel sheet name (invalid chars, max 31 chars, non-empty).
|
|
358
|
+
* @param sheetCount Current sheet count before adding this sheet (used for defaults).
|
|
359
|
+
*/
|
|
360
|
+
declare function sanitizeSheetName(name: string, sheetCount: number): string;
|
|
361
|
+
/** Create column-width scratch array filled with -1 (unknown). */
|
|
362
|
+
declare function initColWidths(columnCount: number): number[];
|
|
363
|
+
/** Apply autofit widths from header labels. */
|
|
364
|
+
declare function applyHeaderWidths(colWidths: number[], headers: string[], columnCount: number): void;
|
|
365
|
+
/**
|
|
366
|
+
* Sample up to `sampleLimit` rows and expand column widths (autofit).
|
|
367
|
+
* Skips null/undefined cells; Dates use a fixed display length of 20.
|
|
368
|
+
*/
|
|
369
|
+
declare function updateColWidthsFromRows(colWidths: number[], rows: unknown[][], sampleLimit?: number): void;
|
|
370
|
+
/**
|
|
371
|
+
* Resolve a stored autofit width to the value written into the file.
|
|
372
|
+
* XLSB uses floored integers; XLSX keeps the float.
|
|
373
|
+
*/
|
|
374
|
+
declare function defaultColWidth(width: number, floor?: boolean): number;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Shared streaming-sheet session state for Node writers.
|
|
378
|
+
* Holds buffer, row cursor, column range, autofilter flag, and autofit widths.
|
|
379
|
+
*/
|
|
380
|
+
declare class StreamingSheetState {
|
|
381
|
+
isStreaming: boolean;
|
|
382
|
+
rowNum: number;
|
|
383
|
+
startCol: number;
|
|
384
|
+
endCol: number;
|
|
385
|
+
doAutofilter: boolean;
|
|
386
|
+
colWidths: number[];
|
|
387
|
+
buffer: BigBuffer | null;
|
|
388
|
+
/**
|
|
389
|
+
* Begin a streaming sheet session.
|
|
390
|
+
* @throws if already streaming
|
|
391
|
+
*/
|
|
392
|
+
begin(columnCount: number, doAutofilter: boolean, buffer: BigBuffer): void;
|
|
393
|
+
/** Assert streaming mode and return the active buffer. */
|
|
394
|
+
assertStreaming(): BigBuffer;
|
|
395
|
+
/** Reset after endSheet(). */
|
|
396
|
+
end(): void;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export { BiffReaderWriter, BigBuffer, type CellValue, ExcelReaderAbstract, F, type FormattedCell, INVALID_SHEET_NAME_CHARS, type PrimitiveCellValue, ReaderFactory, StreamingSheetState, XlsbReader, XlsbWriter, XlsxReader, XlsxWriter, applyHeaderWidths, defaultColWidth, getFormat, initColWidths, isFormattedCell, sanitizeSheetName, unwrapCell, updateColWidthsFromRows };
|