@office-kit/xlsx 0.11.0 → 0.11.1
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/README.md +7 -0
- package/dist/cell/cell.d.ts +1 -1
- package/dist/cell/index.d.ts +4 -4
- package/dist/cell/rich-text.d.ts +1 -1
- package/dist/cell-BucgGwl3.mjs.map +1 -1
- package/dist/cell-style-DuvS_Lsg.mjs.map +1 -1
- package/dist/chart/chart-xml.d.ts +1 -1
- package/dist/chart/chart.d.ts +3 -3
- package/dist/chart/cx/chartex-xml.d.ts +1 -1
- package/dist/chart/cx/chartex.d.ts +2 -2
- package/dist/chart/index.d.ts +6 -6
- package/dist/chart/user-shapes-xml.d.ts +1 -1
- package/dist/chart/user-shapes.d.ts +2 -2
- package/dist/chart.mjs.map +1 -1
- package/dist/chartsheet/chartsheet-xml.d.ts +1 -1
- package/dist/chartsheet/chartsheet.d.ts +4 -4
- package/dist/chartsheet/index.d.ts +2 -2
- package/dist/chartsheet-C3-tqkPy.mjs.map +1 -1
- package/dist/coordinate-96Ecci4d.mjs.map +1 -1
- package/dist/datetime-B2ySVlXt.mjs.map +1 -1
- package/dist/defined-names-CviWmtQg.mjs.map +1 -1
- package/dist/differential-DvKU8fJt.mjs.map +1 -1
- package/dist/drawing/dml/dml-xml.d.ts +8 -8
- package/dist/drawing/dml/effect.d.ts +2 -2
- package/dist/drawing/dml/fill.d.ts +1 -1
- package/dist/drawing/dml/geometry.d.ts +1 -1
- package/dist/drawing/dml/line.d.ts +1 -1
- package/dist/drawing/dml/shape-properties.d.ts +5 -5
- package/dist/drawing/dml/text.d.ts +4 -4
- package/dist/drawing/drawing-xml.d.ts +1 -1
- package/dist/drawing/drawing.d.ts +9 -9
- package/dist/drawing/index.d.ts +14 -14
- package/dist/drawing-BxzLuryn.mjs.map +1 -1
- package/dist/drawing.mjs.map +1 -1
- package/dist/{escape-DFTE7ZJc.mjs → escape-rnWSPpWY.mjs} +4 -6
- package/dist/{escape-DFTE7ZJc.mjs.map → escape-rnWSPpWY.mjs.map} +1 -1
- package/dist/formula/tokenizer.d.ts +1 -1
- package/dist/formula/translate.d.ts +2 -2
- package/dist/io/browser.d.ts +2 -2
- package/dist/io/index.d.ts +7 -7
- package/dist/io/load.d.ts +4 -4
- package/dist/io/node-fs.d.ts +2 -2
- package/dist/io/node-save.d.ts +2 -2
- package/dist/io/node.d.ts +2 -2
- package/dist/io/save.d.ts +2 -2
- package/dist/io.mjs +2 -2
- package/dist/io.mjs.map +1 -1
- package/dist/{load-MyOIjtrU.mjs → load-Bghb1YHY.mjs} +5 -5
- package/dist/load-Bghb1YHY.mjs.map +1 -0
- package/dist/{manifest-Cm9K7D62.mjs → manifest-pLmx7KYh.mjs} +3 -3
- package/dist/manifest-pLmx7KYh.mjs.map +1 -0
- package/dist/node.d.ts +3 -3
- package/dist/node.mjs +1 -1
- package/dist/node.mjs.map +1 -1
- package/dist/packaging/core.d.ts +1 -1
- package/dist/packaging/custom.d.ts +2 -2
- package/dist/packaging/extended.d.ts +2 -2
- package/dist/packaging/index.d.ts +10 -10
- package/dist/packaging.mjs +1 -1
- package/dist/{parser-D3SLaOFe.mjs → parser-By6RWZVW.mjs} +39 -10
- package/dist/parser-By6RWZVW.mjs.map +1 -0
- package/dist/reader-BNaUTVCy.mjs.map +1 -1
- package/dist/{save-2moCT3Af.mjs → save-Bqcf8w3g.mjs} +6 -6
- package/dist/save-Bqcf8w3g.mjs.map +1 -0
- package/dist/schema/core.d.ts +1 -1
- package/dist/schema/index.d.ts +3 -3
- package/dist/schema/serialize.d.ts +2 -2
- package/dist/serialize-BC2Wu3bR.mjs.map +1 -1
- package/dist/{serializer-BtO2TrI7.mjs → serializer-C6nm0mRJ.mjs} +2 -2
- package/dist/serializer-C6nm0mRJ.mjs.map +1 -0
- package/dist/streaming/index.d.ts +2 -2
- package/dist/streaming/read-only.d.ts +4 -4
- package/dist/streaming/write-only.d.ts +7 -7
- package/dist/streaming.mjs +6 -6
- package/dist/streaming.mjs.map +1 -1
- package/dist/styles/alignment.schema.d.ts +2 -2
- package/dist/styles/borders.d.ts +1 -1
- package/dist/styles/borders.schema.d.ts +2 -2
- package/dist/styles/cell-style.d.ts +9 -9
- package/dist/styles/colors.schema.d.ts +2 -2
- package/dist/styles/differential.d.ts +7 -7
- package/dist/styles/fills.d.ts +1 -1
- package/dist/styles/fills.schema.d.ts +2 -2
- package/dist/styles/fonts.d.ts +1 -1
- package/dist/styles/fonts.schema.d.ts +2 -2
- package/dist/styles/index.d.ts +21 -21
- package/dist/styles/named-styles.d.ts +6 -6
- package/dist/styles/numbers.schema.d.ts +2 -2
- package/dist/styles/protection.schema.d.ts +2 -2
- package/dist/styles/stylesheet-reader.d.ts +1 -1
- package/dist/styles/stylesheet-writer.d.ts +1 -1
- package/dist/styles/stylesheet.d.ts +8 -8
- package/dist/{stylesheet-writer-BrOw4jMY.mjs → stylesheet-writer-HxaX7bGy.mjs} +6 -6
- package/dist/stylesheet-writer-HxaX7bGy.mjs.map +1 -0
- package/dist/table-1P8we2gS.mjs.map +1 -1
- package/dist/tree-BX-sRRVp.mjs.map +1 -1
- package/dist/user-shapes-DfmCGKB0.mjs.map +1 -1
- package/dist/utf8-Tn3nzyik.mjs.map +1 -1
- package/dist/utils/escape.d.ts +3 -5
- package/dist/utils/index.d.ts +11 -11
- package/dist/utils.mjs +1 -1
- package/dist/workbook/calc-properties.d.ts +1 -1
- package/dist/workbook/defined-names.d.ts +3 -3
- package/dist/workbook/index.d.ts +24 -24
- package/dist/workbook/protection.d.ts +1 -1
- package/dist/workbook/shared-strings.d.ts +2 -2
- package/dist/workbook/views.d.ts +1 -1
- package/dist/workbook/workbook-properties.d.ts +1 -1
- package/dist/workbook/workbook.d.ts +46 -46
- package/dist/{workbook-CARZS94U.mjs → workbook-BlZVXiyG.mjs} +3 -3
- package/dist/workbook-BlZVXiyG.mjs.map +1 -0
- package/dist/workbook.mjs +1 -1
- package/dist/workbook.mjs.map +1 -1
- package/dist/worksheet/auto-filter.d.ts +1 -1
- package/dist/worksheet/cell-range.d.ts +2 -2
- package/dist/worksheet/comments-xml.d.ts +1 -1
- package/dist/worksheet/conditional-formatting.d.ts +2 -2
- package/dist/worksheet/custom-sheet-views.d.ts +2 -2
- package/dist/worksheet/data-validations.d.ts +2 -2
- package/dist/worksheet/errors.d.ts +1 -1
- package/dist/worksheet/hyperlinks.d.ts +1 -1
- package/dist/worksheet/index.d.ts +46 -46
- package/dist/worksheet/ole-objects.d.ts +1 -1
- package/dist/worksheet/page-setup.d.ts +1 -1
- package/dist/worksheet/properties.d.ts +1 -1
- package/dist/worksheet/protected-ranges.d.ts +1 -1
- package/dist/worksheet/protection.d.ts +1 -1
- package/dist/worksheet/reader.d.ts +9 -9
- package/dist/worksheet/scenarios.d.ts +1 -1
- package/dist/worksheet/table-xml.d.ts +1 -1
- package/dist/worksheet/table.d.ts +3 -3
- package/dist/worksheet/worksheet.d.ts +31 -31
- package/dist/worksheet/writer.d.ts +9 -9
- package/dist/worksheet-C5Ensf_j.mjs.map +1 -1
- package/dist/worksheet.mjs.map +1 -1
- package/dist/writer-IyFccCRJ.mjs.map +1 -1
- package/dist/xml/index.d.ts +10 -10
- package/dist/xml/parser.d.ts +1 -1
- package/dist/xml/serializer.d.ts +1 -1
- package/dist/xml/stream-writer.d.ts +1 -1
- package/dist/xml.mjs +3 -3
- package/dist/xml.mjs.map +1 -1
- package/dist/zip/decompression-guard.d.ts +1 -1
- package/dist/zip/index.d.ts +6 -6
- package/dist/zip/random-access-reader.d.ts +2 -2
- package/dist/zip/reader.d.ts +2 -2
- package/dist/zip/writer.d.ts +1 -1
- package/package.json +4 -1
- package/dist/load-MyOIjtrU.mjs.map +0 -1
- package/dist/manifest-Cm9K7D62.mjs.map +0 -1
- package/dist/parser-D3SLaOFe.mjs.map +0 -1
- package/dist/save-2moCT3Af.mjs.map +0 -1
- package/dist/serializer-BtO2TrI7.mjs.map +0 -1
- package/dist/stylesheet-writer-BrOw4jMY.mjs.map +0 -1
- package/dist/workbook-CARZS94U.mjs.map +0 -1
package/dist/workbook.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workbook.mjs","names":[],"sources":["../src/workbook/protection.ts","../src/workbook/views.ts","../src/workbook/calc-properties.ts","../src/workbook/workbook-properties.ts","../src/workbook/file-version.ts","../src/workbook/file-sharing.ts","../src/workbook/file-recovery.ts","../src/workbook/smart-tags.ts","../src/workbook/function-groups.ts"],"sourcesContent":["// Workbook-level <workbookProtection>. Per ECMA-376 §18.2.29 and (workbook\n// side).\n//\n// Two parallel password-hash quadruples cover Excel's \"Protect Workbook\"\n// dialog: one set locks structure / window resize, the other locks the\n// revision-tracking history. The wire-form attrs round-trip verbatim —\n// computing a fresh hash from a plaintext password lives behind a future helper\n// (D-tier in the roadmap).\n//\n// Note: the non-hash `workbookPassword` / `revisionsPassword` attrs are the\n// legacy Excel 97/2000 hex hash form. Modern files use the `*HashValue` +\n// `*SaltValue` + `*SpinCount` + `*AlgorithmName` quad instead.\n\nexport interface WorkbookProtection {\n /** Legacy 16-bit hex hash of the workbook password (\"CC1A\" etc.). */\n workbookPassword?: string;\n workbookPasswordCharacterSet?: string;\n workbookAlgorithmName?: string;\n workbookHashValue?: string;\n workbookSaltValue?: string;\n workbookSpinCount?: number;\n /** Legacy 16-bit hex hash of the revisions-tracking password. */\n revisionsPassword?: string;\n revisionsPasswordCharacterSet?: string;\n revisionsAlgorithmName?: string;\n revisionsHashValue?: string;\n revisionsSaltValue?: string;\n revisionsSpinCount?: number;\n /** Lock add/delete/move/rename/hide of sheets. */\n lockStructure?: boolean;\n /** Lock the workbook window size and position. */\n lockWindows?: boolean;\n /** Lock revision tracking — enabled with the \"Track Changes\" feature. */\n lockRevision?: boolean;\n}\n\nexport const makeWorkbookProtection = (opts: WorkbookProtection = {}): WorkbookProtection => {\n const out: WorkbookProtection = {};\n for (const k of [\n 'workbookPassword',\n 'workbookPasswordCharacterSet',\n 'workbookAlgorithmName',\n 'workbookHashValue',\n 'workbookSaltValue',\n 'revisionsPassword',\n 'revisionsPasswordCharacterSet',\n 'revisionsAlgorithmName',\n 'revisionsHashValue',\n 'revisionsSaltValue',\n ] as const) {\n if (opts[k] !== undefined) out[k] = opts[k];\n }\n if (opts.workbookSpinCount !== undefined) out.workbookSpinCount = opts.workbookSpinCount;\n if (opts.revisionsSpinCount !== undefined) out.revisionsSpinCount = opts.revisionsSpinCount;\n if (opts.lockStructure !== undefined) out.lockStructure = opts.lockStructure;\n if (opts.lockWindows !== undefined) out.lockWindows = opts.lockWindows;\n if (opts.lockRevision !== undefined) out.lockRevision = opts.lockRevision;\n return out;\n};\n\n// ---- Workbook ergonomic helpers -----------------------------------------\n\nimport type { Workbook } from './workbook';\n\n/**\n * Lock the workbook with Excel's \"Protect Workbook → Structure\" default\n * (lockStructure=true). Pass `overrides` to also lock windows /\n * revision-tracking, or to attach a password-hash quad. Plaintext password\n * support is deferred until the D-tier hashing helper lands.\n */\nexport const protectWorkbook = (\n wb: Workbook,\n overrides: Partial<WorkbookProtection> = {},\n): WorkbookProtection => {\n wb.workbookProtection = { lockStructure: true, ...overrides };\n return wb.workbookProtection;\n};\n\n/** Drop the workbook-protection record entirely. */\nexport const unprotectWorkbook = (wb: Workbook): void => {\n delete (wb as { workbookProtection?: WorkbookProtection }).workbookProtection;\n};\n\n/** True iff `lockStructure === true`. */\nexport const isWorkbookProtected = (wb: Workbook): boolean =>\n wb.workbookProtection?.lockStructure === true;\n","// Workbook-level <bookViews> typed model. Per ECMA-376 §18.2.30 and\n// openpyxl/openpyxl/workbook/views.py.\n//\n// `<bookViews>` carries one or more `<workbookView>` entries. The\n// first entry drives Excel's default tab strip (firstSheet / activeTab)\n// and window position. Most workbooks have exactly one entry.\n\nexport type WorkbookViewVisibility = 'visible' | 'hidden' | 'veryHidden';\n\nexport interface WorkbookView {\n visibility?: WorkbookViewVisibility;\n minimized?: boolean;\n showHorizontalScroll?: boolean;\n showVerticalScroll?: boolean;\n showSheetTabs?: boolean;\n /** Window x position in screen pixels — Excel restores it when re-opening. */\n xWindow?: number;\n /** Window y position. */\n yWindow?: number;\n windowWidth?: number;\n windowHeight?: number;\n /** Width of the sheet tab strip relative to the horizontal scroll bar (0..1000, default 600). */\n tabRatio?: number;\n /** Index of the leftmost visible sheet tab (0-based). */\n firstSheet?: number;\n /** Index of the currently active sheet tab (0-based). */\n activeTab?: number;\n autoFilterDateGrouping?: boolean;\n /**\n * Namespaced attributes outside SpreadsheetML, keyed in Clark notation\n * (`{ns}local`). Excel writes `xr2:uid=\"{…}\"` here to tie the view to its\n * revision-tracking record; kept verbatim because the model has no slot for\n * it and dropping it changes what Excel reads back.\n */\n extAttrs?: Readonly<Record<string, string>>;\n}\n\nexport const makeWorkbookView = (opts: WorkbookView = {}): WorkbookView => ({ ...opts });\n\nexport type CustomViewShowComments = 'commNone' | 'commIndicator' | 'commIndAndComment';\nexport type CustomViewShowObjects = 'all' | 'placeholders' | 'none';\n\nexport interface CustomWorkbookView {\n name: string;\n guid: string;\n /** Window width in screen pixels — required when the element is present. */\n windowWidth: number;\n windowHeight: number;\n /** Index (0-based) of the sheet active in this saved view. */\n activeSheetId: number;\n autoUpdate?: boolean;\n /** Auto-merge interval in minutes (for shared workbooks). */\n mergeInterval?: number;\n changesSavedWin?: boolean;\n onlySync?: boolean;\n personalView?: boolean;\n includePrintSettings?: boolean;\n includeHiddenRowCol?: boolean;\n maximized?: boolean;\n minimized?: boolean;\n showHorizontalScroll?: boolean;\n showVerticalScroll?: boolean;\n showSheetTabs?: boolean;\n xWindow?: number;\n yWindow?: number;\n tabRatio?: number;\n showFormulaBar?: boolean;\n showStatusbar?: boolean;\n showComments?: CustomViewShowComments;\n showObjects?: CustomViewShowObjects;\n}\n\nexport const makeCustomWorkbookView = (\n opts: Pick<CustomWorkbookView, 'name' | 'guid' | 'windowWidth' | 'windowHeight' | 'activeSheetId'> &\n Partial<CustomWorkbookView>,\n): CustomWorkbookView => ({ ...opts });\n\nimport type { Workbook } from './workbook';\n\n/**\n * Get-or-create the primary `<workbookView>` entry. Most workbooks have\n * exactly one `<workbookView>`; this helper is the right place to hang\n * tab-strip / window state edits without forcing the caller to allocate\n * the array themselves.\n */\nconst ensurePrimaryView = (wb: Workbook): WorkbookView => {\n const existing = wb.bookViews?.[0];\n if (existing) return existing;\n const fresh = makeWorkbookView();\n wb.bookViews = [fresh];\n return fresh;\n};\n\n/** Get the index of the active sheet tab (0-based) from the primary workbookView, or 0 if unset. */\nexport const getActiveTab = (wb: Workbook): number => wb.bookViews?.[0]?.activeTab ?? 0;\n\n/** Set the active sheet tab (0-based) on the primary workbookView. */\nexport const setActiveTab = (wb: Workbook, index: number): void => {\n ensurePrimaryView(wb).activeTab = index;\n};\n\n/** Get the index of the leftmost visible sheet tab from the primary workbookView, or 0 if unset. */\nexport const getFirstSheet = (wb: Workbook): number => wb.bookViews?.[0]?.firstSheet ?? 0;\n\n/** Set the leftmost visible sheet tab on the primary workbookView. */\nexport const setFirstSheet = (wb: Workbook, index: number): void => {\n ensurePrimaryView(wb).firstSheet = index;\n};\n\n/** Set the tab strip width ratio (0..1000, Excel default 600). */\nexport const setTabRatio = (wb: Workbook, ratio: number): void => {\n ensurePrimaryView(wb).tabRatio = ratio;\n};\n\n/** Toggle the sheet tab strip visibility. */\nexport const setShowSheetTabs = (wb: Workbook, show: boolean): void => {\n ensurePrimaryView(wb).showSheetTabs = show;\n};\n\n/** Toggle the horizontal scroll bar in Excel's window chrome. */\nexport const setShowHorizontalScroll = (wb: Workbook, show: boolean): void => {\n ensurePrimaryView(wb).showHorizontalScroll = show;\n};\n\n/** Toggle the vertical scroll bar in Excel's window chrome. */\nexport const setShowVerticalScroll = (wb: Workbook, show: boolean): void => {\n ensurePrimaryView(wb).showVerticalScroll = show;\n};\n\n/**\n * Toggle the workbook window minimised state. Excel honours this on\n * reopen so the file restores into the minimised state it was saved\n * with.\n */\nexport const setWorkbookMinimized = (wb: Workbook, minimized: boolean): void => {\n ensurePrimaryView(wb).minimized = minimized;\n};\n\n/** Set the visibility of the workbook window itself ('visible' / 'hidden' / 'veryHidden'). */\nexport const setWorkbookVisibility = (wb: Workbook, visibility: WorkbookViewVisibility): void => {\n ensurePrimaryView(wb).visibility = visibility;\n};\n\n/**\n * Set window position + size on the primary workbookView in one call.\n * Pass `undefined` for any axis to leave it untouched.\n */\nexport const setWorkbookWindow = (\n wb: Workbook,\n opts: { xWindow?: number; yWindow?: number; windowWidth?: number; windowHeight?: number },\n): void => {\n const v = ensurePrimaryView(wb);\n if (opts.xWindow !== undefined) v.xWindow = opts.xWindow;\n if (opts.yWindow !== undefined) v.yWindow = opts.yWindow;\n if (opts.windowWidth !== undefined) v.windowWidth = opts.windowWidth;\n if (opts.windowHeight !== undefined) v.windowHeight = opts.windowHeight;\n};\n","// Workbook-level <calcPr>. Per ECMA-376 §18.2.2.\n//\n// `calcId` is a build identifier Excel uses to decide whether to force\n// a recalc when re-opening; modern Excel treats any value as \"use\n// what's there\". The other attrs cover Excel's calculation options\n// (Tools → Options → Formulas).\n\nexport type CalcMode = 'manual' | 'auto' | 'autoNoTable';\nexport type RefMode = 'A1' | 'R1C1';\n\nexport interface CalcProperties {\n /** Excel build/calc-engine identifier; OpenOffice sets 191621, Excel 2016+ 162913 etc. */\n calcId?: number;\n calcMode?: CalcMode;\n /** Force a full recalc when the workbook is loaded. Excel default `true` for safety. */\n fullCalcOnLoad?: boolean;\n refMode?: RefMode;\n /** Allow circular references via iterative calculation. */\n iterate?: boolean;\n iterateCount?: number;\n iterateDelta?: number;\n /** Use full 15-digit precision (vs. displayed precision). */\n fullPrecision?: boolean;\n calcCompleted?: boolean;\n /** Run a recalc on save. */\n calcOnSave?: boolean;\n /** Use multi-threaded calculation. */\n concurrentCalc?: boolean;\n concurrentManualCount?: number;\n /** Force a full recalc on next interaction. */\n forceFullCalc?: boolean;\n}\n\nexport const makeCalcProperties = (opts: CalcProperties = {}): CalcProperties => ({ ...opts });\n\n// ---- Workbook ergonomic helpers ----------------------------------------\n\nimport type { Workbook } from './workbook';\n\nconst ensureCalcProperties = (wb: Workbook): CalcProperties => {\n if (!wb.calcProperties) wb.calcProperties = {};\n return wb.calcProperties;\n};\n\n/**\n * Set the recalculation mode. `'auto'` is Excel's default;\n * `'manual'` requires F9 to recompute formulas; `'autoNoTable'`\n * recomputes everything except data-table cells.\n */\nexport const setCalcMode = (wb: Workbook, mode: CalcMode): void => {\n ensureCalcProperties(wb).calcMode = mode;\n};\n\n/**\n * Toggle iterative calculation (Excel's \"Enable iterative calculation\"\n * option). When `enable` is true and `count` / `delta` are provided,\n * they replace the default Excel limits (100 iterations, 0.001 delta).\n */\nexport const setIterativeCalc = (\n wb: Workbook,\n enable: boolean,\n opts: { count?: number; delta?: number } = {},\n): void => {\n const calc = ensureCalcProperties(wb);\n calc.iterate = enable;\n if (opts.count !== undefined) calc.iterateCount = opts.count;\n if (opts.delta !== undefined) calc.iterateDelta = opts.delta;\n};\n\n/** Toggle \"Recalculate workbook before saving\" (workbook-level). */\nexport const setCalcOnSave = (wb: Workbook, on: boolean): void => {\n ensureCalcProperties(wb).calcOnSave = on;\n};\n\n/** Toggle \"Recalculate workbook on load\" — forces a full recalc on open. */\nexport const setFullCalcOnLoad = (wb: Workbook, on: boolean): void => {\n ensureCalcProperties(wb).fullCalcOnLoad = on;\n};\n\n/** Toggle \"Set precision as displayed\" (false = full 15-digit precision). */\nexport const setFullPrecision = (wb: Workbook, on: boolean): void => {\n ensureCalcProperties(wb).fullPrecision = on;\n};\n","// Workbook-level <workbookPr>. Per ECMA-376 §18.2.28.\n//\n// Mirrors openpyxl/openpyxl/workbook/properties.py WorkbookProperties.\n// `date1904` is already lifted via wb.date1904; everything else lived\n// in workbookXmlExtras passthrough until now. This typed shell promotes\n// all 19 attrs into the modeled workbook so consumers can edit them\n// without rebuilding the XmlNode.\n\nexport type ShowObjectsMode = 'all' | 'placeholders' | 'none';\nexport type UpdateLinksMode = 'userSet' | 'never' | 'always';\n\nexport interface WorkbookProperties {\n /**\n * Mac 1904 epoch flag. Mirrored from `Workbook.date1904` — the\n * canonical source. Setting it here has no effect on the cell-serial\n * conversion path, which keys off the top-level field.\n */\n date1904?: boolean;\n /** Excel 5/95 ↔ 2007 compatibility hint. */\n dateCompatibility?: boolean;\n showObjects?: ShowObjectsMode;\n showBorderUnselectedTables?: boolean;\n filterPrivacy?: boolean;\n promptedSolutions?: boolean;\n showInkAnnotation?: boolean;\n backupFile?: boolean;\n /** Cache external-link values when saving. */\n saveExternalLinkValues?: boolean;\n /** \"Update remote links\" prompt mode. */\n updateLinks?: UpdateLinksMode;\n /** VBA codeName for the workbook (e.g. \"ThisWorkbook\" / \"ЭтаКнига\"). */\n codeName?: string;\n hidePivotFieldList?: boolean;\n showPivotChartFilter?: boolean;\n allowRefreshQuery?: boolean;\n publishItems?: boolean;\n checkCompatibility?: boolean;\n autoCompressPictures?: boolean;\n refreshAllConnections?: boolean;\n /** Theme schema version (Excel 2007 = 124226, 2013+ = 153222). */\n defaultThemeVersion?: number;\n}\n\nexport const makeWorkbookProperties = (opts: WorkbookProperties = {}): WorkbookProperties => ({ ...opts });\n\n// ---- Workbook ergonomic helpers ----------------------------------------\n\nimport type { Workbook } from './workbook';\n\nconst ensureWorkbookProperties = (wb: Workbook): WorkbookProperties => {\n if (!wb.workbookProperties) wb.workbookProperties = {};\n return wb.workbookProperties;\n};\n\n/**\n * Set the workbook-level VBA codeName (\"ThisWorkbook\" by default in\n * Excel; localised forms like \"ЭтаКнига\" round-trip too). Empty string\n * is allowed — Excel writes it that way for codename-stripped files.\n */\nexport const setWorkbookCodeName = (wb: Workbook, codeName: string): void => {\n ensureWorkbookProperties(wb).codeName = codeName;\n};\n\n/**\n * Toggle the Mac 1904 epoch. The canonical flag is `wb.date1904`\n * (drives cell-serial conversion); this helper writes both the\n * canonical field and the mirror on `workbookProperties` so a save\n * emits a consistent `<workbookPr date1904=\"…\">` attribute.\n */\nexport const setDate1904 = (wb: Workbook, on: boolean): void => {\n wb.date1904 = on;\n ensureWorkbookProperties(wb).date1904 = on;\n};\n\n/**\n * Set the \"Update remote links\" prompt mode. `'userSet'` keeps\n * Excel's per-user preference; `'never'` disables the prompt;\n * `'always'` forces it. Mirrors the Trust Center \"External Content\"\n * dropdown.\n */\nexport const setUpdateLinksMode = (wb: Workbook, mode: UpdateLinksMode): void => {\n ensureWorkbookProperties(wb).updateLinks = mode;\n};\n\n/** Toggle the \"filterPrivacy\" hint Excel writes to indicate filter contents may be sensitive. */\nexport const setFilterPrivacy = (wb: Workbook, on: boolean): void => {\n ensureWorkbookProperties(wb).filterPrivacy = on;\n};\n","// Workbook-level <fileVersion>. Per ECMA-376 §18.2.13.\n//\n// Carries Microsoft Office app/version metadata that Excel writes\n// when it saves; round-tripping these values keeps the file looking\n// like Excel's own output to downstream tools that sniff them.\n\nexport interface FileVersion {\n /** Application that last saved the workbook (\"xl\" for Excel). */\n appName?: string;\n /** Build number of the last editor (e.g. \"7.5210\"). */\n lastEdited?: string;\n /** Build number of the lowest editor (oldest Excel that touched the file). */\n lowestEdited?: string;\n /** Internal \"rolled-up build\" number. */\n rupBuild?: string;\n /** GUID identifying the file content (Excel uses it to detect re-saves). */\n codeName?: string;\n}\n\nexport const makeFileVersion = (opts: FileVersion = {}): FileVersion => ({ ...opts });\n","// Workbook-level <fileSharing>. Per ECMA-376 §18.2.12.\n//\n// Carries the workbook's read-only / write-protection settings (Save\n// As → Tools → General Options → \"Modify password\" / \"Read-only\n// recommended\"). The hash quad mirrors sheetProtection / workbookProtection.\n\nexport interface FileSharing {\n /** Mark the workbook as \"Read-only recommended\" — Excel pops a dialog on open. */\n readOnlyRecommended?: boolean;\n /** Author name attached to the read/write password. */\n userName?: string;\n /** Legacy 16-bit hex hash of the reservation password. */\n reservationPassword?: string;\n /** Modern hash quad — algorithmName + hashValue + saltValue + spinCount. */\n algorithmName?: string;\n hashValue?: string;\n saltValue?: string;\n spinCount?: number;\n}\n\nexport const makeFileSharing = (opts: FileSharing = {}): FileSharing => ({ ...opts });\n","// Workbook-level <fileRecoveryPr>. Per ECMA-376 §18.2.11.\n//\n// Excel writes this element after an autorecover sequence to mark the\n// workbook with the recovery state so subsequent opens can prompt the\n// user. Almost always absent in fresh files.\n\nexport interface FileRecoveryProperties {\n /** True after an autorecover save — Excel uses it to display the recovery banner. */\n autoRecover?: boolean;\n /** Persisted crash-recovery flag. */\n crashSave?: boolean;\n /** Mark the file as \"data extracted from a damaged workbook\". */\n dataExtractLoad?: boolean;\n /** Workbook was repaired during load. */\n repairLoad?: boolean;\n}\n\nexport const makeFileRecoveryProperties = (\n opts: FileRecoveryProperties = {},\n): FileRecoveryProperties => ({ ...opts });\n","// Workbook-level <smartTagPr> + <smartTagTypes>. Per ECMA-376 §18.2.26\n// / §18.2.27. Smart tags were Excel 2003's auto-recognized data\n// (stock symbols, dates, names) and are deprecated, but the elements\n// still appear in some legacy workbooks.\n\nexport type SmartTagShowMode = 'all' | 'noIndicator';\n\nexport interface SmartTagProperties {\n /** Embed smart tags into the workbook on save. */\n embed?: boolean;\n show?: SmartTagShowMode;\n}\n\nexport interface SmartTagType {\n namespaceUri?: string;\n name?: string;\n url?: string;\n}\n\nexport const makeSmartTagProperties = (opts: SmartTagProperties = {}): SmartTagProperties => ({ ...opts });\n\nexport const makeSmartTagType = (opts: SmartTagType = {}): SmartTagType => ({ ...opts });\n","// Workbook-level <functionGroups>. Per ECMA-376 §18.2.14.\n//\n// Excel registers built-in function groups (Math/Statistical/Logical/...)\n// implicitly with a `builtInGroupCount` count and supports user-defined\n// XLL function groups appended after that count. Most workbooks don't\n// carry this element at all.\n\nexport interface FunctionGroup {\n name: string;\n}\n\nexport interface FunctionGroups {\n /** Number of built-in groups Excel reserves before user entries (default 16). */\n builtInGroupCount?: number;\n groups: FunctionGroup[];\n}\n\nexport const makeFunctionGroup = (name: string): FunctionGroup => ({ name });\n\nexport const makeFunctionGroups = (opts: Partial<FunctionGroups> = {}): FunctionGroups => ({\n groups: opts.groups?.slice() ?? [],\n ...(opts.builtInGroupCount !== undefined ? { builtInGroupCount: opts.builtInGroupCount } : {}),\n});\n"],"mappings":";;;AAoCA,MAAa,0BAA0B,OAA2B,CAAC,MAA0B;CAC3F,MAAM,MAA0B,CAAC;CACjC,KAAK,MAAM,KAAK;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,GACE,IAAI,KAAK,OAAO,KAAA,GAAW,IAAI,KAAK,KAAK;CAE3C,IAAI,KAAK,sBAAsB,KAAA,GAAW,IAAI,oBAAoB,KAAK;CACvE,IAAI,KAAK,uBAAuB,KAAA,GAAW,IAAI,qBAAqB,KAAK;CACzE,IAAI,KAAK,kBAAkB,KAAA,GAAW,IAAI,gBAAgB,KAAK;CAC/D,IAAI,KAAK,gBAAgB,KAAA,GAAW,IAAI,cAAc,KAAK;CAC3D,IAAI,KAAK,iBAAiB,KAAA,GAAW,IAAI,eAAe,KAAK;CAC7D,OAAO;AACT;;;ACrBA,MAAa,oBAAoB,OAAqB,CAAC,OAAqB,EAAE,GAAG,KAAK;AAmCtF,MAAa,0BACX,UAEwB,EAAE,GAAG,KAAK;;;AC1CpC,MAAa,sBAAsB,OAAuB,CAAC,OAAuB,EAAE,GAAG,KAAK;;;ACU5F,MAAa,0BAA0B,OAA2B,CAAC,OAA2B,EAAE,GAAG,KAAK;;;ACxBxG,MAAa,mBAAmB,OAAoB,CAAC,OAAoB,EAAE,GAAG,KAAK;;;ACCnF,MAAa,mBAAmB,OAAoB,CAAC,OAAoB,EAAE,GAAG,KAAK;;;ACHnF,MAAa,8BACX,OAA+B,CAAC,OACJ,EAAE,GAAG,KAAK;;;ACAxC,MAAa,0BAA0B,OAA2B,CAAC,OAA2B,EAAE,GAAG,KAAK;AAExG,MAAa,oBAAoB,OAAqB,CAAC,OAAqB,EAAE,GAAG,KAAK;;;ACJtF,MAAa,qBAAqB,UAAiC,EAAE,KAAK;AAE1E,MAAa,sBAAsB,OAAgC,CAAC,OAAuB;CACzF,QAAQ,KAAK,QAAQ,MAAM,KAAK,CAAC;CACjC,GAAI,KAAK,sBAAsB,KAAA,IAAY,EAAE,mBAAmB,KAAK,kBAAkB,IAAI,CAAC;AAC9F"}
|
|
1
|
+
{"version":3,"file":"workbook.mjs","names":[],"sources":["../src/workbook/protection.ts","../src/workbook/views.ts","../src/workbook/calc-properties.ts","../src/workbook/workbook-properties.ts","../src/workbook/file-version.ts","../src/workbook/file-sharing.ts","../src/workbook/file-recovery.ts","../src/workbook/smart-tags.ts","../src/workbook/function-groups.ts"],"sourcesContent":["// Workbook-level <workbookProtection>. Per ECMA-376 §18.2.29 and (workbook\n// side).\n//\n// Two parallel password-hash quadruples cover Excel's \"Protect Workbook\"\n// dialog: one set locks structure / window resize, the other locks the\n// revision-tracking history. The wire-form attrs round-trip verbatim —\n// computing a fresh hash from a plaintext password lives behind a future helper\n// (D-tier in the roadmap).\n//\n// Note: the non-hash `workbookPassword` / `revisionsPassword` attrs are the\n// legacy Excel 97/2000 hex hash form. Modern files use the `*HashValue` +\n// `*SaltValue` + `*SpinCount` + `*AlgorithmName` quad instead.\n\nexport interface WorkbookProtection {\n /** Legacy 16-bit hex hash of the workbook password (\"CC1A\" etc.). */\n workbookPassword?: string;\n workbookPasswordCharacterSet?: string;\n workbookAlgorithmName?: string;\n workbookHashValue?: string;\n workbookSaltValue?: string;\n workbookSpinCount?: number;\n /** Legacy 16-bit hex hash of the revisions-tracking password. */\n revisionsPassword?: string;\n revisionsPasswordCharacterSet?: string;\n revisionsAlgorithmName?: string;\n revisionsHashValue?: string;\n revisionsSaltValue?: string;\n revisionsSpinCount?: number;\n /** Lock add/delete/move/rename/hide of sheets. */\n lockStructure?: boolean;\n /** Lock the workbook window size and position. */\n lockWindows?: boolean;\n /** Lock revision tracking — enabled with the \"Track Changes\" feature. */\n lockRevision?: boolean;\n}\n\nexport const makeWorkbookProtection = (opts: WorkbookProtection = {}): WorkbookProtection => {\n const out: WorkbookProtection = {};\n for (const k of [\n 'workbookPassword',\n 'workbookPasswordCharacterSet',\n 'workbookAlgorithmName',\n 'workbookHashValue',\n 'workbookSaltValue',\n 'revisionsPassword',\n 'revisionsPasswordCharacterSet',\n 'revisionsAlgorithmName',\n 'revisionsHashValue',\n 'revisionsSaltValue',\n ] as const) {\n if (opts[k] !== undefined) out[k] = opts[k];\n }\n if (opts.workbookSpinCount !== undefined) out.workbookSpinCount = opts.workbookSpinCount;\n if (opts.revisionsSpinCount !== undefined) out.revisionsSpinCount = opts.revisionsSpinCount;\n if (opts.lockStructure !== undefined) out.lockStructure = opts.lockStructure;\n if (opts.lockWindows !== undefined) out.lockWindows = opts.lockWindows;\n if (opts.lockRevision !== undefined) out.lockRevision = opts.lockRevision;\n return out;\n};\n\n// ---- Workbook ergonomic helpers -----------------------------------------\n\nimport type { Workbook } from './workbook.js';\n\n/**\n * Lock the workbook with Excel's \"Protect Workbook → Structure\" default\n * (lockStructure=true). Pass `overrides` to also lock windows /\n * revision-tracking, or to attach a password-hash quad. Plaintext password\n * support is deferred until the D-tier hashing helper lands.\n */\nexport const protectWorkbook = (\n wb: Workbook,\n overrides: Partial<WorkbookProtection> = {},\n): WorkbookProtection => {\n wb.workbookProtection = { lockStructure: true, ...overrides };\n return wb.workbookProtection;\n};\n\n/** Drop the workbook-protection record entirely. */\nexport const unprotectWorkbook = (wb: Workbook): void => {\n delete (wb as { workbookProtection?: WorkbookProtection }).workbookProtection;\n};\n\n/** True iff `lockStructure === true`. */\nexport const isWorkbookProtected = (wb: Workbook): boolean =>\n wb.workbookProtection?.lockStructure === true;\n","// Workbook-level <bookViews> typed model. Per ECMA-376 §18.2.30 and\n// openpyxl/openpyxl/workbook/views.py.\n//\n// `<bookViews>` carries one or more `<workbookView>` entries. The\n// first entry drives Excel's default tab strip (firstSheet / activeTab)\n// and window position. Most workbooks have exactly one entry.\n\nexport type WorkbookViewVisibility = 'visible' | 'hidden' | 'veryHidden';\n\nexport interface WorkbookView {\n visibility?: WorkbookViewVisibility;\n minimized?: boolean;\n showHorizontalScroll?: boolean;\n showVerticalScroll?: boolean;\n showSheetTabs?: boolean;\n /** Window x position in screen pixels — Excel restores it when re-opening. */\n xWindow?: number;\n /** Window y position. */\n yWindow?: number;\n windowWidth?: number;\n windowHeight?: number;\n /** Width of the sheet tab strip relative to the horizontal scroll bar (0..1000, default 600). */\n tabRatio?: number;\n /** Index of the leftmost visible sheet tab (0-based). */\n firstSheet?: number;\n /** Index of the currently active sheet tab (0-based). */\n activeTab?: number;\n autoFilterDateGrouping?: boolean;\n /**\n * Namespaced attributes outside SpreadsheetML, keyed in Clark notation\n * (`{ns}local`). Excel writes `xr2:uid=\"{…}\"` here to tie the view to its\n * revision-tracking record; kept verbatim because the model has no slot for\n * it and dropping it changes what Excel reads back.\n */\n extAttrs?: Readonly<Record<string, string>>;\n}\n\nexport const makeWorkbookView = (opts: WorkbookView = {}): WorkbookView => ({ ...opts });\n\nexport type CustomViewShowComments = 'commNone' | 'commIndicator' | 'commIndAndComment';\nexport type CustomViewShowObjects = 'all' | 'placeholders' | 'none';\n\nexport interface CustomWorkbookView {\n name: string;\n guid: string;\n /** Window width in screen pixels — required when the element is present. */\n windowWidth: number;\n windowHeight: number;\n /** Index (0-based) of the sheet active in this saved view. */\n activeSheetId: number;\n autoUpdate?: boolean;\n /** Auto-merge interval in minutes (for shared workbooks). */\n mergeInterval?: number;\n changesSavedWin?: boolean;\n onlySync?: boolean;\n personalView?: boolean;\n includePrintSettings?: boolean;\n includeHiddenRowCol?: boolean;\n maximized?: boolean;\n minimized?: boolean;\n showHorizontalScroll?: boolean;\n showVerticalScroll?: boolean;\n showSheetTabs?: boolean;\n xWindow?: number;\n yWindow?: number;\n tabRatio?: number;\n showFormulaBar?: boolean;\n showStatusbar?: boolean;\n showComments?: CustomViewShowComments;\n showObjects?: CustomViewShowObjects;\n}\n\nexport const makeCustomWorkbookView = (\n opts: Pick<CustomWorkbookView, 'name' | 'guid' | 'windowWidth' | 'windowHeight' | 'activeSheetId'> &\n Partial<CustomWorkbookView>,\n): CustomWorkbookView => ({ ...opts });\n\nimport type { Workbook } from './workbook.js';\n\n/**\n * Get-or-create the primary `<workbookView>` entry. Most workbooks have\n * exactly one `<workbookView>`; this helper is the right place to hang\n * tab-strip / window state edits without forcing the caller to allocate\n * the array themselves.\n */\nconst ensurePrimaryView = (wb: Workbook): WorkbookView => {\n const existing = wb.bookViews?.[0];\n if (existing) return existing;\n const fresh = makeWorkbookView();\n wb.bookViews = [fresh];\n return fresh;\n};\n\n/** Get the index of the active sheet tab (0-based) from the primary workbookView, or 0 if unset. */\nexport const getActiveTab = (wb: Workbook): number => wb.bookViews?.[0]?.activeTab ?? 0;\n\n/** Set the active sheet tab (0-based) on the primary workbookView. */\nexport const setActiveTab = (wb: Workbook, index: number): void => {\n ensurePrimaryView(wb).activeTab = index;\n};\n\n/** Get the index of the leftmost visible sheet tab from the primary workbookView, or 0 if unset. */\nexport const getFirstSheet = (wb: Workbook): number => wb.bookViews?.[0]?.firstSheet ?? 0;\n\n/** Set the leftmost visible sheet tab on the primary workbookView. */\nexport const setFirstSheet = (wb: Workbook, index: number): void => {\n ensurePrimaryView(wb).firstSheet = index;\n};\n\n/** Set the tab strip width ratio (0..1000, Excel default 600). */\nexport const setTabRatio = (wb: Workbook, ratio: number): void => {\n ensurePrimaryView(wb).tabRatio = ratio;\n};\n\n/** Toggle the sheet tab strip visibility. */\nexport const setShowSheetTabs = (wb: Workbook, show: boolean): void => {\n ensurePrimaryView(wb).showSheetTabs = show;\n};\n\n/** Toggle the horizontal scroll bar in Excel's window chrome. */\nexport const setShowHorizontalScroll = (wb: Workbook, show: boolean): void => {\n ensurePrimaryView(wb).showHorizontalScroll = show;\n};\n\n/** Toggle the vertical scroll bar in Excel's window chrome. */\nexport const setShowVerticalScroll = (wb: Workbook, show: boolean): void => {\n ensurePrimaryView(wb).showVerticalScroll = show;\n};\n\n/**\n * Toggle the workbook window minimised state. Excel honours this on\n * reopen so the file restores into the minimised state it was saved\n * with.\n */\nexport const setWorkbookMinimized = (wb: Workbook, minimized: boolean): void => {\n ensurePrimaryView(wb).minimized = minimized;\n};\n\n/** Set the visibility of the workbook window itself ('visible' / 'hidden' / 'veryHidden'). */\nexport const setWorkbookVisibility = (wb: Workbook, visibility: WorkbookViewVisibility): void => {\n ensurePrimaryView(wb).visibility = visibility;\n};\n\n/**\n * Set window position + size on the primary workbookView in one call.\n * Pass `undefined` for any axis to leave it untouched.\n */\nexport const setWorkbookWindow = (\n wb: Workbook,\n opts: { xWindow?: number; yWindow?: number; windowWidth?: number; windowHeight?: number },\n): void => {\n const v = ensurePrimaryView(wb);\n if (opts.xWindow !== undefined) v.xWindow = opts.xWindow;\n if (opts.yWindow !== undefined) v.yWindow = opts.yWindow;\n if (opts.windowWidth !== undefined) v.windowWidth = opts.windowWidth;\n if (opts.windowHeight !== undefined) v.windowHeight = opts.windowHeight;\n};\n","// Workbook-level <calcPr>. Per ECMA-376 §18.2.2.\n//\n// `calcId` is a build identifier Excel uses to decide whether to force\n// a recalc when re-opening; modern Excel treats any value as \"use\n// what's there\". The other attrs cover Excel's calculation options\n// (Tools → Options → Formulas).\n\nexport type CalcMode = 'manual' | 'auto' | 'autoNoTable';\nexport type RefMode = 'A1' | 'R1C1';\n\nexport interface CalcProperties {\n /** Excel build/calc-engine identifier; OpenOffice sets 191621, Excel 2016+ 162913 etc. */\n calcId?: number;\n calcMode?: CalcMode;\n /** Force a full recalc when the workbook is loaded. Excel default `true` for safety. */\n fullCalcOnLoad?: boolean;\n refMode?: RefMode;\n /** Allow circular references via iterative calculation. */\n iterate?: boolean;\n iterateCount?: number;\n iterateDelta?: number;\n /** Use full 15-digit precision (vs. displayed precision). */\n fullPrecision?: boolean;\n calcCompleted?: boolean;\n /** Run a recalc on save. */\n calcOnSave?: boolean;\n /** Use multi-threaded calculation. */\n concurrentCalc?: boolean;\n concurrentManualCount?: number;\n /** Force a full recalc on next interaction. */\n forceFullCalc?: boolean;\n}\n\nexport const makeCalcProperties = (opts: CalcProperties = {}): CalcProperties => ({ ...opts });\n\n// ---- Workbook ergonomic helpers ----------------------------------------\n\nimport type { Workbook } from './workbook.js';\n\nconst ensureCalcProperties = (wb: Workbook): CalcProperties => {\n if (!wb.calcProperties) wb.calcProperties = {};\n return wb.calcProperties;\n};\n\n/**\n * Set the recalculation mode. `'auto'` is Excel's default;\n * `'manual'` requires F9 to recompute formulas; `'autoNoTable'`\n * recomputes everything except data-table cells.\n */\nexport const setCalcMode = (wb: Workbook, mode: CalcMode): void => {\n ensureCalcProperties(wb).calcMode = mode;\n};\n\n/**\n * Toggle iterative calculation (Excel's \"Enable iterative calculation\"\n * option). When `enable` is true and `count` / `delta` are provided,\n * they replace the default Excel limits (100 iterations, 0.001 delta).\n */\nexport const setIterativeCalc = (\n wb: Workbook,\n enable: boolean,\n opts: { count?: number; delta?: number } = {},\n): void => {\n const calc = ensureCalcProperties(wb);\n calc.iterate = enable;\n if (opts.count !== undefined) calc.iterateCount = opts.count;\n if (opts.delta !== undefined) calc.iterateDelta = opts.delta;\n};\n\n/** Toggle \"Recalculate workbook before saving\" (workbook-level). */\nexport const setCalcOnSave = (wb: Workbook, on: boolean): void => {\n ensureCalcProperties(wb).calcOnSave = on;\n};\n\n/** Toggle \"Recalculate workbook on load\" — forces a full recalc on open. */\nexport const setFullCalcOnLoad = (wb: Workbook, on: boolean): void => {\n ensureCalcProperties(wb).fullCalcOnLoad = on;\n};\n\n/** Toggle \"Set precision as displayed\" (false = full 15-digit precision). */\nexport const setFullPrecision = (wb: Workbook, on: boolean): void => {\n ensureCalcProperties(wb).fullPrecision = on;\n};\n","// Workbook-level <workbookPr>. Per ECMA-376 §18.2.28.\n//\n// Mirrors openpyxl/openpyxl/workbook/properties.py WorkbookProperties.\n// `date1904` is already lifted via wb.date1904; everything else lived\n// in workbookXmlExtras passthrough until now. This typed shell promotes\n// all 19 attrs into the modeled workbook so consumers can edit them\n// without rebuilding the XmlNode.\n\nexport type ShowObjectsMode = 'all' | 'placeholders' | 'none';\nexport type UpdateLinksMode = 'userSet' | 'never' | 'always';\n\nexport interface WorkbookProperties {\n /**\n * Mac 1904 epoch flag. Mirrored from `Workbook.date1904` — the\n * canonical source. Setting it here has no effect on the cell-serial\n * conversion path, which keys off the top-level field.\n */\n date1904?: boolean;\n /** Excel 5/95 ↔ 2007 compatibility hint. */\n dateCompatibility?: boolean;\n showObjects?: ShowObjectsMode;\n showBorderUnselectedTables?: boolean;\n filterPrivacy?: boolean;\n promptedSolutions?: boolean;\n showInkAnnotation?: boolean;\n backupFile?: boolean;\n /** Cache external-link values when saving. */\n saveExternalLinkValues?: boolean;\n /** \"Update remote links\" prompt mode. */\n updateLinks?: UpdateLinksMode;\n /** VBA codeName for the workbook (e.g. \"ThisWorkbook\" / \"ЭтаКнига\"). */\n codeName?: string;\n hidePivotFieldList?: boolean;\n showPivotChartFilter?: boolean;\n allowRefreshQuery?: boolean;\n publishItems?: boolean;\n checkCompatibility?: boolean;\n autoCompressPictures?: boolean;\n refreshAllConnections?: boolean;\n /** Theme schema version (Excel 2007 = 124226, 2013+ = 153222). */\n defaultThemeVersion?: number;\n}\n\nexport const makeWorkbookProperties = (opts: WorkbookProperties = {}): WorkbookProperties => ({ ...opts });\n\n// ---- Workbook ergonomic helpers ----------------------------------------\n\nimport type { Workbook } from './workbook.js';\n\nconst ensureWorkbookProperties = (wb: Workbook): WorkbookProperties => {\n if (!wb.workbookProperties) wb.workbookProperties = {};\n return wb.workbookProperties;\n};\n\n/**\n * Set the workbook-level VBA codeName (\"ThisWorkbook\" by default in\n * Excel; localised forms like \"ЭтаКнига\" round-trip too). Empty string\n * is allowed — Excel writes it that way for codename-stripped files.\n */\nexport const setWorkbookCodeName = (wb: Workbook, codeName: string): void => {\n ensureWorkbookProperties(wb).codeName = codeName;\n};\n\n/**\n * Toggle the Mac 1904 epoch. The canonical flag is `wb.date1904`\n * (drives cell-serial conversion); this helper writes both the\n * canonical field and the mirror on `workbookProperties` so a save\n * emits a consistent `<workbookPr date1904=\"…\">` attribute.\n */\nexport const setDate1904 = (wb: Workbook, on: boolean): void => {\n wb.date1904 = on;\n ensureWorkbookProperties(wb).date1904 = on;\n};\n\n/**\n * Set the \"Update remote links\" prompt mode. `'userSet'` keeps\n * Excel's per-user preference; `'never'` disables the prompt;\n * `'always'` forces it. Mirrors the Trust Center \"External Content\"\n * dropdown.\n */\nexport const setUpdateLinksMode = (wb: Workbook, mode: UpdateLinksMode): void => {\n ensureWorkbookProperties(wb).updateLinks = mode;\n};\n\n/** Toggle the \"filterPrivacy\" hint Excel writes to indicate filter contents may be sensitive. */\nexport const setFilterPrivacy = (wb: Workbook, on: boolean): void => {\n ensureWorkbookProperties(wb).filterPrivacy = on;\n};\n","// Workbook-level <fileVersion>. Per ECMA-376 §18.2.13.\n//\n// Carries Microsoft Office app/version metadata that Excel writes\n// when it saves; round-tripping these values keeps the file looking\n// like Excel's own output to downstream tools that sniff them.\n\nexport interface FileVersion {\n /** Application that last saved the workbook (\"xl\" for Excel). */\n appName?: string;\n /** Build number of the last editor (e.g. \"7.5210\"). */\n lastEdited?: string;\n /** Build number of the lowest editor (oldest Excel that touched the file). */\n lowestEdited?: string;\n /** Internal \"rolled-up build\" number. */\n rupBuild?: string;\n /** GUID identifying the file content (Excel uses it to detect re-saves). */\n codeName?: string;\n}\n\nexport const makeFileVersion = (opts: FileVersion = {}): FileVersion => ({ ...opts });\n","// Workbook-level <fileSharing>. Per ECMA-376 §18.2.12.\n//\n// Carries the workbook's read-only / write-protection settings (Save\n// As → Tools → General Options → \"Modify password\" / \"Read-only\n// recommended\"). The hash quad mirrors sheetProtection / workbookProtection.\n\nexport interface FileSharing {\n /** Mark the workbook as \"Read-only recommended\" — Excel pops a dialog on open. */\n readOnlyRecommended?: boolean;\n /** Author name attached to the read/write password. */\n userName?: string;\n /** Legacy 16-bit hex hash of the reservation password. */\n reservationPassword?: string;\n /** Modern hash quad — algorithmName + hashValue + saltValue + spinCount. */\n algorithmName?: string;\n hashValue?: string;\n saltValue?: string;\n spinCount?: number;\n}\n\nexport const makeFileSharing = (opts: FileSharing = {}): FileSharing => ({ ...opts });\n","// Workbook-level <fileRecoveryPr>. Per ECMA-376 §18.2.11.\n//\n// Excel writes this element after an autorecover sequence to mark the\n// workbook with the recovery state so subsequent opens can prompt the\n// user. Almost always absent in fresh files.\n\nexport interface FileRecoveryProperties {\n /** True after an autorecover save — Excel uses it to display the recovery banner. */\n autoRecover?: boolean;\n /** Persisted crash-recovery flag. */\n crashSave?: boolean;\n /** Mark the file as \"data extracted from a damaged workbook\". */\n dataExtractLoad?: boolean;\n /** Workbook was repaired during load. */\n repairLoad?: boolean;\n}\n\nexport const makeFileRecoveryProperties = (\n opts: FileRecoveryProperties = {},\n): FileRecoveryProperties => ({ ...opts });\n","// Workbook-level <smartTagPr> + <smartTagTypes>. Per ECMA-376 §18.2.26\n// / §18.2.27. Smart tags were Excel 2003's auto-recognized data\n// (stock symbols, dates, names) and are deprecated, but the elements\n// still appear in some legacy workbooks.\n\nexport type SmartTagShowMode = 'all' | 'noIndicator';\n\nexport interface SmartTagProperties {\n /** Embed smart tags into the workbook on save. */\n embed?: boolean;\n show?: SmartTagShowMode;\n}\n\nexport interface SmartTagType {\n namespaceUri?: string;\n name?: string;\n url?: string;\n}\n\nexport const makeSmartTagProperties = (opts: SmartTagProperties = {}): SmartTagProperties => ({ ...opts });\n\nexport const makeSmartTagType = (opts: SmartTagType = {}): SmartTagType => ({ ...opts });\n","// Workbook-level <functionGroups>. Per ECMA-376 §18.2.14.\n//\n// Excel registers built-in function groups (Math/Statistical/Logical/...)\n// implicitly with a `builtInGroupCount` count and supports user-defined\n// XLL function groups appended after that count. Most workbooks don't\n// carry this element at all.\n\nexport interface FunctionGroup {\n name: string;\n}\n\nexport interface FunctionGroups {\n /** Number of built-in groups Excel reserves before user entries (default 16). */\n builtInGroupCount?: number;\n groups: FunctionGroup[];\n}\n\nexport const makeFunctionGroup = (name: string): FunctionGroup => ({ name });\n\nexport const makeFunctionGroups = (opts: Partial<FunctionGroups> = {}): FunctionGroups => ({\n groups: opts.groups?.slice() ?? [],\n ...(opts.builtInGroupCount !== undefined ? { builtInGroupCount: opts.builtInGroupCount } : {}),\n});\n"],"mappings":";;;AAoCA,MAAa,0BAA0B,OAA2B,CAAC,MAA0B;CAC3F,MAAM,MAA0B,CAAC;CACjC,KAAK,MAAM,KAAK;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,GACE,IAAI,KAAK,OAAO,KAAA,GAAW,IAAI,KAAK,KAAK;CAE3C,IAAI,KAAK,sBAAsB,KAAA,GAAW,IAAI,oBAAoB,KAAK;CACvE,IAAI,KAAK,uBAAuB,KAAA,GAAW,IAAI,qBAAqB,KAAK;CACzE,IAAI,KAAK,kBAAkB,KAAA,GAAW,IAAI,gBAAgB,KAAK;CAC/D,IAAI,KAAK,gBAAgB,KAAA,GAAW,IAAI,cAAc,KAAK;CAC3D,IAAI,KAAK,iBAAiB,KAAA,GAAW,IAAI,eAAe,KAAK;CAC7D,OAAO;AACT;;;ACrBA,MAAa,oBAAoB,OAAqB,CAAC,OAAqB,EAAE,GAAG,KAAK;AAmCtF,MAAa,0BACX,UAEwB,EAAE,GAAG,KAAK;;;AC1CpC,MAAa,sBAAsB,OAAuB,CAAC,OAAuB,EAAE,GAAG,KAAK;;;ACU5F,MAAa,0BAA0B,OAA2B,CAAC,OAA2B,EAAE,GAAG,KAAK;;;ACxBxG,MAAa,mBAAmB,OAAoB,CAAC,OAAoB,EAAE,GAAG,KAAK;;;ACCnF,MAAa,mBAAmB,OAAoB,CAAC,OAAoB,EAAE,GAAG,KAAK;;;ACHnF,MAAa,8BACX,OAA+B,CAAC,OACJ,EAAE,GAAG,KAAK;;;ACAxC,MAAa,0BAA0B,OAA2B,CAAC,OAA2B,EAAE,GAAG,KAAK;AAExG,MAAa,oBAAoB,OAAqB,CAAC,OAAqB,EAAE,GAAG,KAAK;;;ACJtF,MAAa,qBAAqB,UAAiC,EAAE,KAAK;AAE1E,MAAa,sBAAsB,OAAgC,CAAC,OAAuB;CACzF,QAAQ,KAAK,QAAQ,MAAM,KAAK,CAAC;CACjC,GAAI,KAAK,sBAAsB,KAAA,IAAY,EAAE,mBAAmB,KAAK,kBAAkB,IAAI,CAAC;AAC9F"}
|
|
@@ -20,7 +20,7 @@ export declare function makeFilterColumn(opts: {
|
|
|
20
20
|
values: ReadonlyArray<string>;
|
|
21
21
|
blank?: boolean;
|
|
22
22
|
}): FilterColumn;
|
|
23
|
-
import type { Worksheet } from './worksheet';
|
|
23
|
+
import type { Worksheet } from './worksheet.js';
|
|
24
24
|
/** Add an AutoFilter dropdown header strip to the given range. */
|
|
25
25
|
export declare const addAutoFilter: (ws: Worksheet, ref: string) => AutoFilter;
|
|
26
26
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Cell } from '../cell/cell';
|
|
2
|
-
import { type CellRangeBoundaries } from '../utils/coordinate';
|
|
1
|
+
import type { Cell } from '../cell/cell.js';
|
|
2
|
+
import { type CellRangeBoundaries } from '../utils/coordinate.js';
|
|
3
3
|
/** Re-export under the plan's canonical name. */
|
|
4
4
|
export type CellRange = CellRangeBoundaries;
|
|
5
5
|
/** Build a CellRange from explicit 1-based bounds. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LegacyComment } from './comments';
|
|
1
|
+
import type { LegacyComment } from './comments.js';
|
|
2
2
|
/** Parse a `xl/commentsN.xml` payload into a flat LegacyComment list. */
|
|
3
3
|
export declare function parseCommentsXml(bytes: Uint8Array | string): LegacyComment[];
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type MultiCellRange } from './cell-range';
|
|
1
|
+
import { type MultiCellRange } from './cell-range.js';
|
|
2
2
|
export type ConditionalFormattingRuleType = 'expression' | 'cellIs' | 'colorScale' | 'dataBar' | 'iconSet' | 'top10' | 'aboveAverage' | 'uniqueValues' | 'duplicateValues' | 'containsText' | 'notContainsText' | 'beginsWith' | 'endsWith' | 'containsBlanks' | 'notContainsBlanks' | 'containsErrors' | 'notContainsErrors' | 'timePeriod';
|
|
3
3
|
export type CellIsOperator = 'lessThan' | 'lessThanOrEqual' | 'equal' | 'notEqual' | 'greaterThanOrEqual' | 'greaterThan' | 'between' | 'notBetween';
|
|
4
4
|
export type TextOperator = 'containsText' | 'notContains' | 'beginsWith' | 'endsWith';
|
|
@@ -53,7 +53,7 @@ export declare function makeCfRule(opts: Partial<ConditionalFormattingRule> & {
|
|
|
53
53
|
type: ConditionalFormattingRuleType;
|
|
54
54
|
priority: number;
|
|
55
55
|
}): ConditionalFormattingRule;
|
|
56
|
-
import type { Worksheet } from './worksheet';
|
|
56
|
+
import type { Worksheet } from './worksheet.js';
|
|
57
57
|
/**
|
|
58
58
|
* "If cell value [op] formula → apply dxf". Mirrors Excel's "Highlight Cell
|
|
59
59
|
* Rules → ..." UI.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HeaderFooter, PageBreak, PageMargins, PageSetup, PrintOptions } from './page-setup';
|
|
2
|
-
import type { Pane, Selection, SheetViewMode } from './views';
|
|
1
|
+
import type { HeaderFooter, PageBreak, PageMargins, PageSetup, PrintOptions } from './page-setup.js';
|
|
2
|
+
import type { Pane, Selection, SheetViewMode } from './views.js';
|
|
3
3
|
export type CustomSheetViewState = 'visible' | 'hidden' | 'veryHidden';
|
|
4
4
|
export interface CustomSheetView {
|
|
5
5
|
guid: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type MultiCellRange } from './cell-range';
|
|
1
|
+
import { type MultiCellRange } from './cell-range.js';
|
|
2
2
|
export type DataValidationType = 'whole' | 'decimal' | 'list' | 'date' | 'time' | 'textLength' | 'custom';
|
|
3
3
|
export type DataValidationOperator = 'between' | 'notBetween' | 'equal' | 'notEqual' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual';
|
|
4
4
|
export type DataValidationErrorStyle = 'stop' | 'warning' | 'information';
|
|
@@ -31,7 +31,7 @@ export declare function makeDataValidation(opts: Omit<Partial<DataValidation>, '
|
|
|
31
31
|
type: DataValidationType;
|
|
32
32
|
sqref: MultiCellRange | string;
|
|
33
33
|
}): DataValidation;
|
|
34
|
-
import type { Worksheet } from './worksheet';
|
|
34
|
+
import type { Worksheet } from './worksheet.js';
|
|
35
35
|
export interface ValidationCommon {
|
|
36
36
|
/** Show the dropdown / input prompt when the cell is selected. */
|
|
37
37
|
prompt?: string;
|
|
@@ -20,7 +20,7 @@ export interface Hyperlink {
|
|
|
20
20
|
export declare function makeHyperlink(opts: Partial<Hyperlink> & {
|
|
21
21
|
ref: string;
|
|
22
22
|
}): Hyperlink;
|
|
23
|
-
import type { Worksheet } from './worksheet';
|
|
23
|
+
import type { Worksheet } from './worksheet.js';
|
|
24
24
|
/**
|
|
25
25
|
* Add an external URL hyperlink to a cell or range. The URL goes into the
|
|
26
26
|
* worksheet rels as a hyperlink relationship; the writer generates an rId on
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
export type { CellsByKindCounts, IterRowsOptions, Worksheet, } from './worksheet';
|
|
2
|
-
export { addCellWatch, addConditionalFormatting, addDataValidation, addIgnoredError, addTable, appendRow, appendRows, applyToRange, autofitColumns, clearAllCells, clearRange, collapseColumnGroup, collapseRowGroup, copyRange, countCells, countCellsByKind, deleteCell, expandColumnGroup, expandRowGroup, findCells, freezePanes, getAutoFilter, getCell, getCellByCoord, getCellsInColumn, getCellsInRange, getCellsInRow, getColumnDimension, getDataExtent, getFreezePanes, getMaxCol, getMaxRow, getMergedCells, getMergedRangeAt, getNonEmptyCellCount, getPopulatedColumnIndices, getPopulatedRowIndices, getRangeValues, getRowDimension, getTable, groupColumns, groupRows, hideColumn, hideColumns, hideRow, hideRows, isMergedCell, isWorksheetEmpty, iterCells, iterRows, iterValues, listComments, listDataValidations, listHyperlinks, listTables, makeWorksheet, mergeCells, moveRange, removeAllComments, removeAllConditionalFormatting, removeAllDataValidations, removeAllHyperlinks, removeAllMergedRanges, removeAllTables, removeCellWatches, removeDataValidations, removeHyperlink, removeIgnoredErrors, removeTable, setAutoFilter, setCell, setCellByCoord, setColumnDimension, setColumnWidth, setColumnWidths, setComment, setDefaultColumnWidth, setDefaultRowHeight, setFreezePanes, setHyperlink, setRangeValues, setRowDimension, setRowHeight, setRowHeights, setSheetTabColor, setSheetViewMode, setSheetZoom, ungroupColumns, ungroupRows, unhideColumn, unhideColumns, unhideRow, unhideRows, unmergeCells, unmergeCellsAt, writeRange, } from './worksheet';
|
|
3
|
-
export type { MultiCellRange } from './cell-range';
|
|
4
|
-
export { expandRangeStr, intersectionRange, isCellInRange, isRangeInRange, rangeArea, rangeContainsCell, rangeContainsRange, rangesOverlap, shiftRange, unionRange, } from './cell-range';
|
|
5
|
-
export type { ColumnDimension, RowDimension } from './dimensions';
|
|
6
|
-
export { makeColumnDimension, makeRowDimension } from './dimensions';
|
|
7
|
-
export type { Pane, PaneState, PaneType, Selection, SheetView, SheetViewMode, } from './views';
|
|
8
|
-
export { freezePaneRef, makeFreezePane, makeSheetView } from './views';
|
|
9
|
-
export type { LegacyComment } from './comments';
|
|
10
|
-
export { makeLegacyComment } from './comments';
|
|
11
|
-
export type { DataValidation, DataValidationErrorStyle, DataValidationOperator, DataValidationType, ValidationCommon, } from './data-validations';
|
|
12
|
-
export { makeDataValidation } from './data-validations';
|
|
13
|
-
export type { CellIsOperator, Cfvo, CfvoType, ConditionalFormatting, ConditionalFormattingRule, ConditionalFormattingRuleType, IconSetStyle, TextOperator, TimePeriod, } from './conditional-formatting';
|
|
14
|
-
export { makeCfRule, makeConditionalFormatting } from './conditional-formatting';
|
|
15
|
-
export type { Hyperlink } from './hyperlinks';
|
|
16
|
-
export { makeHyperlink } from './hyperlinks';
|
|
17
|
-
export type { AutoFilter, FilterColumn } from './auto-filter';
|
|
18
|
-
export { makeAutoFilter, makeFilterColumn } from './auto-filter';
|
|
19
|
-
export type { TableColumn, TableDefinition, TableStyleInfo } from './table';
|
|
20
|
-
export { addExcelTable, makeTableColumn, makeTableDefinition } from './table';
|
|
21
|
-
export type { CellWatch, IgnoredError } from './errors';
|
|
22
|
-
export { makeCellWatch, makeIgnoredError } from './errors';
|
|
23
|
-
export type { OutlineProperties, PageSetupProperties, SheetProperties } from './properties';
|
|
24
|
-
export { makeSheetProperties } from './properties';
|
|
25
|
-
export type { SheetProtection } from './protection';
|
|
26
|
-
export { makeSheetProtection } from './protection';
|
|
27
|
-
export type { ProtectedRange } from './protected-ranges';
|
|
28
|
-
export { makeProtectedRange } from './protected-ranges';
|
|
29
|
-
export type { SortBy, SortCondition, SortIconSet, SortMethod, SortState, } from './sort-state';
|
|
30
|
-
export { makeSortCondition, makeSortState } from './sort-state';
|
|
31
|
-
export type { CellSmartTag, CellSmartTagProperty, CellSmartTags, } from './smart-tags';
|
|
32
|
-
export { makeCellSmartTag, makeCellSmartTagProperty, makeCellSmartTags, } from './smart-tags';
|
|
33
|
-
export type { FormControl, OleDvAspect, OleObject, OleUpdateMode, } from './ole-objects';
|
|
34
|
-
export { makeFormControl, makeOleObject } from './ole-objects';
|
|
35
|
-
export type { CustomSheetView, CustomSheetViewState } from './custom-sheet-views';
|
|
36
|
-
export { makeCustomSheetView } from './custom-sheet-views';
|
|
37
|
-
export type { CellCommentMode, HeaderFooter, HeaderFooterSection, PageBreak, PageMargins, PageOrder, PageOrientation, PageSetup, PrintErrorMode, PrintOptions, } from './page-setup';
|
|
38
|
-
export { buildHeaderFooterText, HEADER_FOOTER_CODES, makeHeaderFooter, makePageBreak, makePageMargins, makePageSetup, makePrintOptions, } from './page-setup';
|
|
39
|
-
export type { WebPublishItem, WorksheetCustomProperty } from './web-publish';
|
|
40
|
-
export { makeWebPublishItem, makeWorksheetCustomProperty } from './web-publish';
|
|
41
|
-
export type { PhoneticAlignment, PhoneticType, WorksheetPhoneticProperties, } from './phonetic';
|
|
42
|
-
export { makeWorksheetPhoneticProperties } from './phonetic';
|
|
43
|
-
export type { DataConsolidate, DataConsolidateFunction, DataReference, } from './data-consolidate';
|
|
44
|
-
export { makeDataConsolidate } from './data-consolidate';
|
|
45
|
-
export type { Scenario, ScenarioInputCell, ScenarioList } from './scenarios';
|
|
46
|
-
export { makeScenario, makeScenarioInputCell, makeScenarioList } from './scenarios';
|
|
1
|
+
export type { CellsByKindCounts, IterRowsOptions, Worksheet, } from './worksheet.js';
|
|
2
|
+
export { addCellWatch, addConditionalFormatting, addDataValidation, addIgnoredError, addTable, appendRow, appendRows, applyToRange, autofitColumns, clearAllCells, clearRange, collapseColumnGroup, collapseRowGroup, copyRange, countCells, countCellsByKind, deleteCell, expandColumnGroup, expandRowGroup, findCells, freezePanes, getAutoFilter, getCell, getCellByCoord, getCellsInColumn, getCellsInRange, getCellsInRow, getColumnDimension, getDataExtent, getFreezePanes, getMaxCol, getMaxRow, getMergedCells, getMergedRangeAt, getNonEmptyCellCount, getPopulatedColumnIndices, getPopulatedRowIndices, getRangeValues, getRowDimension, getTable, groupColumns, groupRows, hideColumn, hideColumns, hideRow, hideRows, isMergedCell, isWorksheetEmpty, iterCells, iterRows, iterValues, listComments, listDataValidations, listHyperlinks, listTables, makeWorksheet, mergeCells, moveRange, removeAllComments, removeAllConditionalFormatting, removeAllDataValidations, removeAllHyperlinks, removeAllMergedRanges, removeAllTables, removeCellWatches, removeDataValidations, removeHyperlink, removeIgnoredErrors, removeTable, setAutoFilter, setCell, setCellByCoord, setColumnDimension, setColumnWidth, setColumnWidths, setComment, setDefaultColumnWidth, setDefaultRowHeight, setFreezePanes, setHyperlink, setRangeValues, setRowDimension, setRowHeight, setRowHeights, setSheetTabColor, setSheetViewMode, setSheetZoom, ungroupColumns, ungroupRows, unhideColumn, unhideColumns, unhideRow, unhideRows, unmergeCells, unmergeCellsAt, writeRange, } from './worksheet.js';
|
|
3
|
+
export type { MultiCellRange } from './cell-range.js';
|
|
4
|
+
export { expandRangeStr, intersectionRange, isCellInRange, isRangeInRange, rangeArea, rangeContainsCell, rangeContainsRange, rangesOverlap, shiftRange, unionRange, } from './cell-range.js';
|
|
5
|
+
export type { ColumnDimension, RowDimension } from './dimensions.js';
|
|
6
|
+
export { makeColumnDimension, makeRowDimension } from './dimensions.js';
|
|
7
|
+
export type { Pane, PaneState, PaneType, Selection, SheetView, SheetViewMode, } from './views.js';
|
|
8
|
+
export { freezePaneRef, makeFreezePane, makeSheetView } from './views.js';
|
|
9
|
+
export type { LegacyComment } from './comments.js';
|
|
10
|
+
export { makeLegacyComment } from './comments.js';
|
|
11
|
+
export type { DataValidation, DataValidationErrorStyle, DataValidationOperator, DataValidationType, ValidationCommon, } from './data-validations.js';
|
|
12
|
+
export { makeDataValidation } from './data-validations.js';
|
|
13
|
+
export type { CellIsOperator, Cfvo, CfvoType, ConditionalFormatting, ConditionalFormattingRule, ConditionalFormattingRuleType, IconSetStyle, TextOperator, TimePeriod, } from './conditional-formatting.js';
|
|
14
|
+
export { makeCfRule, makeConditionalFormatting } from './conditional-formatting.js';
|
|
15
|
+
export type { Hyperlink } from './hyperlinks.js';
|
|
16
|
+
export { makeHyperlink } from './hyperlinks.js';
|
|
17
|
+
export type { AutoFilter, FilterColumn } from './auto-filter.js';
|
|
18
|
+
export { makeAutoFilter, makeFilterColumn } from './auto-filter.js';
|
|
19
|
+
export type { TableColumn, TableDefinition, TableStyleInfo } from './table.js';
|
|
20
|
+
export { addExcelTable, makeTableColumn, makeTableDefinition } from './table.js';
|
|
21
|
+
export type { CellWatch, IgnoredError } from './errors.js';
|
|
22
|
+
export { makeCellWatch, makeIgnoredError } from './errors.js';
|
|
23
|
+
export type { OutlineProperties, PageSetupProperties, SheetProperties } from './properties.js';
|
|
24
|
+
export { makeSheetProperties } from './properties.js';
|
|
25
|
+
export type { SheetProtection } from './protection.js';
|
|
26
|
+
export { makeSheetProtection } from './protection.js';
|
|
27
|
+
export type { ProtectedRange } from './protected-ranges.js';
|
|
28
|
+
export { makeProtectedRange } from './protected-ranges.js';
|
|
29
|
+
export type { SortBy, SortCondition, SortIconSet, SortMethod, SortState, } from './sort-state.js';
|
|
30
|
+
export { makeSortCondition, makeSortState } from './sort-state.js';
|
|
31
|
+
export type { CellSmartTag, CellSmartTagProperty, CellSmartTags, } from './smart-tags.js';
|
|
32
|
+
export { makeCellSmartTag, makeCellSmartTagProperty, makeCellSmartTags, } from './smart-tags.js';
|
|
33
|
+
export type { FormControl, OleDvAspect, OleObject, OleUpdateMode, } from './ole-objects.js';
|
|
34
|
+
export { makeFormControl, makeOleObject } from './ole-objects.js';
|
|
35
|
+
export type { CustomSheetView, CustomSheetViewState } from './custom-sheet-views.js';
|
|
36
|
+
export { makeCustomSheetView } from './custom-sheet-views.js';
|
|
37
|
+
export type { CellCommentMode, HeaderFooter, HeaderFooterSection, PageBreak, PageMargins, PageOrder, PageOrientation, PageSetup, PrintErrorMode, PrintOptions, } from './page-setup.js';
|
|
38
|
+
export { buildHeaderFooterText, HEADER_FOOTER_CODES, makeHeaderFooter, makePageBreak, makePageMargins, makePageSetup, makePrintOptions, } from './page-setup.js';
|
|
39
|
+
export type { WebPublishItem, WorksheetCustomProperty } from './web-publish.js';
|
|
40
|
+
export { makeWebPublishItem, makeWorksheetCustomProperty } from './web-publish.js';
|
|
41
|
+
export type { PhoneticAlignment, PhoneticType, WorksheetPhoneticProperties, } from './phonetic.js';
|
|
42
|
+
export { makeWorksheetPhoneticProperties } from './phonetic.js';
|
|
43
|
+
export type { DataConsolidate, DataConsolidateFunction, DataReference, } from './data-consolidate.js';
|
|
44
|
+
export { makeDataConsolidate } from './data-consolidate.js';
|
|
45
|
+
export type { Scenario, ScenarioInputCell, ScenarioList } from './scenarios.js';
|
|
46
|
+
export { makeScenario, makeScenarioInputCell, makeScenarioList } from './scenarios.js';
|
|
@@ -85,7 +85,7 @@ export interface PageBreak {
|
|
|
85
85
|
pt?: boolean;
|
|
86
86
|
}
|
|
87
87
|
export declare const makePageBreak: (opts?: PageBreak) => PageBreak;
|
|
88
|
-
import type { Worksheet } from './worksheet';
|
|
88
|
+
import type { Worksheet } from './worksheet.js';
|
|
89
89
|
/** Set page orientation on `ws.pageSetup` (allocates if missing). */
|
|
90
90
|
export declare const setPageOrientation: (ws: Worksheet, orientation: PageOrientation) => void;
|
|
91
91
|
/** Set paper size code (Excel uses ECMA-376 §3.3 paper-size enums; 1=Letter, 9=A4 etc.). */
|
|
@@ -28,7 +28,7 @@ export interface SheetProtection {
|
|
|
28
28
|
hashValue?: string;
|
|
29
29
|
}
|
|
30
30
|
export declare const makeSheetProtection: (opts?: SheetProtection) => SheetProtection;
|
|
31
|
-
import type { Worksheet } from './worksheet';
|
|
31
|
+
import type { Worksheet } from './worksheet.js';
|
|
32
32
|
/**
|
|
33
33
|
* Lock a worksheet with Excel's "Protect Sheet" defaults. Pass `overrides` to
|
|
34
34
|
* allow specific actions while otherwise locked (e.g. `{ sort: true,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Drawing } from '../drawing/drawing';
|
|
2
|
-
import type { Relationships } from '../packaging/relationships';
|
|
3
|
-
import { type XmlNode } from '../xml/tree';
|
|
4
|
-
import { type SharedStringEntry } from '../workbook/shared-strings';
|
|
5
|
-
import type { LegacyComment } from './comments';
|
|
6
|
-
import type { HeaderFooter, PageMargins, PageSetup } from './page-setup';
|
|
7
|
-
import type { WebPublishItem } from './web-publish';
|
|
8
|
-
import type { TableDefinition } from './table';
|
|
9
|
-
import { type Worksheet } from './worksheet';
|
|
1
|
+
import type { Drawing } from '../drawing/drawing.js';
|
|
2
|
+
import type { Relationships } from '../packaging/relationships.js';
|
|
3
|
+
import { type XmlNode } from '../xml/tree.js';
|
|
4
|
+
import { type SharedStringEntry } from '../workbook/shared-strings.js';
|
|
5
|
+
import type { LegacyComment } from './comments.js';
|
|
6
|
+
import type { HeaderFooter, PageMargins, PageSetup } from './page-setup.js';
|
|
7
|
+
import type { WebPublishItem } from './web-publish.js';
|
|
8
|
+
import type { TableDefinition } from './table.js';
|
|
9
|
+
import { type Worksheet } from './worksheet.js';
|
|
10
10
|
/** Inputs the worksheet reader needs from the surrounding workbook context. */
|
|
11
11
|
export interface WorksheetReadContext {
|
|
12
12
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TableDefinition } from './table';
|
|
1
|
+
import type { TableDefinition } from './table.js';
|
|
2
2
|
/** Parse a `xl/tables/tableN.xml` payload. */
|
|
3
3
|
export declare function parseTableXml(bytes: Uint8Array | string): TableDefinition;
|
|
4
4
|
/** Serialise a TableDefinition to its `xl/tables/tableN.xml` bytes. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Workbook } from '../workbook/workbook';
|
|
2
|
-
import type { AutoFilter } from './auto-filter';
|
|
3
|
-
import type { Worksheet } from './worksheet';
|
|
1
|
+
import type { Workbook } from '../workbook/workbook.js';
|
|
2
|
+
import type { AutoFilter } from './auto-filter.js';
|
|
3
|
+
import type { Worksheet } from './worksheet.js';
|
|
4
4
|
export interface TableColumn {
|
|
5
5
|
/** 1-based column id (per-table). */
|
|
6
6
|
id: number;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import type { CellValue } from '../cell/cell';
|
|
2
|
-
import { type Cell } from '../cell/cell';
|
|
3
|
-
import { type InlineFont, type TextRun } from '../cell/rich-text';
|
|
4
|
-
import type { Drawing } from '../drawing/drawing';
|
|
5
|
-
import { type Color } from '../styles/colors';
|
|
6
|
-
import type { AutoFilter } from './auto-filter';
|
|
7
|
-
import { type CellRange } from './cell-range';
|
|
8
|
-
import type { LegacyComment } from './comments';
|
|
9
|
-
import type { ConditionalFormatting } from './conditional-formatting';
|
|
10
|
-
import type { DataValidation } from './data-validations';
|
|
11
|
-
import { type ColumnDimension, type RowDimension } from './dimensions';
|
|
12
|
-
import type { DataConsolidate } from './data-consolidate';
|
|
13
|
-
import type { ScenarioList } from './scenarios';
|
|
14
|
-
import type { CellWatch, IgnoredError } from './errors';
|
|
15
|
-
import type { HeaderFooter, PageBreak, PageMargins, PageSetup, PrintOptions } from './page-setup';
|
|
16
|
-
import type { WorksheetPhoneticProperties } from './phonetic';
|
|
17
|
-
import { type SheetProperties } from './properties';
|
|
18
|
-
import type { SheetProtection } from './protection';
|
|
19
|
-
import type { ProtectedRange } from './protected-ranges';
|
|
20
|
-
import type { SortState } from './sort-state';
|
|
21
|
-
import type { WebPublishItem, WorksheetCustomProperty } from './web-publish';
|
|
22
|
-
import { type Hyperlink } from './hyperlinks';
|
|
23
|
-
import type { TableDefinition } from './table';
|
|
24
|
-
import { type SheetView } from './views';
|
|
1
|
+
import type { CellValue } from '../cell/cell.js';
|
|
2
|
+
import { type Cell } from '../cell/cell.js';
|
|
3
|
+
import { type InlineFont, type TextRun } from '../cell/rich-text.js';
|
|
4
|
+
import type { Drawing } from '../drawing/drawing.js';
|
|
5
|
+
import { type Color } from '../styles/colors.js';
|
|
6
|
+
import type { AutoFilter } from './auto-filter.js';
|
|
7
|
+
import { type CellRange } from './cell-range.js';
|
|
8
|
+
import type { LegacyComment } from './comments.js';
|
|
9
|
+
import type { ConditionalFormatting } from './conditional-formatting.js';
|
|
10
|
+
import type { DataValidation } from './data-validations.js';
|
|
11
|
+
import { type ColumnDimension, type RowDimension } from './dimensions.js';
|
|
12
|
+
import type { DataConsolidate } from './data-consolidate.js';
|
|
13
|
+
import type { ScenarioList } from './scenarios.js';
|
|
14
|
+
import type { CellWatch, IgnoredError } from './errors.js';
|
|
15
|
+
import type { HeaderFooter, PageBreak, PageMargins, PageSetup, PrintOptions } from './page-setup.js';
|
|
16
|
+
import type { WorksheetPhoneticProperties } from './phonetic.js';
|
|
17
|
+
import { type SheetProperties } from './properties.js';
|
|
18
|
+
import type { SheetProtection } from './protection.js';
|
|
19
|
+
import type { ProtectedRange } from './protected-ranges.js';
|
|
20
|
+
import type { SortState } from './sort-state.js';
|
|
21
|
+
import type { WebPublishItem, WorksheetCustomProperty } from './web-publish.js';
|
|
22
|
+
import { type Hyperlink } from './hyperlinks.js';
|
|
23
|
+
import type { TableDefinition } from './table.js';
|
|
24
|
+
import { type SheetView } from './views.js';
|
|
25
25
|
export interface Worksheet {
|
|
26
26
|
title: string;
|
|
27
27
|
/** Sparse store: row index → (col index → Cell). */
|
|
@@ -134,24 +134,24 @@ export interface Worksheet {
|
|
|
134
134
|
* `<smartTags>` — per-cell smart-tag annotations (Excel 2003 era). Pairs with
|
|
135
135
|
* the workbook-level smartTagTypes registry.
|
|
136
136
|
*/
|
|
137
|
-
smartTags: import('./smart-tags').CellSmartTags[];
|
|
137
|
+
smartTags: import('./smart-tags.js').CellSmartTags[];
|
|
138
138
|
/**
|
|
139
139
|
* `<customSheetViews>` — saved per-user view presets for this worksheet
|
|
140
140
|
* (Excel's "Custom Views" feature). Each entry snapshots zoom / gridline /
|
|
141
141
|
* formula / heading toggles plus its own page-setup block and break list.
|
|
142
142
|
*/
|
|
143
|
-
customSheetViews: import('./custom-sheet-views').CustomSheetView[];
|
|
143
|
+
customSheetViews: import('./custom-sheet-views.js').CustomSheetView[];
|
|
144
144
|
/**
|
|
145
145
|
* `<oleObjects>` — embedded OLE objects (linked Word documents, Equation
|
|
146
146
|
* editor formulas, etc.). The objectPr child is round-tripped verbatim as an
|
|
147
147
|
* XmlNode.
|
|
148
148
|
*/
|
|
149
|
-
oleObjects: import('./ole-objects').OleObject[];
|
|
149
|
+
oleObjects: import('./ole-objects.js').OleObject[];
|
|
150
150
|
/**
|
|
151
151
|
* `<controls>` — form controls (checkboxes / list boxes / spin buttons placed
|
|
152
152
|
* via the Developer tab). The controlPr child is round-tripped verbatim.
|
|
153
153
|
*/
|
|
154
|
-
controls: import('./ole-objects').FormControl[];
|
|
154
|
+
controls: import('./ole-objects.js').FormControl[];
|
|
155
155
|
/** `<printOptions>` — gridlines, headings, horizontal/vertical centering on the printed page. */
|
|
156
156
|
printOptions?: PrintOptions;
|
|
157
157
|
/** `<pageMargins>` — six required margins in inches. */
|
|
@@ -223,8 +223,8 @@ export interface Worksheet {
|
|
|
223
223
|
* openpyxl-emitted files round-trip cleanly.
|
|
224
224
|
*/
|
|
225
225
|
bodyExtras?: {
|
|
226
|
-
beforeSheetData: import('../xml/tree').XmlNode[];
|
|
227
|
-
afterSheetData: import('../xml/tree').XmlNode[];
|
|
226
|
+
beforeSheetData: import('../xml/tree.js').XmlNode[];
|
|
227
|
+
afterSheetData: import('../xml/tree.js').XmlNode[];
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
/** Build a Worksheet shell. */
|
|
@@ -371,7 +371,7 @@ export interface CellsByKindCounts {
|
|
|
371
371
|
* Shared between {@link countCellsByKind} and the workbook-wide overview so
|
|
372
372
|
* the two never drift in how they classify (e.g. `Date` vs `duration`).
|
|
373
373
|
*/
|
|
374
|
-
export declare function classifyCellValue(v: import('../cell/cell').CellValue): keyof CellsByKindCounts;
|
|
374
|
+
export declare function classifyCellValue(v: import('../cell/cell.js').CellValue): keyof CellsByKindCounts;
|
|
375
375
|
export declare function countCellsByKind(ws: Worksheet): CellsByKindCounts;
|
|
376
376
|
/**
|
|
377
377
|
* Sheet-qualified A1 address for a cell — `'Sheet1!A1'` for plain titles,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type Cell } from '../cell/cell';
|
|
2
|
-
import type { Relationships } from '../packaging/relationships';
|
|
3
|
-
import type { SharedStringsTable } from '../workbook/shared-strings';
|
|
4
|
-
import type { HeaderFooter, PageMargins, PageSetup } from './page-setup';
|
|
5
|
-
import type { WebPublishItem } from './web-publish';
|
|
6
|
-
import type { Worksheet } from './worksheet';
|
|
1
|
+
import { type Cell } from '../cell/cell.js';
|
|
2
|
+
import type { Relationships } from '../packaging/relationships.js';
|
|
3
|
+
import type { SharedStringsTable } from '../workbook/shared-strings.js';
|
|
4
|
+
import type { HeaderFooter, PageMargins, PageSetup } from './page-setup.js';
|
|
5
|
+
import type { WebPublishItem } from './web-publish.js';
|
|
6
|
+
import type { Worksheet } from './worksheet.js';
|
|
7
7
|
export interface WorksheetWriteContext {
|
|
8
8
|
/** Accumulator the writer mutates as it emits string cells. */
|
|
9
9
|
sharedStrings: SharedStringsTable;
|
|
@@ -26,7 +26,7 @@ export interface WorksheetWriteContext {
|
|
|
26
26
|
* ("../tables/tableN.xml") + the worksheet-rels rId. Called once per
|
|
27
27
|
* `ws.tables` entry while serialising.
|
|
28
28
|
*/
|
|
29
|
-
registerTable?: (table: import('./table').TableDefinition) => {
|
|
29
|
+
registerTable?: (table: import('./table.js').TableDefinition) => {
|
|
30
30
|
rId: string;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
@@ -36,7 +36,7 @@ export interface WorksheetWriteContext {
|
|
|
36
36
|
* `<legacyDrawing r:id>`. Called once per worksheet that carries any
|
|
37
37
|
* comments.
|
|
38
38
|
*/
|
|
39
|
-
registerComments?: (comments: ReadonlyArray<import('./comments').LegacyComment>) => {
|
|
39
|
+
registerComments?: (comments: ReadonlyArray<import('./comments.js').LegacyComment>) => {
|
|
40
40
|
vmlRelId: string;
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
@@ -45,7 +45,7 @@ export interface WorksheetWriteContext {
|
|
|
45
45
|
* worksheet rels, and returns the worksheet-rels rId — splatted into
|
|
46
46
|
* `<drawing r:id>` by the writer. Called once when ws.drawing is set.
|
|
47
47
|
*/
|
|
48
|
-
registerDrawing?: (drawing: import('../drawing/drawing').Drawing) => {
|
|
48
|
+
registerDrawing?: (drawing: import('../drawing/drawing.js').Drawing) => {
|
|
49
49
|
rId: string;
|
|
50
50
|
};
|
|
51
51
|
}
|