@evotecit/officeimo 0.1.3 → 0.1.5
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 +20 -4
- package/bundles/officeimo-canopyx.js +726 -274
- package/bundles/officeimo-canopyx.mjs +684 -236
- package/bundles/officeimo-datatables.js +309 -233
- package/bundles/officeimo-datatables.mjs +280 -205
- package/bundles/officeimo-xlsx.js +177 -101
- package/bundles/officeimo-xlsx.mjs +149 -74
- package/bundles/officeimo.js +308 -232
- package/bundles/officeimo.mjs +279 -204
- package/dist/integrations/canopyx/grouping.js +15 -5
- package/dist/integrations/canopyx/index.d.ts +1 -1
- package/dist/integrations/canopyx/index.js +23 -6
- package/dist/integrations/canopyx/pdf-layout.d.ts +5 -0
- package/dist/integrations/canopyx/pdf-layout.js +97 -0
- package/dist/integrations/canopyx/pdf-number.d.ts +3 -0
- package/dist/integrations/canopyx/pdf-number.js +117 -0
- package/dist/integrations/canopyx/pivot.d.ts +15 -0
- package/dist/integrations/canopyx/pivot.js +71 -0
- package/dist/integrations/canopyx/source.js +50 -14
- package/dist/integrations/canopyx/types.d.ts +46 -2
- package/dist/opc/index.js +9 -0
- package/dist/xlsx/index.d.ts +1 -1
- package/dist/xlsx/options.js +1 -1
- package/dist/xlsx/outlines.d.ts +3 -0
- package/dist/xlsx/outlines.js +39 -0
- package/dist/xlsx/types.d.ts +9 -0
- package/dist/xlsx/values.js +11 -2
- package/dist/xlsx/workbook.js +2 -0
- package/dist/xlsx/worksheet.js +14 -6
- package/package.json +2 -2
|
@@ -7,6 +7,10 @@ import type { PdfOptions, GroupedPdfOptions } from "../../pdf/index.js";
|
|
|
7
7
|
export interface CanopyExportCell {
|
|
8
8
|
readonly value: string | number | boolean | null;
|
|
9
9
|
readonly text: string;
|
|
10
|
+
/** Frozen pivot display semantics; values are already computed by CanopyX. */
|
|
11
|
+
readonly mode?: "value" | "percentGrandTotal" | "percentParent" | "percentColumn" | "percentRow" | "runningTotal" | "rank" | "difference" | "percentChange";
|
|
12
|
+
/** Native format; optional for mode=value, whose unformatted integer values stay whole in PDF. */
|
|
13
|
+
readonly numberFormat?: string;
|
|
10
14
|
readonly tone?: string;
|
|
11
15
|
readonly link?: ExportLink;
|
|
12
16
|
readonly diagnostics?: readonly string[];
|
|
@@ -18,7 +22,7 @@ export interface CanopyNumberFormat {
|
|
|
18
22
|
readonly prefix?: string;
|
|
19
23
|
readonly suffix?: string;
|
|
20
24
|
}
|
|
21
|
-
export interface CanopyExportColumn {
|
|
25
|
+
export interface CanopyExportColumn extends Partial<CanopyPivotAxisPresentation> {
|
|
22
26
|
readonly id: string;
|
|
23
27
|
readonly title: string;
|
|
24
28
|
readonly kind: "text" | "number" | "datetime";
|
|
@@ -34,12 +38,50 @@ export interface CanopyExportColumn {
|
|
|
34
38
|
readonly alignment?: "left" | "right";
|
|
35
39
|
readonly diagnostics?: readonly string[];
|
|
36
40
|
}
|
|
37
|
-
export interface CanopyExportRow {
|
|
41
|
+
export interface CanopyExportRow extends Partial<CanopyPivotAxisPresentation> {
|
|
38
42
|
readonly id: string;
|
|
39
43
|
readonly cells: Readonly<Record<string, CanopyExportCell>>;
|
|
40
44
|
readonly tone?: string;
|
|
41
45
|
readonly diagnostics?: readonly string[];
|
|
42
46
|
}
|
|
47
|
+
/** Opaque accepted-axis identity and frozen presentation; titles never determine identity. */
|
|
48
|
+
export interface CanopyPivotAxisPresentation {
|
|
49
|
+
readonly axisKey: string;
|
|
50
|
+
readonly outlineLevel: number;
|
|
51
|
+
readonly summary: boolean;
|
|
52
|
+
readonly grandTotal: boolean;
|
|
53
|
+
readonly collapsed: boolean;
|
|
54
|
+
readonly hidden: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface CanopyPivotAxis {
|
|
57
|
+
readonly key: string;
|
|
58
|
+
readonly parent?: string;
|
|
59
|
+
readonly path: readonly (string | number | boolean | null)[];
|
|
60
|
+
readonly other: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface CanopyPivotColumnGroup {
|
|
63
|
+
readonly key: string;
|
|
64
|
+
readonly parent?: string;
|
|
65
|
+
readonly firstColumn: number;
|
|
66
|
+
readonly columnCount: number;
|
|
67
|
+
readonly depth: number;
|
|
68
|
+
readonly collapsed: boolean;
|
|
69
|
+
readonly hidden: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** Full-query pivot metadata. Projected columns and repeatable rows remain in the capture. */
|
|
72
|
+
export interface CanopyPivotDescriptor {
|
|
73
|
+
readonly definition: {
|
|
74
|
+
readonly rows: readonly object[];
|
|
75
|
+
readonly columns: readonly object[];
|
|
76
|
+
readonly values: readonly string[];
|
|
77
|
+
};
|
|
78
|
+
readonly rowAxis: readonly CanopyPivotAxis[];
|
|
79
|
+
readonly columnAxis: readonly CanopyPivotAxis[];
|
|
80
|
+
readonly columnGroups: readonly CanopyPivotColumnGroup[];
|
|
81
|
+
readonly distinctColumns: number;
|
|
82
|
+
readonly retainedColumns: readonly (readonly (string | number | boolean | null)[])[];
|
|
83
|
+
readonly columnsLimited: boolean;
|
|
84
|
+
}
|
|
43
85
|
/** Captured half-open detail ranges, never ranges from a different export scope. */
|
|
44
86
|
export interface CanopyExportGroup {
|
|
45
87
|
readonly key: string;
|
|
@@ -116,6 +158,8 @@ export interface CanopyCapture {
|
|
|
116
158
|
readonly query?: object;
|
|
117
159
|
readonly generatedAt?: string;
|
|
118
160
|
readonly grouping?: CanopyExportGrouping;
|
|
161
|
+
/** Explicit pre-aggregated projection; never interpreted as ordinary grouped records. */
|
|
162
|
+
readonly pivot?: CanopyPivotDescriptor;
|
|
119
163
|
readonly formatRules?: readonly CanopyFormatRule[];
|
|
120
164
|
};
|
|
121
165
|
/** Fresh serial enumeration. The signal must reach the source's in-flight page requests. */
|
package/dist/opc/index.js
CHANGED
|
@@ -65,7 +65,16 @@ export class OpcPackage {
|
|
|
65
65
|
throw new OfficeIMOError("INVALID_STATE", "OPC package is finalized."); }
|
|
66
66
|
reserve(uri, type) {
|
|
67
67
|
this.open();
|
|
68
|
+
// OPC part names become ZIP entry names. Reject oversized and deeply nested
|
|
69
|
+
// names before collecting every ancestor prefix.
|
|
70
|
+
if (typeof uri === "string" && uri.length > 65536)
|
|
71
|
+
throw new OfficeIMOError("RESOURCE_LIMIT", "OPC part name exceeds the ZIP entry-name limit.");
|
|
68
72
|
uri = partUri(uri);
|
|
73
|
+
let depth = 0;
|
|
74
|
+
for (let index = 0; index < uri.length; index++) {
|
|
75
|
+
if (uri[index] === "/" && ++depth > 64)
|
|
76
|
+
throw new OfficeIMOError("RESOURCE_LIMIT", "OPC part name exceeds the directory-depth limit.");
|
|
77
|
+
}
|
|
69
78
|
if (/\/_rels(?:\/|$)/i.test(uri) || uri.toLowerCase() === "/[content_types].xml")
|
|
70
79
|
throw new TypeError("Package metadata part names are reserved.");
|
|
71
80
|
const key = uri.toLowerCase();
|
package/dist/xlsx/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { Workbook } from "./workbook.js";
|
|
|
2
2
|
export { writeXlsx, writeXlsxTo } from "./write.js";
|
|
3
3
|
export { writeGroupedXlsx, writeGroupedXlsxTo, addGroupedXlsx } from "./grouped.js";
|
|
4
4
|
export type { GroupedXlsxOptions, GroupedXlsxSheetOptions, GroupedXlsxWorksheet, GroupedXlsxGroupRows } from "./grouped.js";
|
|
5
|
-
export type { RowOutline } from "./types.js";
|
|
5
|
+
export type { RowOutline, ColumnOutline } from "./types.js";
|
|
6
6
|
export { createGroupedReport } from "../core/grouped-report.js";
|
|
7
7
|
export type { GroupedReportSource, GroupedReportOptions, GroupedReportEvent, GroupedReportSummary, GroupedReportValueContext, GroupedReportLevel, GroupedReportGroup } from "../core/grouped-report.js";
|
|
8
8
|
export type { XlsxOptions } from "./write.js";
|
package/dist/xlsx/options.js
CHANGED
|
@@ -2,7 +2,7 @@ import { captureFields } from "../internal/capture.js";
|
|
|
2
2
|
/** @internal The workbook owner captures these settings before validation or adapter merging. */
|
|
3
3
|
export const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "creator", "title", "subject", "description", "created", "modified"];
|
|
4
4
|
/** @internal Worksheet settings also used by the portable sheet owner. */
|
|
5
|
-
export const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
|
|
5
|
+
export const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
|
|
6
6
|
/** @internal Includes inherited format-specific ceilings before a wrapper combines stream settings. */
|
|
7
7
|
export const workbookLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxStyles", "maxSheets", "maxOverflowCharacters", "maxHyperlinks", "maxImageBytes", "maxBufferedCells", "maxBufferedCharacters", "maxMergedRanges", "maxConditionalFormats", "maxDifferentialStyles", "maxCharts", "maxChartPoints", "maxChartTextCharacters", "maxFormulaCharacters", "maxDataValidations", "maxValidationTextCharacters"];
|
|
8
8
|
/** @internal Capture the workbook's known ceilings without dropping supported prototype fields. */
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ColumnOutline } from "./types.js";
|
|
2
|
+
/** Capture bounded disjoint ranges before asynchronous serialization; absent columns stay visible. */
|
|
3
|
+
export declare function captureColumnOutlines(input: readonly ColumnOutline[] | undefined, columns: number): readonly ColumnOutline[] | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { captureFields } from "../internal/capture.js";
|
|
2
|
+
/** Capture bounded disjoint ranges before asynchronous serialization; absent columns stay visible. */
|
|
3
|
+
export function captureColumnOutlines(input, columns) {
|
|
4
|
+
if (input === undefined)
|
|
5
|
+
return undefined;
|
|
6
|
+
if (!Array.isArray(input) || input.length > columns)
|
|
7
|
+
throw new TypeError("Column outlines must be bounded, non-overlapping ranges.");
|
|
8
|
+
let end = 0;
|
|
9
|
+
return Object.freeze(input.map(range => {
|
|
10
|
+
if (!range || typeof range !== "object")
|
|
11
|
+
throw new TypeError("Column outlines require range metadata.");
|
|
12
|
+
return captureFields(range, ["firstColumn", "columnCount", "level", "hidden", "collapsed"]);
|
|
13
|
+
}).sort((a, b) => a.firstColumn - b.firstColumn).map(range => {
|
|
14
|
+
const { firstColumn, columnCount, level = 0, hidden, collapsed } = range;
|
|
15
|
+
if (!Number.isSafeInteger(firstColumn) || firstColumn < end || !Number.isSafeInteger(columnCount) || columnCount < 1 || firstColumn + columnCount > columns)
|
|
16
|
+
throw new RangeError("Column outline ranges must be disjoint and within the declared columns.");
|
|
17
|
+
if (!Number.isInteger(level) || level < 0 || level > 7)
|
|
18
|
+
throw new RangeError("Column outline level must be from zero through seven.");
|
|
19
|
+
for (const flag of [hidden, collapsed])
|
|
20
|
+
if (flag !== undefined && typeof flag !== "boolean")
|
|
21
|
+
throw new TypeError("Column outline flags must be booleans.");
|
|
22
|
+
end = firstColumn + columnCount;
|
|
23
|
+
return Object.freeze({ firstColumn, columnCount, level, ...(hidden === undefined ? {} : { hidden }), ...(collapsed === undefined ? {} : { collapsed }) });
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
/** @internal Positions are captured even when a sheet has only column outlines. */
|
|
27
|
+
export function validateOutlinePositions(options) {
|
|
28
|
+
for (const flag of [options.outlineSummaryBelow, options.outlineSummaryRight])
|
|
29
|
+
if (flag !== undefined && typeof flag !== "boolean")
|
|
30
|
+
throw new TypeError("Outline summary positions must be booleans.");
|
|
31
|
+
}
|
|
32
|
+
/** @internal Resolve at most 16,384 columns once, without retaining any worksheet body. */
|
|
33
|
+
export function columnOutlineMap(ranges) {
|
|
34
|
+
const result = new Map();
|
|
35
|
+
for (const range of ranges ?? [])
|
|
36
|
+
for (let index = range.firstColumn; index < range.firstColumn + range.columnCount; index++)
|
|
37
|
+
result.set(index, range);
|
|
38
|
+
return result;
|
|
39
|
+
}
|
package/dist/xlsx/types.d.ts
CHANGED
|
@@ -48,6 +48,11 @@ export interface RowOutline {
|
|
|
48
48
|
/** Marks a summary row whose preceding detail rows are initially hidden. */
|
|
49
49
|
readonly collapsed?: boolean;
|
|
50
50
|
}
|
|
51
|
+
/** Non-overlapping zero-based column range with native Excel outline metadata. */
|
|
52
|
+
export interface ColumnOutline extends RowOutline {
|
|
53
|
+
readonly firstColumn: number;
|
|
54
|
+
readonly columnCount: number;
|
|
55
|
+
}
|
|
51
56
|
/** A real Excel table over this worksheet's header and data rows. Empty exports retain headers without a table part. */
|
|
52
57
|
export interface TableOptions {
|
|
53
58
|
readonly name?: string;
|
|
@@ -122,6 +127,10 @@ export interface SheetOptions<T = never> {
|
|
|
122
127
|
readonly rowOutline?: (context: RowStyleContext) => RowOutline | undefined;
|
|
123
128
|
/** Declared outline upper bound, from zero through seven; emitted before streamed rows. */
|
|
124
129
|
readonly maxOutlineLevel?: number;
|
|
130
|
+
/** Summary position for native row/column outlines; both default to true. */
|
|
131
|
+
readonly outlineSummaryBelow?: boolean;
|
|
132
|
+
readonly outlineSummaryRight?: boolean;
|
|
133
|
+
readonly columnOutlines?: readonly ColumnOutline[];
|
|
125
134
|
readonly rowHeight?: number;
|
|
126
135
|
readonly headerHeight?: number;
|
|
127
136
|
/** Fallback width in characters. Native tables default to 20 when no column width is supplied. */
|
package/dist/xlsx/values.js
CHANGED
|
@@ -52,14 +52,23 @@ export function columnName(index) {
|
|
|
52
52
|
return name;
|
|
53
53
|
}
|
|
54
54
|
function clipName(text, length) { return text.slice(0, length).replace(/[\ud800-\udbff]$/, ""); }
|
|
55
|
+
function trimSheetNameEdges(text) {
|
|
56
|
+
let start = 0, end = text.length;
|
|
57
|
+
const removable = (character) => character === "'" || /\s/u.test(character);
|
|
58
|
+
while (start < end && removable(text[start]))
|
|
59
|
+
start++;
|
|
60
|
+
while (end > start && removable(text[end - 1]))
|
|
61
|
+
end--;
|
|
62
|
+
return text.slice(start, end);
|
|
63
|
+
}
|
|
55
64
|
export function sheetName(requested, names, policy, register = true) {
|
|
56
65
|
if (typeof requested !== "string")
|
|
57
66
|
throw new TypeError("Sheet name must be a string.");
|
|
58
67
|
// Validate and deduplicate the decoded literal value, before ST_Xstring attribute encoding.
|
|
59
68
|
// A requested _xHHHH_ token is literal text; the serializer protects its leading underscore.
|
|
60
|
-
let base = cleanXml(requested, policy).replace(/[\[\]:*?/\\]/g, "_")
|
|
69
|
+
let base = trimSheetNameEdges(cleanXml(requested, policy).replace(/[\[\]:*?/\\]/g, "_"));
|
|
61
70
|
// Clipping can expose an internal apostrophe or the reserved History name.
|
|
62
|
-
base = clipName(base, 31)
|
|
71
|
+
base = trimSheetNameEdges(clipName(base, 31));
|
|
63
72
|
if (!base)
|
|
64
73
|
base = "Sheet";
|
|
65
74
|
if (base.toLowerCase() === "history")
|
package/dist/xlsx/workbook.js
CHANGED
|
@@ -9,6 +9,7 @@ import { StyleRegistry, spreadsheetNamespace } from "./styles.js";
|
|
|
9
9
|
import { sheetName, assertXlsxValue, copyValue } from "./values.js";
|
|
10
10
|
import { copyColumns } from "../internal/rows.js";
|
|
11
11
|
import { captureFields } from "../internal/capture.js";
|
|
12
|
+
import { captureColumnOutlines } from "./outlines.js";
|
|
12
13
|
import { captureTableSpans } from "../internal/table-spans.js";
|
|
13
14
|
import { assertExportValue } from "../core/presentation.js";
|
|
14
15
|
import { Worksheet } from "./worksheet.js";
|
|
@@ -28,6 +29,7 @@ function captureSheet(options, policy) {
|
|
|
28
29
|
const footer = captured.footer && captureFields(captured.footer, ["rows", "values", "totals", "style"]);
|
|
29
30
|
const print = captured.print && captureFields(captured.print, ["paper", "orientation", "fitToWidth", "fitToHeight", "repeatHeaders", "margins", "header", "footer"]);
|
|
30
31
|
return { ...captured, columns,
|
|
32
|
+
...(captured.columnOutlines === undefined ? {} : { columnOutlines: captureColumnOutlines(captured.columnOutlines, columns.length) }),
|
|
31
33
|
...(captured.headerRows === undefined ? {} : { headerRows: captureTableSpans(captured.headerRows, columns.length) }),
|
|
32
34
|
...(footer ? { footer: { ...footer,
|
|
33
35
|
...(footer.rows === undefined ? {} : { rows: captureTableSpans(footer.rows, columns.length) }),
|
package/dist/xlsx/worksheet.js
CHANGED
|
@@ -18,6 +18,7 @@ import { FormulaCell, formulaXml, isSubtotalFormula } from "./formula.js";
|
|
|
18
18
|
import { prepareDataValidations, dataValidationsXml } from "./validation.js";
|
|
19
19
|
import { qualifiedCell, qualifiedColumnRange, resolveDataColumn } from "./ranges.js";
|
|
20
20
|
import { dataRowRanges, dataRowCount } from "./data-row-ranges.js";
|
|
21
|
+
import { captureColumnOutlines, columnOutlineMap, validateOutlinePositions } from "./outlines.js";
|
|
21
22
|
const maximumHyperlinks = 65530;
|
|
22
23
|
function checkHyperlinkCount(count) {
|
|
23
24
|
if (count > maximumHyperlinks)
|
|
@@ -148,6 +149,8 @@ export class Worksheet {
|
|
|
148
149
|
throw new TypeError("Row and style callbacks must be functions.");
|
|
149
150
|
if (options.maxOutlineLevel !== undefined && (!Number.isInteger(options.maxOutlineLevel) || options.maxOutlineLevel < 0 || options.maxOutlineLevel > 7))
|
|
150
151
|
throw new RangeError("Maximum outline level must be an integer from zero through seven.");
|
|
152
|
+
validateOutlinePositions(options);
|
|
153
|
+
captureColumnOutlines(options.columnOutlines, columns.length);
|
|
151
154
|
if (options.rowOutline && options.maxOutlineLevel === undefined)
|
|
152
155
|
throw new TypeError("A row outline callback requires maxOutlineLevel before streamed rows are written.");
|
|
153
156
|
if (!options.rowOutline && options.maxOutlineLevel !== undefined)
|
|
@@ -432,17 +435,22 @@ export class Worksheet {
|
|
|
432
435
|
const buffer = this.buffer = new ChunkedTextSink(this.entry, this.book.settings.signal), opts = this.options;
|
|
433
436
|
const x = opts.freezeColumns ?? 0, y = opts.freezeHeader ? this.headerRows : 0;
|
|
434
437
|
const pane = x && y ? "bottomRight" : x ? "topRight" : "bottomLeft", cell = columnName(x + 1) + (y + 1);
|
|
438
|
+
const outlines = columnOutlineMap(opts.columnOutlines), hasOutline = !!opts.rowOutline || outlines.size > 0;
|
|
439
|
+
const maxColumnLevel = Math.max(0, ...Array.from(outlines.values(), value => value.level ?? 0));
|
|
435
440
|
await buffer.write(xmlDeclaration + '<worksheet xmlns="' + spreadsheetNamespace + '" xmlns:r="' + officeRelationshipsNamespace + '">' +
|
|
436
|
-
(opts.print ||
|
|
441
|
+
(opts.print || hasOutline ? '<sheetPr>' + (hasOutline ? '<outlinePr summaryBelow="' + (opts.outlineSummaryBelow === false ? "0" : "1") + '"' + (opts.outlineSummaryRight === undefined ? "" : ' summaryRight="' + (opts.outlineSummaryRight ? "1" : "0") + '"') + ' showOutlineSymbols="1"/>' : "") + (opts.print ? '<pageSetUpPr fitToPage="1"/>' : "") + '</sheetPr>' : "") + '<sheetViews><sheetView workbookViewId="0">' +
|
|
437
442
|
(x || y ? '<pane' + (x ? ' xSplit="' + x + '"' : "") + (y ? ' ySplit="' + y + '"' : "") + ' topLeftCell="' + cell + '" activePane="' + pane + '" state="frozen"/><selection pane="' + pane + '" activeCell="' + cell + '" sqref="' + cell + '"/>' : "") + '</sheetView></sheetViews>' +
|
|
438
|
-
(
|
|
443
|
+
(hasOutline ? '<sheetFormatPr defaultRowHeight="15"' + (opts.rowOutline ? ' outlineLevelRow="' + opts.maxOutlineLevel + '"' : "") + (outlines.size ? ' outlineLevelCol="' + maxColumnLevel + '"' : "") + '/>' : ""));
|
|
439
444
|
const defaultWidth = opts.defaultColumnWidth ?? (this.table ? 20 : undefined);
|
|
440
|
-
if (this.columns.some((_, i) => this.layout.widths[i] !== undefined || defaultWidth !== undefined)) {
|
|
445
|
+
if (this.columns.some((_, i) => this.layout.widths[i] !== undefined || defaultWidth !== undefined || outlines.has(i))) {
|
|
441
446
|
await buffer.write('<cols>');
|
|
442
447
|
for (let i = 0; i < this.columns.length; i++) {
|
|
443
|
-
const width = this.layout.widths[i] ?? defaultWidth;
|
|
444
|
-
if (width !== undefined)
|
|
445
|
-
await buffer.write('<col min="' + (i + 1) + '" max="' + (i + 1) + '"
|
|
448
|
+
const width = this.layout.widths[i] ?? defaultWidth, outline = outlines.get(i);
|
|
449
|
+
if (width !== undefined || outline)
|
|
450
|
+
await buffer.write('<col min="' + (i + 1) + '" max="' + (i + 1) + '"' +
|
|
451
|
+
(width === undefined ? "" : ' width="' + width + '" customWidth="1"') +
|
|
452
|
+
(outline?.level ? ' outlineLevel="' + outline.level + '"' : "") + (outline?.hidden ? ' hidden="1"' : "") +
|
|
453
|
+
(outline?.collapsed ? ' collapsed="1"' : "") + '/>');
|
|
446
454
|
}
|
|
447
455
|
await buffer.write('</cols>');
|
|
448
456
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evotecit/officeimo",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Dependency-free OfficeIMO document libraries for browsers, workers and Node.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"prepack": "npm run check"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"typescript": "
|
|
86
|
+
"typescript": "7.0.2"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
|
89
89
|
"node": "^22.0.0 || ^24.0.0 || ^25.0.0 || ^26.0.0"
|