odf.js 6.3.0 → 6.4.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 +172 -18
- package/dist/{codec-BnzBd5_I.d.cts → codec-CFdlbFLJ.d.cts} +16 -10
- package/dist/{codec-Dg_HWuH1.d.ts → codec-DTAgph2r.d.ts} +16 -10
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/{embedded-BONPxvS3.js → embedded-BnavfkP-.js} +3 -3
- package/dist/{embedded-wrtHCJ68.cjs → embedded-Bxyss_ck.cjs} +14 -2
- package/dist/image/sniff.cjs +26 -0
- package/dist/image/sniff.d.cts +1 -1
- package/dist/image/sniff.d.ts +1 -1
- package/dist/image/sniff.js +26 -0
- package/dist/index.cjs +34 -1
- package/dist/index.d.cts +20 -14
- package/dist/index.d.ts +20 -14
- package/dist/index.js +12 -6
- package/dist/{list-vhXd0Jf6.d.ts → list-7FO0SDqZ.d.ts} +14 -1
- package/dist/{list-Bttwr1mk.d.cts → list-BorrTJBY.d.cts} +14 -1
- package/dist/manifest.cjs +2 -0
- package/dist/manifest.js +2 -0
- package/dist/{ns-C14w-Zhf.d.cts → ns-DrleaIZQ.d.cts} +3 -1
- package/dist/{ns-CTyKJZeF.d.ts → ns-E0TfX9tZ.d.ts} +3 -1
- package/dist/ooo1/ns.cjs +9 -0
- package/dist/ooo1/ns.d.cts +2 -2
- package/dist/ooo1/ns.d.ts +2 -2
- package/dist/ooo1/ns.js +8 -1
- package/dist/ooo1/properties.cjs +30 -0
- package/dist/ooo1/properties.d.cts +6 -2
- package/dist/ooo1/properties.d.ts +6 -2
- package/dist/ooo1/properties.js +30 -1
- package/dist/ooo1/read.cjs +1 -1
- package/dist/ooo1/read.d.cts +1 -1
- package/dist/ooo1/read.d.ts +1 -1
- package/dist/ooo1/read.js +1 -1
- package/dist/ooo1/transform.cjs +290 -0
- package/dist/ooo1/transform.d.cts +2 -2
- package/dist/ooo1/transform.d.ts +2 -2
- package/dist/ooo1/transform.js +293 -4
- package/dist/ooo1/write.cjs +40 -0
- package/dist/ooo1/write.d.cts +2 -0
- package/dist/ooo1/write.d.ts +2 -0
- package/dist/ooo1/write.js +32 -0
- package/dist/package-io/scaffold.cjs +2 -1
- package/dist/package-io/scaffold.js +2 -1
- package/dist/{paragraph-BdwsQisB.d.cts → paragraph-Bf6Iq5wC.d.cts} +1 -1
- package/dist/{paragraph-BoVy1LrN.d.ts → paragraph-DtC86tft.d.ts} +1 -1
- package/dist/{path-CK0dIPgx.d.cts → path-8HQS-J7y.d.cts} +3 -1
- package/dist/{path-CK0dIPgx.d.ts → path-8HQS-J7y.d.ts} +3 -1
- package/dist/{read-Bo1GBjSE.d.ts → read-A3CJkqVM.d.ts} +3 -1
- package/dist/{read-RFqq4ckj.d.cts → read-BgnLFuSi.d.cts} +1 -1
- package/dist/{read-3yy5EFV_.d.ts → read-CqaZ01kU.d.ts} +1 -1
- package/dist/{read-tpfiT_n4.d.cts → read-fphkvCpR.d.cts} +3 -1
- package/dist/{shapes-DUzrrf7b.d.ts → shapes-B6Ms7ibr.d.ts} +1 -1
- package/dist/{shapes-BQhXAk0D.d.cts → shapes-CbBc9t0y.d.cts} +1 -1
- package/dist/{sniff-DGOBHA0O.d.cts → sniff-eR8lObzF.d.cts} +1 -1
- package/dist/{sniff-DGOBHA0O.d.ts → sniff-eR8lObzF.d.ts} +1 -1
- package/dist/{table-ByhqRnSG.d.cts → table-CECMtPxZ.d.cts} +6 -2
- package/dist/{table-DElqGcT0.d.ts → table-XuniPr2I.d.ts} +6 -2
- package/dist/{transform-SDysw9wx.d.cts → transform-DFCPKX7e.d.cts} +2 -1
- package/dist/{transform-DRr76JEu.d.ts → transform-DPliWQuD.d.ts} +2 -1
- package/dist/typed/draw/embedded.cjs +1 -1
- package/dist/typed/draw/embedded.js +1 -1
- package/dist/typed/draw/shapes.cjs +7 -2
- package/dist/typed/draw/shapes.d.cts +1 -1
- package/dist/typed/draw/shapes.d.ts +1 -1
- package/dist/typed/draw/shapes.js +7 -2
- package/dist/typed/draw/write-shapes.cjs +211 -0
- package/dist/typed/draw/write-shapes.d.cts +2 -0
- package/dist/typed/draw/write-shapes.d.ts +2 -0
- package/dist/typed/draw/write-shapes.js +204 -0
- package/dist/typed/draw/write-vectors.cjs +132 -0
- package/dist/typed/draw/write-vectors.d.cts +2 -0
- package/dist/typed/draw/write-vectors.d.ts +2 -0
- package/dist/typed/draw/write-vectors.js +129 -0
- package/dist/typed/odb/form.cjs +1 -1
- package/dist/typed/odb/form.js +1 -1
- package/dist/typed/odg/write.cjs +80 -0
- package/dist/typed/odg/write.d.cts +2 -0
- package/dist/typed/odg/write.d.ts +2 -0
- package/dist/typed/odg/write.js +77 -0
- package/dist/typed/odp/write.cjs +108 -0
- package/dist/typed/odp/write.d.cts +2 -0
- package/dist/typed/odp/write.d.ts +2 -0
- package/dist/typed/odp/write.js +105 -0
- package/dist/typed/ods/read.cjs +3 -1
- package/dist/typed/ods/read.d.cts +2 -2
- package/dist/typed/ods/read.d.ts +2 -2
- package/dist/typed/ods/read.js +2 -2
- package/dist/typed/ods/write.cjs +579 -0
- package/dist/typed/ods/write.d.cts +2 -0
- package/dist/typed/ods/write.d.ts +2 -0
- package/dist/typed/ods/write.js +576 -0
- package/dist/typed/odt/read.cjs +1 -1
- package/dist/typed/odt/read.js +1 -1
- package/dist/typed/odt/write.cjs +11 -141
- package/dist/typed/odt/write.d.cts +1 -1
- package/dist/typed/odt/write.d.ts +1 -1
- package/dist/typed/odt/write.js +10 -140
- package/dist/typed/shared/canonicalise.cjs +126 -0
- package/dist/typed/shared/canonicalise.d.cts +10 -0
- package/dist/typed/shared/canonicalise.d.ts +10 -0
- package/dist/typed/shared/canonicalise.js +120 -0
- package/dist/typed/shared/image.cjs +12 -0
- package/dist/typed/shared/image.d.cts +5 -0
- package/dist/typed/shared/image.d.ts +5 -0
- package/dist/typed/shared/image.js +11 -0
- package/dist/typed/shared/list.cjs +32 -0
- package/dist/typed/shared/list.d.cts +2 -2
- package/dist/typed/shared/list.d.ts +2 -2
- package/dist/typed/shared/list.js +28 -1
- package/dist/typed/shared/paragraph.d.cts +1 -1
- package/dist/typed/shared/paragraph.d.ts +1 -1
- package/dist/typed/shared/path.cjs +19 -0
- package/dist/typed/shared/path.d.cts +2 -2
- package/dist/typed/shared/path.d.ts +2 -2
- package/dist/typed/shared/path.js +18 -1
- package/dist/typed/shared/table.cjs +3 -0
- package/dist/typed/shared/table.d.cts +2 -2
- package/dist/typed/shared/table.d.ts +2 -2
- package/dist/typed/shared/table.js +1 -1
- package/dist/typed/shared/units.cjs +16 -1
- package/dist/typed/shared/units.d.cts +2 -2
- package/dist/typed/shared/units.d.ts +2 -2
- package/dist/typed/shared/units.js +16 -2
- package/dist/{units-BQSNkTQZ.d.cts → units-DdyaQolR.d.cts} +2 -1
- package/dist/{units-BQSNkTQZ.d.ts → units-DdyaQolR.d.ts} +2 -1
- package/dist/write-4kMi-asu.d.ts +14 -0
- package/dist/write-BZXpT8F6.d.cts +17 -0
- package/dist/write-BhG3t3fJ.d.cts +14 -0
- package/dist/write-BuLQmwLD.d.cts +14 -0
- package/dist/write-C2c4xBXs.d.cts +14 -0
- package/dist/{write-7Uu_wlkL.d.cts → write-CPATqG4v.d.cts} +1 -0
- package/dist/write-CfTE2jY8.d.ts +14 -0
- package/dist/write-DttX1rTC.d.ts +14 -0
- package/dist/{write-DGcI9W7Z.d.ts → write-JERychL3.d.ts} +1 -0
- package/dist/write-SKnCTU4C.d.ts +17 -0
- package/dist/write-shapes-Co7BrmMZ.d.ts +36 -0
- package/dist/write-shapes-D4piGKf4.d.cts +36 -0
- package/dist/write-vectors-B-RVHAKI.d.cts +11 -0
- package/dist/write-vectors-CYjZoVBW.d.ts +11 -0
- package/package.json +2 -2
|
@@ -0,0 +1,579 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_media_type = require("../../media-type.cjs");
|
|
3
|
+
const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
4
|
+
const require_xml_entities = require("../../xml/entities.cjs");
|
|
5
|
+
const require_manifest = require("../../manifest.cjs");
|
|
6
|
+
const require_typed_shared_units = require("../shared/units.cjs");
|
|
7
|
+
const require_typed_shared_color = require("../shared/color.cjs");
|
|
8
|
+
const require_styles_registry = require("../../styles/registry.cjs");
|
|
9
|
+
const require_typed_shared_a1 = require("../shared/a1.cjs");
|
|
10
|
+
const require_typed_shared_metadata = require("../shared/metadata.cjs");
|
|
11
|
+
const require_typed_shared_paragraph = require("../shared/paragraph.cjs");
|
|
12
|
+
const require_typed_shared_table = require("../shared/table.cjs");
|
|
13
|
+
const require_package_io_scaffold = require("../../package-io/scaffold.cjs");
|
|
14
|
+
const require_typed_shared_image = require("../shared/image.cjs");
|
|
15
|
+
require("../../embedded-Bxyss_ck.cjs");
|
|
16
|
+
let document_schema_js = require("document-schema.js");
|
|
17
|
+
//#region src/typed/ods/write.ts
|
|
18
|
+
const CONTENT_PART = "content.xml";
|
|
19
|
+
const STYLES_PART = "styles.xml";
|
|
20
|
+
const PICTURES_DIRECTORY = "Pictures";
|
|
21
|
+
function unsupported(what, where) {
|
|
22
|
+
return /* @__PURE__ */ new Error(`writeOds: ${where} carries ${what}, which this writer does not write yet -- refusing rather than producing an .ods that silently lost it. See ExaDev/documents.js for the tracked follow-up covering embedded objects, data validation, and conditional formatting.`);
|
|
23
|
+
}
|
|
24
|
+
function formatOdfDuration(isoTime) {
|
|
25
|
+
const match = /^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?$/.exec(isoTime);
|
|
26
|
+
if (match === null) throw new Error(`writeOdsContent: a "time" cell's value "${isoTime}" is not the canonical ISO 8601 HH:MM:SS wall-clock spelling document-schema.js's ContentCellValueSchema documents -- refusing to guess at an ODF xsd:duration equivalent`);
|
|
27
|
+
const [, hours, minutes, seconds, fraction] = match;
|
|
28
|
+
const secondsLiteral = fraction === void 0 ? String(Number(seconds)) : `${Number(seconds)}.${fraction}`;
|
|
29
|
+
return `PT${Number(hours)}H${Number(minutes)}M${secondsLiteral}S`;
|
|
30
|
+
}
|
|
31
|
+
function formatCellNumberLiteral(value) {
|
|
32
|
+
return value.exactValue ?? String(value.value);
|
|
33
|
+
}
|
|
34
|
+
function unsupportedCellValueKind(kind) {
|
|
35
|
+
return /* @__PURE__ */ new Error(`writeOdsContent: a cell carries a "${kind}" value, which this writer does not write -- readOdsContent's own reader can never produce this kind for an .ods document (see its own doc comment), so there is no genuine inverse to verify a write against; refusing rather than writing a document that would read back reporting a different value kind than it was given.`);
|
|
36
|
+
}
|
|
37
|
+
function writeCellValueAttributes(value) {
|
|
38
|
+
switch (value.kind) {
|
|
39
|
+
case "number": return {
|
|
40
|
+
"office:value-type": "float",
|
|
41
|
+
"office:value": formatCellNumberLiteral(value)
|
|
42
|
+
};
|
|
43
|
+
case "percentage": return {
|
|
44
|
+
"office:value-type": "percentage",
|
|
45
|
+
"office:value": formatCellNumberLiteral(value)
|
|
46
|
+
};
|
|
47
|
+
case "currency": {
|
|
48
|
+
const attributes = {
|
|
49
|
+
"office:value-type": "currency",
|
|
50
|
+
"office:value": formatCellNumberLiteral(value)
|
|
51
|
+
};
|
|
52
|
+
if (value.currency !== void 0) attributes["office:currency"] = require_xml_entities.encodeXmlText(value.currency);
|
|
53
|
+
return attributes;
|
|
54
|
+
}
|
|
55
|
+
case "boolean": return {
|
|
56
|
+
"office:value-type": "boolean",
|
|
57
|
+
"office:boolean-value": value.value ? "true" : "false"
|
|
58
|
+
};
|
|
59
|
+
case "date": return {
|
|
60
|
+
"office:value-type": "date",
|
|
61
|
+
"office:date-value": require_xml_entities.encodeXmlText(value.value)
|
|
62
|
+
};
|
|
63
|
+
case "time": return {
|
|
64
|
+
"office:value-type": "time",
|
|
65
|
+
"office:time-value": require_xml_entities.encodeXmlText(formatOdfDuration(value.value))
|
|
66
|
+
};
|
|
67
|
+
case "string": return {
|
|
68
|
+
"office:value-type": "string",
|
|
69
|
+
"office:string-value": require_xml_entities.encodeXmlText(value.value)
|
|
70
|
+
};
|
|
71
|
+
case "empty": return {};
|
|
72
|
+
case "dateTime":
|
|
73
|
+
case "error": throw unsupportedCellValueKind(value.kind);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function isBareNewlineRun(run) {
|
|
77
|
+
return run.text === "\n" && run.bold === void 0 && run.italic === void 0 && run.underline === void 0 && run.strike === void 0 && run.fontFamily === void 0 && run.sizePt === void 0 && run.color === void 0 && run.hyperlink === void 0;
|
|
78
|
+
}
|
|
79
|
+
function cellSourceRuns(cell) {
|
|
80
|
+
if (cell.runs !== void 0) return [...cell.runs];
|
|
81
|
+
return cell.displayText.length > 0 ? [{ text: cell.displayText }] : [];
|
|
82
|
+
}
|
|
83
|
+
function planCellTextGroups(cell) {
|
|
84
|
+
const runs = cellSourceRuns(cell);
|
|
85
|
+
const groups = [[]];
|
|
86
|
+
for (const run of runs) if (isBareNewlineRun(run)) groups.push([]);
|
|
87
|
+
else groups[groups.length - 1].push(run);
|
|
88
|
+
return groups;
|
|
89
|
+
}
|
|
90
|
+
function writeCellParagraphs(cell, registry) {
|
|
91
|
+
return planCellTextGroups(cell).map((group) => require_typed_shared_paragraph.writeOdfParagraph({
|
|
92
|
+
kind: "paragraph",
|
|
93
|
+
runs: group
|
|
94
|
+
}, registry));
|
|
95
|
+
}
|
|
96
|
+
function sheetCellStyle(cell, registry) {
|
|
97
|
+
const cellProperties = {};
|
|
98
|
+
if (cell.background !== void 0) cellProperties["fo:background-color"] = require_typed_shared_color.formatOdfColor(cell.background);
|
|
99
|
+
if (cell.borders !== void 0) for (const edge of require_typed_shared_table.BORDER_EDGE_KEYS) {
|
|
100
|
+
const border = cell.borders[edge];
|
|
101
|
+
if (border !== void 0) cellProperties[require_typed_shared_table.BORDER_EDGE_ATTRS[edge]] = require_typed_shared_table.formatBorderEdge(border);
|
|
102
|
+
}
|
|
103
|
+
if (cell.verticalAlignment !== void 0) cellProperties["style:vertical-align"] = cell.verticalAlignment;
|
|
104
|
+
const propertyElements = [];
|
|
105
|
+
if (Object.keys(cellProperties).length > 0) propertyElements.push(require_xml_fragment.el("style:table-cell-properties", cellProperties));
|
|
106
|
+
if (cell.alignment !== void 0) propertyElements.push(require_xml_fragment.el("style:paragraph-properties", { "fo:text-align": cell.alignment }));
|
|
107
|
+
if (propertyElements.length === 0) return;
|
|
108
|
+
return registry.intern({
|
|
109
|
+
properties: {},
|
|
110
|
+
family: "table-cell",
|
|
111
|
+
propertyElements
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function sheetColumnStyle(widthPt, manualBreak, registry) {
|
|
115
|
+
const properties = {};
|
|
116
|
+
if (widthPt !== void 0) properties["style:column-width"] = require_typed_shared_units.formatOdfLength(widthPt);
|
|
117
|
+
if (manualBreak) properties["fo:break-before"] = "page";
|
|
118
|
+
if (Object.keys(properties).length === 0) return;
|
|
119
|
+
return registry.intern({
|
|
120
|
+
properties: {},
|
|
121
|
+
family: "table-column",
|
|
122
|
+
propertyElements: [require_xml_fragment.el("style:table-column-properties", properties)]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function sheetRowStyle(heightPt, manualBreak, registry) {
|
|
126
|
+
const properties = {};
|
|
127
|
+
if (heightPt !== void 0) properties["style:row-height"] = require_typed_shared_units.formatOdfLength(heightPt);
|
|
128
|
+
if (manualBreak) properties["fo:break-before"] = "page";
|
|
129
|
+
if (Object.keys(properties).length === 0) return;
|
|
130
|
+
return registry.intern({
|
|
131
|
+
properties: {},
|
|
132
|
+
family: "table-row",
|
|
133
|
+
propertyElements: [require_xml_fragment.el("style:table-row-properties", properties)]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function computeUsedRange(sheet) {
|
|
137
|
+
let maxRow;
|
|
138
|
+
let maxColumn;
|
|
139
|
+
const bumpRow = (row) => {
|
|
140
|
+
if (maxRow === void 0 || row > maxRow) maxRow = row;
|
|
141
|
+
};
|
|
142
|
+
const bumpColumn = (column) => {
|
|
143
|
+
if (maxColumn === void 0 || column > maxColumn) maxColumn = column;
|
|
144
|
+
};
|
|
145
|
+
for (const cell of sheet.cells) {
|
|
146
|
+
bumpRow(cell.row + (cell.rowSpan ?? 1) - 1);
|
|
147
|
+
bumpColumn(cell.column + (cell.colSpan ?? 1) - 1);
|
|
148
|
+
}
|
|
149
|
+
for (const column of sheet.columns) bumpColumn(column.index);
|
|
150
|
+
for (const row of sheet.rows) bumpRow(row.index);
|
|
151
|
+
for (const image of sheet.images) {
|
|
152
|
+
bumpRow(image.anchorRow);
|
|
153
|
+
bumpColumn(image.anchorColumn);
|
|
154
|
+
}
|
|
155
|
+
const printSettings = sheet.printSettings;
|
|
156
|
+
if (printSettings.repeatColumns !== void 0) bumpColumn(printSettings.repeatColumns.end);
|
|
157
|
+
if (printSettings.repeatRows !== void 0) bumpRow(printSettings.repeatRows.end);
|
|
158
|
+
if (printSettings.manualBreaks !== void 0) {
|
|
159
|
+
for (const row of printSettings.manualBreaks.rows) bumpRow(row);
|
|
160
|
+
for (const column of printSettings.manualBreaks.columns) bumpColumn(column);
|
|
161
|
+
}
|
|
162
|
+
if (printSettings.printRange !== void 0) {
|
|
163
|
+
bumpRow(printSettings.printRange.endRow);
|
|
164
|
+
bumpColumn(printSettings.printRange.endColumn);
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
maxRow,
|
|
168
|
+
maxColumn
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function coverageKey(row, column) {
|
|
172
|
+
return `${row},${column}`;
|
|
173
|
+
}
|
|
174
|
+
function computeCoveredPositions(cells) {
|
|
175
|
+
const covered = /* @__PURE__ */ new Set();
|
|
176
|
+
for (const cell of cells) {
|
|
177
|
+
const rowSpan = cell.rowSpan ?? 1;
|
|
178
|
+
const colSpan = cell.colSpan ?? 1;
|
|
179
|
+
for (let row = cell.row; row < cell.row + rowSpan; row += 1) for (let column = cell.column; column < cell.column + colSpan; column += 1) if (row !== cell.row || column !== cell.column) covered.add(coverageKey(row, column));
|
|
180
|
+
}
|
|
181
|
+
return covered;
|
|
182
|
+
}
|
|
183
|
+
function groupImagesByPosition(images) {
|
|
184
|
+
const byPosition = /* @__PURE__ */ new Map();
|
|
185
|
+
for (const image of images) {
|
|
186
|
+
const key = coverageKey(image.anchorRow, image.anchorColumn);
|
|
187
|
+
const existing = byPosition.get(key);
|
|
188
|
+
if (existing === void 0) byPosition.set(key, [image]);
|
|
189
|
+
else existing.push(image);
|
|
190
|
+
}
|
|
191
|
+
return byPosition;
|
|
192
|
+
}
|
|
193
|
+
function writeSheetImageFrame(image, state) {
|
|
194
|
+
const extension = require_typed_shared_image.imageExtension(image.format);
|
|
195
|
+
const path = `${PICTURES_DIRECTORY}/image${state.nextImage}.${extension}`;
|
|
196
|
+
state.nextImage += 1;
|
|
197
|
+
state.pkg.parts[path] = {
|
|
198
|
+
kind: "binary",
|
|
199
|
+
base64: image.base64
|
|
200
|
+
};
|
|
201
|
+
const children = [require_xml_fragment.el("draw:image", {
|
|
202
|
+
"xlink:href": require_xml_entities.encodeXmlText(path),
|
|
203
|
+
"xlink:type": "simple",
|
|
204
|
+
"xlink:show": "embed",
|
|
205
|
+
"xlink:actuate": "onLoad"
|
|
206
|
+
})];
|
|
207
|
+
if (image.altText !== void 0) children.push(require_xml_fragment.el("svg:title", {}, [require_xml_fragment.txt(require_xml_entities.encodeXmlText(image.altText))]));
|
|
208
|
+
return require_xml_fragment.el("draw:frame", {
|
|
209
|
+
"draw:z-index": String(state.nextZIndex++),
|
|
210
|
+
"svg:x": require_typed_shared_units.formatOdfLength(image.offsetXPt),
|
|
211
|
+
"svg:y": require_typed_shared_units.formatOdfLength(image.offsetYPt),
|
|
212
|
+
"svg:width": require_typed_shared_units.formatOdfLength(image.widthPt),
|
|
213
|
+
"svg:height": require_typed_shared_units.formatOdfLength(image.heightPt)
|
|
214
|
+
}, children);
|
|
215
|
+
}
|
|
216
|
+
function sheetPageLayoutElement(name, printSettings) {
|
|
217
|
+
const properties = {
|
|
218
|
+
"fo:page-width": require_typed_shared_units.formatOdfLength(printSettings.pageSize.widthPt),
|
|
219
|
+
"fo:page-height": require_typed_shared_units.formatOdfLength(printSettings.pageSize.heightPt),
|
|
220
|
+
"fo:margin-top": require_typed_shared_units.formatOdfLength(printSettings.margins.topPt),
|
|
221
|
+
"fo:margin-right": require_typed_shared_units.formatOdfLength(printSettings.margins.rightPt),
|
|
222
|
+
"fo:margin-bottom": require_typed_shared_units.formatOdfLength(printSettings.margins.bottomPt),
|
|
223
|
+
"fo:margin-left": require_typed_shared_units.formatOdfLength(printSettings.margins.leftPt),
|
|
224
|
+
"style:print-page-order": printSettings.pageOrder === "overThenDown" ? "ltr" : "ttb"
|
|
225
|
+
};
|
|
226
|
+
const printTokens = [];
|
|
227
|
+
if (printSettings.gridlines) printTokens.push("grid");
|
|
228
|
+
if (printSettings.headers) printTokens.push("headers");
|
|
229
|
+
if (printTokens.length > 0) properties["style:print"] = printTokens.join(" ");
|
|
230
|
+
if (printSettings.scalePercent !== void 0) properties["style:scale-to"] = `${printSettings.scalePercent}%`;
|
|
231
|
+
if (printSettings.fitToPages !== void 0) {
|
|
232
|
+
properties["style:scale-to-X"] = String(printSettings.fitToPages.width);
|
|
233
|
+
properties["style:scale-to-Y"] = String(printSettings.fitToPages.height);
|
|
234
|
+
}
|
|
235
|
+
return require_xml_fragment.el("style:page-layout", { "style:name": require_xml_entities.encodeXmlText(name) }, [require_xml_fragment.el("style:page-layout-properties", properties)]);
|
|
236
|
+
}
|
|
237
|
+
function formatPrintRange(range, sheetName) {
|
|
238
|
+
const start = require_typed_shared_a1.cellReference(range.startColumn, range.startRow);
|
|
239
|
+
const end = require_typed_shared_a1.cellReference(range.endColumn, range.endRow);
|
|
240
|
+
const qualifiedSheet = require_xml_entities.encodeXmlText(sheetName);
|
|
241
|
+
return `${qualifiedSheet}.${start}:${qualifiedSheet}.${end}`;
|
|
242
|
+
}
|
|
243
|
+
function wrapHeaderRange(elements, range, wrapperTag) {
|
|
244
|
+
if (range === void 0) return [...elements];
|
|
245
|
+
const before = elements.slice(0, range.start);
|
|
246
|
+
const wrapped = elements.slice(range.start, range.end + 1);
|
|
247
|
+
const after = elements.slice(range.end + 1);
|
|
248
|
+
return [
|
|
249
|
+
...before,
|
|
250
|
+
require_xml_fragment.el(wrapperTag, {}, wrapped),
|
|
251
|
+
...after
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
function writeColumns(sheet, state, manualBreakColumns, maxColumn) {
|
|
255
|
+
if (maxColumn === void 0) return [];
|
|
256
|
+
const byIndex = new Map(sheet.columns.map((column) => [column.index, column]));
|
|
257
|
+
const elements = [];
|
|
258
|
+
for (let index = 0; index <= maxColumn; index += 1) {
|
|
259
|
+
const declared = byIndex.get(index);
|
|
260
|
+
const styleName = sheetColumnStyle(declared?.widthPt, manualBreakColumns.has(index), state.registry);
|
|
261
|
+
const attributes = {};
|
|
262
|
+
if (styleName !== void 0) attributes["table:style-name"] = require_xml_entities.encodeXmlText(styleName);
|
|
263
|
+
if (declared?.hidden === true) attributes["table:visibility"] = "collapse";
|
|
264
|
+
elements.push(require_xml_fragment.el("table:table-column", attributes));
|
|
265
|
+
}
|
|
266
|
+
return wrapHeaderRange(elements, sheet.printSettings.repeatColumns, "table:table-header-columns");
|
|
267
|
+
}
|
|
268
|
+
function writeRowCells(row, maxColumn, cellByPosition, imagesByPosition, covered, state) {
|
|
269
|
+
if (maxColumn === void 0) return [];
|
|
270
|
+
const nodes = [];
|
|
271
|
+
let column = 0;
|
|
272
|
+
while (column <= maxColumn) {
|
|
273
|
+
const key = coverageKey(row, column);
|
|
274
|
+
if (covered.has(key)) {
|
|
275
|
+
let end = column;
|
|
276
|
+
while (end + 1 <= maxColumn && covered.has(coverageKey(row, end + 1)) && !cellByPosition.has(coverageKey(row, end + 1))) end += 1;
|
|
277
|
+
const count = end - column + 1;
|
|
278
|
+
nodes.push(require_xml_fragment.el("table:covered-table-cell", count > 1 ? { "table:number-columns-repeated": String(count) } : {}));
|
|
279
|
+
column = end + 1;
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
const cell = cellByPosition.get(key);
|
|
283
|
+
const images = imagesByPosition.get(key);
|
|
284
|
+
if (cell !== void 0 || images !== void 0 && images.length > 0) {
|
|
285
|
+
const attributes = {};
|
|
286
|
+
if (cell !== void 0) {
|
|
287
|
+
Object.assign(attributes, writeCellValueAttributes(cell.value));
|
|
288
|
+
if (cell.formula !== void 0) attributes["table:formula"] = require_xml_entities.encodeXmlText(cell.formula);
|
|
289
|
+
if (cell.colSpan !== void 0) attributes["table:number-columns-spanned"] = String(cell.colSpan);
|
|
290
|
+
if (cell.rowSpan !== void 0) attributes["table:number-rows-spanned"] = String(cell.rowSpan);
|
|
291
|
+
const styleName = sheetCellStyle(cell, state.registry);
|
|
292
|
+
if (styleName !== void 0) attributes["table:style-name"] = require_xml_entities.encodeXmlText(styleName);
|
|
293
|
+
}
|
|
294
|
+
const children = cell === void 0 ? [] : writeCellParagraphs(cell, state.registry);
|
|
295
|
+
for (const image of images ?? []) children.push(writeSheetImageFrame(image, state));
|
|
296
|
+
nodes.push(require_xml_fragment.el("table:table-cell", attributes, children));
|
|
297
|
+
column += 1;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
let end = column;
|
|
301
|
+
while (end + 1 <= maxColumn && !covered.has(coverageKey(row, end + 1)) && !cellByPosition.has(coverageKey(row, end + 1)) && (imagesByPosition.get(coverageKey(row, end + 1))?.length ?? 0) === 0) end += 1;
|
|
302
|
+
const count = end - column + 1;
|
|
303
|
+
nodes.push(require_xml_fragment.el("table:table-cell", count > 1 ? { "table:number-columns-repeated": String(count) } : {}));
|
|
304
|
+
column = end + 1;
|
|
305
|
+
}
|
|
306
|
+
return nodes;
|
|
307
|
+
}
|
|
308
|
+
function writeRows(sheet, state, manualBreakRows, maxRow, maxColumn) {
|
|
309
|
+
if (maxRow === void 0) return [];
|
|
310
|
+
const rowByIndex = new Map(sheet.rows.map((row) => [row.index, row]));
|
|
311
|
+
const cellByPosition = new Map(sheet.cells.map((cell) => [coverageKey(cell.row, cell.column), cell]));
|
|
312
|
+
const imagesByPosition = groupImagesByPosition(sheet.images);
|
|
313
|
+
const covered = computeCoveredPositions(sheet.cells);
|
|
314
|
+
const elements = [];
|
|
315
|
+
for (let row = 0; row <= maxRow; row += 1) {
|
|
316
|
+
const declared = rowByIndex.get(row);
|
|
317
|
+
const styleName = sheetRowStyle(declared?.heightPt, manualBreakRows.has(row), state.registry);
|
|
318
|
+
const attributes = {};
|
|
319
|
+
if (styleName !== void 0) attributes["table:style-name"] = require_xml_entities.encodeXmlText(styleName);
|
|
320
|
+
if (declared?.hidden === true) attributes["table:visibility"] = "collapse";
|
|
321
|
+
const cells = writeRowCells(row, maxColumn, cellByPosition, imagesByPosition, covered, state);
|
|
322
|
+
elements.push(require_xml_fragment.el("table:table-row", attributes, cells));
|
|
323
|
+
}
|
|
324
|
+
return wrapHeaderRange(elements, sheet.printSettings.repeatRows, "table:table-header-rows");
|
|
325
|
+
}
|
|
326
|
+
function writeSheet(sheet, state) {
|
|
327
|
+
if (sheet.embeddedObjects !== void 0 && sheet.embeddedObjects.length > 0) throw unsupported(`an embedded object ("${sheet.embeddedObjects[0].objectKind}")`, `sheet "${sheet.name}"`);
|
|
328
|
+
if (sheet.dataValidations !== void 0 && sheet.dataValidations.length > 0) throw unsupported("a data-validation rule", `sheet "${sheet.name}"`);
|
|
329
|
+
if (sheet.conditionalFormats !== void 0 && sheet.conditionalFormats.length > 0) throw unsupported("a conditional-formatting rule", `sheet "${sheet.name}"`);
|
|
330
|
+
const { maxRow, maxColumn } = computeUsedRange(sheet);
|
|
331
|
+
const manualBreakRows = new Set(sheet.printSettings.manualBreaks?.rows ?? []);
|
|
332
|
+
const manualBreakColumns = new Set(sheet.printSettings.manualBreaks?.columns ?? []);
|
|
333
|
+
const ordinal = state.nextSheetStyle;
|
|
334
|
+
state.nextSheetStyle += 1;
|
|
335
|
+
const masterPageName = `SheetMP${ordinal}`;
|
|
336
|
+
const pageLayoutName = `SheetPL${ordinal}`;
|
|
337
|
+
const tableStyleName = `SheetTable${ordinal}`;
|
|
338
|
+
state.stylesAutomaticStyles.children.push(sheetPageLayoutElement(pageLayoutName, sheet.printSettings));
|
|
339
|
+
state.masterStyles.children.push(require_xml_fragment.el("style:master-page", {
|
|
340
|
+
"style:name": require_xml_entities.encodeXmlText(masterPageName),
|
|
341
|
+
"style:page-layout-name": require_xml_entities.encodeXmlText(pageLayoutName)
|
|
342
|
+
}));
|
|
343
|
+
state.contentAutomaticStyles.children.push(require_xml_fragment.el("style:style", {
|
|
344
|
+
"style:name": require_xml_entities.encodeXmlText(tableStyleName),
|
|
345
|
+
"style:family": "table",
|
|
346
|
+
"style:master-page-name": require_xml_entities.encodeXmlText(masterPageName)
|
|
347
|
+
}, [require_xml_fragment.el("style:table-properties", { "table:display": "true" })]));
|
|
348
|
+
const columns = writeColumns(sheet, state, manualBreakColumns, maxColumn);
|
|
349
|
+
const rows = writeRows(sheet, state, manualBreakRows, maxRow, maxColumn);
|
|
350
|
+
const tableAttributes = {
|
|
351
|
+
"table:name": require_xml_entities.encodeXmlText(sheet.name),
|
|
352
|
+
"table:style-name": require_xml_entities.encodeXmlText(tableStyleName)
|
|
353
|
+
};
|
|
354
|
+
if (sheet.printSettings.printRange !== void 0) tableAttributes["table:print-ranges"] = require_xml_entities.encodeXmlText(formatPrintRange(sheet.printSettings.printRange, sheet.name));
|
|
355
|
+
return require_xml_fragment.el("table:table", tableAttributes, [...columns, ...rows]);
|
|
356
|
+
}
|
|
357
|
+
function canonicalColor(color) {
|
|
358
|
+
return (0, document_schema_js.rgbHexToColor)((0, document_schema_js.colorToRgbHex)(color));
|
|
359
|
+
}
|
|
360
|
+
function canonicalRun(run) {
|
|
361
|
+
const canonical = { text: run.text };
|
|
362
|
+
if (run.bold !== void 0) canonical.bold = run.bold;
|
|
363
|
+
if (run.italic !== void 0) canonical.italic = run.italic;
|
|
364
|
+
if (run.underline !== void 0) canonical.underline = run.underline;
|
|
365
|
+
if (run.strike !== void 0) canonical.strike = run.strike;
|
|
366
|
+
if (run.fontFamily !== void 0) canonical.fontFamily = run.fontFamily;
|
|
367
|
+
if (run.sizePt !== void 0) canonical.sizePt = run.sizePt;
|
|
368
|
+
if (run.color !== void 0) canonical.color = canonicalColor(run.color);
|
|
369
|
+
if (run.hyperlink !== void 0) canonical.hyperlink = run.hyperlink;
|
|
370
|
+
return canonical;
|
|
371
|
+
}
|
|
372
|
+
function canonicalCellRuns(cell) {
|
|
373
|
+
const groups = planCellTextGroups(cell).map((group) => require_typed_shared_paragraph.segmentOdfParagraphRuns(group).map(canonicalRun));
|
|
374
|
+
const combined = [];
|
|
375
|
+
groups.forEach((group, index) => {
|
|
376
|
+
if (index > 0) combined.push({ text: "\n" });
|
|
377
|
+
combined.push(...group);
|
|
378
|
+
});
|
|
379
|
+
return combined;
|
|
380
|
+
}
|
|
381
|
+
function canonicalCellValue(value) {
|
|
382
|
+
switch (value.kind) {
|
|
383
|
+
case "number": return {
|
|
384
|
+
kind: "number",
|
|
385
|
+
value: Number(formatCellNumberLiteral(value))
|
|
386
|
+
};
|
|
387
|
+
case "percentage": return {
|
|
388
|
+
kind: "percentage",
|
|
389
|
+
value: Number(formatCellNumberLiteral(value))
|
|
390
|
+
};
|
|
391
|
+
case "currency": {
|
|
392
|
+
const canonical = {
|
|
393
|
+
kind: "currency",
|
|
394
|
+
value: Number(formatCellNumberLiteral(value))
|
|
395
|
+
};
|
|
396
|
+
if (value.currency !== void 0) canonical.currency = value.currency;
|
|
397
|
+
return canonical;
|
|
398
|
+
}
|
|
399
|
+
case "boolean": return {
|
|
400
|
+
kind: "boolean",
|
|
401
|
+
value: value.value
|
|
402
|
+
};
|
|
403
|
+
case "date": return {
|
|
404
|
+
kind: "date",
|
|
405
|
+
value: value.value
|
|
406
|
+
};
|
|
407
|
+
case "time": return {
|
|
408
|
+
kind: "time",
|
|
409
|
+
value: formatOdfDuration(value.value)
|
|
410
|
+
};
|
|
411
|
+
case "string": return {
|
|
412
|
+
kind: "string",
|
|
413
|
+
value: value.value
|
|
414
|
+
};
|
|
415
|
+
case "empty": return { kind: "empty" };
|
|
416
|
+
case "dateTime":
|
|
417
|
+
case "error": throw unsupportedCellValueKind(value.kind);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function canonicalCell(cell) {
|
|
421
|
+
const runs = canonicalCellRuns(cell);
|
|
422
|
+
const displayText = runs.map((run) => run.text).join("");
|
|
423
|
+
if (cell.value.kind === "empty" && cell.formula === void 0 && displayText.length === 0) return;
|
|
424
|
+
const canonical = {
|
|
425
|
+
row: cell.row,
|
|
426
|
+
column: cell.column,
|
|
427
|
+
value: canonicalCellValue(cell.value),
|
|
428
|
+
displayText
|
|
429
|
+
};
|
|
430
|
+
if (cell.formula !== void 0) canonical.formula = cell.formula;
|
|
431
|
+
if (runs.length > 0) canonical.runs = runs;
|
|
432
|
+
if (cell.colSpan !== void 0) canonical.colSpan = cell.colSpan;
|
|
433
|
+
if (cell.rowSpan !== void 0) canonical.rowSpan = cell.rowSpan;
|
|
434
|
+
if (cell.background !== void 0) canonical.background = canonicalColor(cell.background);
|
|
435
|
+
if (cell.borders !== void 0) {
|
|
436
|
+
const borders = {};
|
|
437
|
+
for (const edge of require_typed_shared_table.BORDER_EDGE_KEYS) {
|
|
438
|
+
const border = cell.borders[edge];
|
|
439
|
+
if (border !== void 0) borders[edge] = {
|
|
440
|
+
color: canonicalColor(border.color),
|
|
441
|
+
widthPt: border.widthPt,
|
|
442
|
+
style: border.style ?? "solid"
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
canonical.borders = borders;
|
|
446
|
+
}
|
|
447
|
+
if (cell.alignment !== void 0) canonical.alignment = cell.alignment;
|
|
448
|
+
if (cell.verticalAlignment !== void 0) canonical.verticalAlignment = cell.verticalAlignment;
|
|
449
|
+
return canonical;
|
|
450
|
+
}
|
|
451
|
+
function canonicalCells(sheet, maxRow, maxColumn) {
|
|
452
|
+
if (maxRow === void 0 || maxColumn === void 0) return [];
|
|
453
|
+
const cellByPosition = new Map(sheet.cells.map((cell) => [coverageKey(cell.row, cell.column), cell]));
|
|
454
|
+
const covered = computeCoveredPositions(sheet.cells);
|
|
455
|
+
const result = [];
|
|
456
|
+
for (let row = 0; row <= maxRow; row += 1) for (let column = 0; column <= maxColumn; column += 1) {
|
|
457
|
+
const key = coverageKey(row, column);
|
|
458
|
+
if (covered.has(key)) continue;
|
|
459
|
+
const cell = cellByPosition.get(key);
|
|
460
|
+
if (cell === void 0) continue;
|
|
461
|
+
const canonical = canonicalCell(cell);
|
|
462
|
+
if (canonical !== void 0) result.push(canonical);
|
|
463
|
+
}
|
|
464
|
+
return result;
|
|
465
|
+
}
|
|
466
|
+
function canonicalColumns(sheet, maxColumn) {
|
|
467
|
+
if (maxColumn === void 0) return [];
|
|
468
|
+
const byIndex = new Map(sheet.columns.map((column) => [column.index, column]));
|
|
469
|
+
const result = [];
|
|
470
|
+
for (let index = 0; index <= maxColumn; index += 1) {
|
|
471
|
+
const declared = byIndex.get(index);
|
|
472
|
+
result.push({
|
|
473
|
+
index,
|
|
474
|
+
widthPt: declared?.widthPt ?? 64,
|
|
475
|
+
hidden: declared?.hidden === true ? true : void 0
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
return result;
|
|
479
|
+
}
|
|
480
|
+
function canonicalRows(sheet, maxRow) {
|
|
481
|
+
if (maxRow === void 0) return [];
|
|
482
|
+
const byIndex = new Map(sheet.rows.map((row) => [row.index, row]));
|
|
483
|
+
const result = [];
|
|
484
|
+
for (let index = 0; index <= maxRow; index += 1) {
|
|
485
|
+
const declared = byIndex.get(index);
|
|
486
|
+
result.push({
|
|
487
|
+
index,
|
|
488
|
+
heightPt: declared?.heightPt ?? 15,
|
|
489
|
+
hidden: declared?.hidden === true ? true : void 0
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
return result;
|
|
493
|
+
}
|
|
494
|
+
function canonicalSheetImage(image) {
|
|
495
|
+
const canonical = {
|
|
496
|
+
kind: "image",
|
|
497
|
+
format: image.format,
|
|
498
|
+
base64: image.base64,
|
|
499
|
+
widthPt: image.widthPt,
|
|
500
|
+
heightPt: image.heightPt,
|
|
501
|
+
anchorRow: image.anchorRow,
|
|
502
|
+
anchorColumn: image.anchorColumn,
|
|
503
|
+
offsetXPt: image.offsetXPt,
|
|
504
|
+
offsetYPt: image.offsetYPt
|
|
505
|
+
};
|
|
506
|
+
if (image.altText !== void 0) canonical.altText = image.altText;
|
|
507
|
+
return canonical;
|
|
508
|
+
}
|
|
509
|
+
function canonicalImages(sheet) {
|
|
510
|
+
return sheet.images.map((image, originalIndex) => ({
|
|
511
|
+
image,
|
|
512
|
+
originalIndex
|
|
513
|
+
})).sort((a, b) => a.image.anchorRow - b.image.anchorRow || a.image.anchorColumn - b.image.anchorColumn || a.originalIndex - b.originalIndex).map(({ image }) => canonicalSheetImage(image));
|
|
514
|
+
}
|
|
515
|
+
function canonicalPrintSettings(printSettings) {
|
|
516
|
+
const canonical = {
|
|
517
|
+
pageSize: printSettings.pageSize,
|
|
518
|
+
margins: printSettings.margins,
|
|
519
|
+
gridlines: printSettings.gridlines,
|
|
520
|
+
headers: printSettings.headers,
|
|
521
|
+
pageOrder: printSettings.pageOrder
|
|
522
|
+
};
|
|
523
|
+
if (printSettings.printRange !== void 0) canonical.printRange = printSettings.printRange;
|
|
524
|
+
if (printSettings.scalePercent !== void 0) canonical.scalePercent = printSettings.scalePercent;
|
|
525
|
+
if (printSettings.fitToPages !== void 0) canonical.fitToPages = printSettings.fitToPages;
|
|
526
|
+
if (printSettings.repeatRows !== void 0) canonical.repeatRows = printSettings.repeatRows;
|
|
527
|
+
if (printSettings.repeatColumns !== void 0) canonical.repeatColumns = printSettings.repeatColumns;
|
|
528
|
+
if (printSettings.manualBreaks !== void 0) canonical.manualBreaks = printSettings.manualBreaks;
|
|
529
|
+
return canonical;
|
|
530
|
+
}
|
|
531
|
+
function canonicalSheet(sheet) {
|
|
532
|
+
const { maxRow, maxColumn } = computeUsedRange(sheet);
|
|
533
|
+
return {
|
|
534
|
+
name: sheet.name,
|
|
535
|
+
cells: canonicalCells(sheet, maxRow, maxColumn),
|
|
536
|
+
columns: canonicalColumns(sheet, maxColumn),
|
|
537
|
+
rows: canonicalRows(sheet, maxRow),
|
|
538
|
+
images: canonicalImages(sheet),
|
|
539
|
+
printSettings: canonicalPrintSettings(sheet.printSettings)
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
function normaliseOdsContent(document) {
|
|
543
|
+
if (document.kind !== "spreadsheet") throw new Error(`normaliseOdsContent: expected a 'spreadsheet' document, got '${document.kind}'`);
|
|
544
|
+
return {
|
|
545
|
+
kind: "spreadsheet",
|
|
546
|
+
metadata: document.metadata,
|
|
547
|
+
sheets: document.sheets.map(canonicalSheet)
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
function writeOdsContent(document, options = {}) {
|
|
551
|
+
if (document.kind !== "spreadsheet") throw new Error(`writeOdsContent: expected a 'spreadsheet' document, got '${document.kind}' -- odf.js writes .ods from the spreadsheet arm only`);
|
|
552
|
+
const version = options.version ?? "1.3";
|
|
553
|
+
const spreadsheetElement = require_xml_fragment.el("office:spreadsheet");
|
|
554
|
+
const pkg = require_package_io_scaffold.createOdfPackage(options.template ? require_media_type.ODF_MEDIA_TYPES.ots : require_media_type.ODF_MEDIA_TYPES.ods, spreadsheetElement, version);
|
|
555
|
+
const state = {
|
|
556
|
+
pkg,
|
|
557
|
+
registry: require_styles_registry.StyleRegistry.forPart(pkg, CONTENT_PART, { otherPart: {
|
|
558
|
+
pkg,
|
|
559
|
+
partPath: STYLES_PART
|
|
560
|
+
} }),
|
|
561
|
+
contentAutomaticStyles: require_package_io_scaffold.odfPartContainer(pkg, CONTENT_PART, "office:automatic-styles"),
|
|
562
|
+
stylesAutomaticStyles: require_package_io_scaffold.odfPartContainer(pkg, STYLES_PART, "office:automatic-styles"),
|
|
563
|
+
masterStyles: require_package_io_scaffold.odfPartContainer(pkg, STYLES_PART, "office:master-styles"),
|
|
564
|
+
nextImage: 1,
|
|
565
|
+
nextZIndex: 0,
|
|
566
|
+
nextSheetStyle: 1
|
|
567
|
+
};
|
|
568
|
+
for (const sheet of document.sheets) spreadsheetElement.children.push(writeSheet(sheet, state));
|
|
569
|
+
require_typed_shared_metadata.writeOdfMetadata(pkg, document.metadata, version);
|
|
570
|
+
require_manifest.syncManifest(pkg, { version });
|
|
571
|
+
return pkg;
|
|
572
|
+
}
|
|
573
|
+
function writeOds(document, options = {}) {
|
|
574
|
+
return writeOdsContent((0, document_schema_js.flattenTree)(document), options);
|
|
575
|
+
}
|
|
576
|
+
//#endregion
|
|
577
|
+
exports.normaliseOdsContent = normaliseOdsContent;
|
|
578
|
+
exports.writeOds = writeOds;
|
|
579
|
+
exports.writeOdsContent = writeOdsContent;
|