@cj-tech-master/excelts 9.6.0 → 9.6.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/dist/browser/modules/archive/io/random-access.d.ts +1 -1
- package/dist/browser/modules/excel/workbook.browser.d.ts +1 -1
- package/dist/browser/modules/excel/xlsx/xform/comment/comment-xform.d.ts +3 -0
- package/dist/browser/modules/excel/xlsx/xform/comment/comment-xform.js +30 -7
- package/dist/browser/modules/pdf/excel-bridge.d.ts +32 -0
- package/dist/browser/modules/pdf/excel-bridge.js +67 -1
- package/dist/browser/modules/pdf/word-bridge.d.ts +20 -15
- package/dist/browser/modules/pdf/word-bridge.js +49 -34
- package/dist/browser/modules/stream/common/consumers.d.ts +2 -1
- package/dist/browser/modules/word/advanced/diff.js +125 -13
- package/dist/browser/modules/word/advanced/drawing-shapes.js +3 -0
- package/dist/browser/modules/word/bridge/excel-bridge.js +21 -1
- package/dist/browser/modules/word/builder/document-handle.d.ts +2 -0
- package/dist/browser/modules/word/builder/document-handle.js +14 -2
- package/dist/browser/modules/word/builder/paragraph-builders.js +10 -1
- package/dist/browser/modules/word/builder/run-builders.d.ts +19 -2
- package/dist/browser/modules/word/builder/run-builders.js +2 -6
- package/dist/browser/modules/word/convert/odt/odt.js +6 -1
- package/dist/browser/modules/word/layout/layout-full.d.ts +12 -0
- package/dist/browser/modules/word/layout/layout-full.js +74 -9
- package/dist/browser/modules/word/layout/layout-model.d.ts +12 -0
- package/dist/browser/modules/word/query/merge.js +26 -10
- package/dist/browser/modules/word/query/split.js +68 -2
- package/dist/browser/modules/word/reader/docx-reader.js +23 -0
- package/dist/browser/modules/word/security/cfb-reader.d.ts +14 -3
- package/dist/browser/modules/word/security/cfb-reader.js +271 -153
- package/dist/browser/modules/word/security/document-protection.js +10 -4
- package/dist/browser/modules/word/security/encryption.js +194 -32
- package/dist/browser/modules/word/types.d.ts +17 -0
- package/dist/browser/modules/word/units.d.ts +10 -4
- package/dist/browser/modules/word/units.js +10 -4
- package/dist/browser/modules/word/writer/document-writer.js +28 -4
- package/dist/browser/modules/word/writer/docx-packager.js +45 -5
- package/dist/browser/modules/word/writer/image-writer.d.ts +1 -1
- package/dist/browser/modules/word/writer/image-writer.js +2 -2
- package/dist/browser/modules/word/writer/render-context.d.ts +15 -0
- package/dist/browser/modules/word/writer/run-writer.js +8 -4
- package/dist/browser/modules/word/writer/section-writer.js +46 -35
- package/dist/browser/modules/word/writer/streaming-writer.js +4 -0
- package/dist/browser/modules/word/writer/styles-writer.js +11 -0
- package/dist/browser/modules/word/writer/table-writer.js +6 -0
- package/dist/cjs/modules/excel/xlsx/xform/comment/comment-xform.js +30 -7
- package/dist/cjs/modules/pdf/excel-bridge.js +67 -0
- package/dist/cjs/modules/pdf/word-bridge.js +49 -34
- package/dist/cjs/modules/word/advanced/diff.js +125 -13
- package/dist/cjs/modules/word/advanced/drawing-shapes.js +3 -0
- package/dist/cjs/modules/word/bridge/excel-bridge.js +21 -1
- package/dist/cjs/modules/word/builder/document-handle.js +14 -2
- package/dist/cjs/modules/word/builder/paragraph-builders.js +10 -1
- package/dist/cjs/modules/word/builder/run-builders.js +2 -6
- package/dist/cjs/modules/word/convert/odt/odt.js +6 -1
- package/dist/cjs/modules/word/layout/layout-full.js +74 -9
- package/dist/cjs/modules/word/query/merge.js +26 -10
- package/dist/cjs/modules/word/query/split.js +68 -2
- package/dist/cjs/modules/word/reader/docx-reader.js +23 -0
- package/dist/cjs/modules/word/security/cfb-reader.js +271 -153
- package/dist/cjs/modules/word/security/document-protection.js +10 -4
- package/dist/cjs/modules/word/security/encryption.js +193 -31
- package/dist/cjs/modules/word/units.js +10 -4
- package/dist/cjs/modules/word/writer/document-writer.js +28 -4
- package/dist/cjs/modules/word/writer/docx-packager.js +45 -5
- package/dist/cjs/modules/word/writer/image-writer.js +2 -2
- package/dist/cjs/modules/word/writer/run-writer.js +8 -4
- package/dist/cjs/modules/word/writer/section-writer.js +46 -35
- package/dist/cjs/modules/word/writer/streaming-writer.js +4 -0
- package/dist/cjs/modules/word/writer/styles-writer.js +11 -0
- package/dist/cjs/modules/word/writer/table-writer.js +6 -0
- package/dist/esm/modules/excel/xlsx/xform/comment/comment-xform.js +30 -7
- package/dist/esm/modules/pdf/excel-bridge.js +67 -1
- package/dist/esm/modules/pdf/word-bridge.js +49 -34
- package/dist/esm/modules/word/advanced/diff.js +125 -13
- package/dist/esm/modules/word/advanced/drawing-shapes.js +3 -0
- package/dist/esm/modules/word/bridge/excel-bridge.js +21 -1
- package/dist/esm/modules/word/builder/document-handle.js +14 -2
- package/dist/esm/modules/word/builder/paragraph-builders.js +10 -1
- package/dist/esm/modules/word/builder/run-builders.js +2 -6
- package/dist/esm/modules/word/convert/odt/odt.js +6 -1
- package/dist/esm/modules/word/layout/layout-full.js +74 -9
- package/dist/esm/modules/word/query/merge.js +26 -10
- package/dist/esm/modules/word/query/split.js +68 -2
- package/dist/esm/modules/word/reader/docx-reader.js +23 -0
- package/dist/esm/modules/word/security/cfb-reader.js +271 -153
- package/dist/esm/modules/word/security/document-protection.js +10 -4
- package/dist/esm/modules/word/security/encryption.js +194 -32
- package/dist/esm/modules/word/units.js +10 -4
- package/dist/esm/modules/word/writer/document-writer.js +28 -4
- package/dist/esm/modules/word/writer/docx-packager.js +45 -5
- package/dist/esm/modules/word/writer/image-writer.js +2 -2
- package/dist/esm/modules/word/writer/run-writer.js +8 -4
- package/dist/esm/modules/word/writer/section-writer.js +46 -35
- package/dist/esm/modules/word/writer/streaming-writer.js +4 -0
- package/dist/esm/modules/word/writer/styles-writer.js +11 -0
- package/dist/esm/modules/word/writer/table-writer.js +6 -0
- package/dist/iife/excelts.iife.js +20 -8
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +2 -2
- package/dist/types/modules/archive/io/random-access.d.ts +1 -1
- package/dist/types/modules/excel/workbook.browser.d.ts +1 -1
- package/dist/types/modules/excel/xlsx/xform/comment/comment-xform.d.ts +3 -0
- package/dist/types/modules/pdf/excel-bridge.d.ts +32 -0
- package/dist/types/modules/pdf/word-bridge.d.ts +20 -15
- package/dist/types/modules/stream/common/consumers.d.ts +2 -1
- package/dist/types/modules/word/builder/document-handle.d.ts +2 -0
- package/dist/types/modules/word/builder/run-builders.d.ts +19 -2
- package/dist/types/modules/word/layout/layout-full.d.ts +12 -0
- package/dist/types/modules/word/layout/layout-model.d.ts +12 -0
- package/dist/types/modules/word/security/cfb-reader.d.ts +14 -3
- package/dist/types/modules/word/types.d.ts +17 -0
- package/dist/types/modules/word/units.d.ts +10 -4
- package/dist/types/modules/word/writer/image-writer.d.ts +1 -1
- package/dist/types/modules/word/writer/render-context.d.ts +15 -0
- package/package.json +2 -2
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import type { Chart, RegionMapDataOptions } from "../excel/chart/index.js";
|
|
19
19
|
import type { Workbook } from "../excel/workbook.browser.js";
|
|
20
|
+
import type { LayoutChart } from "../word/layout/layout-model.js";
|
|
20
21
|
import type { Chart as WordChart } from "../word/types.js";
|
|
21
22
|
import { type PdfPageBuilder } from "./builder/document-builder.js";
|
|
22
23
|
import { type PdfExportOptions } from "./types.js";
|
|
@@ -126,3 +127,34 @@ export declare function createWordChartPdfRenderer(): (chart: WordChart, page: P
|
|
|
126
127
|
width: number;
|
|
127
128
|
height: number;
|
|
128
129
|
}) => void;
|
|
130
|
+
/**
|
|
131
|
+
* Create a layout-aware chart renderer for use as the internal
|
|
132
|
+
* `RenderLayoutOptions.chartRenderer` of the Word→PDF bridge.
|
|
133
|
+
*
|
|
134
|
+
* Unlike {@link createWordChartPdfRenderer} (which only sees the inner
|
|
135
|
+
* classic `Chart` model), this renderer receives the full
|
|
136
|
+
* {@link LayoutChart} and therefore handles **both** chart families
|
|
137
|
+
* with the full Excel rendering engine:
|
|
138
|
+
*
|
|
139
|
+
* - Classic `<c:chart>` (`chartKind === "chart"`) → `wordChartToChartModel`
|
|
140
|
+
* → `drawChartPdf` (vector).
|
|
141
|
+
* - Modern `<cx:chartSpace>` ChartEx (`chartKind === "chartEx"`,
|
|
142
|
+
* e.g. sunburst / treemap / waterfall / funnel / boxWhisker /
|
|
143
|
+
* histogram / pareto / regionMap) → `parseChartEx` → `drawChartExPdf`
|
|
144
|
+
* (vector) when the layout is vector-capable, otherwise the
|
|
145
|
+
* pre-rendered SVG carried on the `LayoutChart` is left for the
|
|
146
|
+
* translator's fallback.
|
|
147
|
+
*
|
|
148
|
+
* Returns `false` to decline a chart so the translator's built-in
|
|
149
|
+
* fallback (inline SVG, then a titled placeholder box) takes over. This
|
|
150
|
+
* keeps "fail soft" behaviour: a chart the engine can't draw still
|
|
151
|
+
* renders *something* rather than a blank slot.
|
|
152
|
+
*
|
|
153
|
+
* Requires `installChartSupport()` to have been called.
|
|
154
|
+
*/
|
|
155
|
+
export declare function createWordLayoutChartPdfRenderer(): (chart: LayoutChart, page: PdfPageBuilder, rect: {
|
|
156
|
+
x: number;
|
|
157
|
+
y: number;
|
|
158
|
+
width: number;
|
|
159
|
+
height: number;
|
|
160
|
+
}) => boolean | void;
|
|
@@ -53,19 +53,21 @@ export interface DocxToPdfOptions {
|
|
|
53
53
|
/** Default font size in points (default: 11). */
|
|
54
54
|
readonly defaultFontSize?: number;
|
|
55
55
|
/**
|
|
56
|
-
* Header
|
|
56
|
+
* Header band distance from the top edge of the page, in points
|
|
57
|
+
* (default: section's `pgMar.header`, or 36pt / 0.5").
|
|
57
58
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* header
|
|
59
|
+
* Header paragraphs are laid out starting at this y-offset from the
|
|
60
|
+
* page top. Overriding it moves the entire header band — useful when
|
|
61
|
+
* the source document declares no section properties or you want to
|
|
62
|
+
* tighten / loosen the header position without touching `marginTop`.
|
|
62
63
|
*/
|
|
63
64
|
readonly headerMargin?: number;
|
|
64
65
|
/**
|
|
65
|
-
* Footer
|
|
66
|
+
* Footer band distance from the bottom edge of the page, in points
|
|
67
|
+
* (default: section's `pgMar.footer`, or 36pt / 0.5").
|
|
66
68
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
+
* The footer band's top sits at `pageHeight - footerMargin`. The
|
|
70
|
+
* footnote stack (if any) is placed directly above this line.
|
|
69
71
|
*/
|
|
70
72
|
readonly footerMargin?: number;
|
|
71
73
|
/**
|
|
@@ -89,14 +91,17 @@ export interface DocxToPdfOptions {
|
|
|
89
91
|
* destination rectangle in PDF coordinates. The implementation
|
|
90
92
|
* should draw the chart into the rectangle.
|
|
91
93
|
*
|
|
92
|
-
* Return `false` to decline a chart
|
|
93
|
-
* to
|
|
94
|
-
*
|
|
95
|
-
* chart
|
|
94
|
+
* Return `false` to decline a chart. The translator then falls back
|
|
95
|
+
* to the built-in layout-aware Excel renderer (which also handles
|
|
96
|
+
* `chartEx` charts), then to the inline `LayoutChart.svg` if present,
|
|
97
|
+
* and finally to a placeholder rectangle with the chart title
|
|
98
|
+
* centred. Return `void` or `true` to indicate the chart was handled.
|
|
96
99
|
*
|
|
97
|
-
* Note: `chartEx` charts
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
+
* Note: `chartEx` charts (sunburst / treemap / waterfall / funnel /
|
|
101
|
+
* boxWhisker / …) never reach this `Chart`-typed callback because
|
|
102
|
+
* there is no classic `Chart` instance to pass. They are rendered by
|
|
103
|
+
* the built-in layout-aware renderer instead (full vector output when
|
|
104
|
+
* `installChartSupport()` has been called).
|
|
100
105
|
*/
|
|
101
106
|
readonly chartRenderer?: (chart: Chart, page: PdfPageBuilder, rect: {
|
|
102
107
|
x: number;
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* Used by both Node.js and browser implementations.
|
|
6
6
|
*/
|
|
7
7
|
type StreamInput = AsyncIterable<Uint8Array> | ReadableStream<Uint8Array>;
|
|
8
|
+
type BlobOptions = NonNullable<ConstructorParameters<typeof Blob>[1]>;
|
|
8
9
|
export interface StreamConsumers {
|
|
9
10
|
arrayBuffer(stream: StreamInput): Promise<ArrayBuffer>;
|
|
10
|
-
blob(stream: StreamInput, options?:
|
|
11
|
+
blob(stream: StreamInput, options?: BlobOptions): Promise<Blob>;
|
|
11
12
|
buffer(stream: StreamInput): Promise<Uint8Array>;
|
|
12
13
|
json(stream: StreamInput): Promise<unknown>;
|
|
13
14
|
text(stream: StreamInput, encoding?: string): Promise<string>;
|
|
@@ -66,6 +66,7 @@ export declare const Document: {
|
|
|
66
66
|
addImage(doc: DocumentHandle, data: Uint8Array, mediaType: ImageMediaType, width: Emu, height: Emu, options?: {
|
|
67
67
|
altText?: string;
|
|
68
68
|
name?: string;
|
|
69
|
+
fallbackData?: Uint8Array;
|
|
69
70
|
}): {
|
|
70
71
|
rId: string;
|
|
71
72
|
drawingId: number;
|
|
@@ -88,6 +89,7 @@ export declare const Document: {
|
|
|
88
89
|
rotation?: number;
|
|
89
90
|
flipHorizontal?: boolean;
|
|
90
91
|
flipVertical?: boolean;
|
|
92
|
+
fallbackData?: Uint8Array;
|
|
91
93
|
}): string;
|
|
92
94
|
/** Add a custom font definition. */
|
|
93
95
|
addFont(doc: DocumentHandle, font: FontDef): void;
|
|
@@ -151,9 +151,26 @@ export declare function tocField(options?: {
|
|
|
151
151
|
tcLevels?: string;
|
|
152
152
|
/** Hyperlinks for entries. */
|
|
153
153
|
hyperlink?: boolean;
|
|
154
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* Right-align page numbers.
|
|
156
|
+
*
|
|
157
|
+
* NOTE: Right-aligned page numbers are the TOC default — they come from the
|
|
158
|
+
* right-aligned tab stop in the TOC paragraph styles, not from a field
|
|
159
|
+
* switch. The `\z` switch does NOT mean "right align": per ECMA-376 it
|
|
160
|
+
* *hides* the tab leader and page numbers in Web layout view. Mapping this
|
|
161
|
+
* option to `\z` therefore broke the layout, so we no longer emit it.
|
|
162
|
+
*/
|
|
155
163
|
rightAlignedPageNumbers?: boolean;
|
|
156
|
-
/**
|
|
164
|
+
/**
|
|
165
|
+
* Tab leader style between an entry and its page number.
|
|
166
|
+
*
|
|
167
|
+
* NOTE: The dotted leader is already the TOC default (a tab stop with dot
|
|
168
|
+
* leader defined by the TOC paragraph styles). The TOC field has no switch
|
|
169
|
+
* for choosing the leader glyph — the `\p` switch sets the *separator
|
|
170
|
+
* character* (replacing the tab entirely), which would DISABLE the leader
|
|
171
|
+
* dots and the right-aligned page number. We therefore do not translate
|
|
172
|
+
* this option into `\p`; the leader is controlled by the TOC styles.
|
|
173
|
+
*/
|
|
157
174
|
tabLeader?: "." | "-" | "_" | " ";
|
|
158
175
|
/** Suppress page numbers. */
|
|
159
176
|
noPageNumbers?: boolean;
|
|
@@ -29,6 +29,18 @@ export interface PageGeometryOverride {
|
|
|
29
29
|
readonly marginBottom?: number;
|
|
30
30
|
readonly marginLeft?: number;
|
|
31
31
|
readonly marginRight?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Distance of the header band from the top edge of the page, in
|
|
34
|
+
* points. Overrides the section's `pgMar.header`. Header paragraphs
|
|
35
|
+
* are laid out starting at this y-offset from the page top.
|
|
36
|
+
*/
|
|
37
|
+
readonly headerMargin?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Distance of the footer band from the bottom edge of the page, in
|
|
40
|
+
* points. Overrides the section's `pgMar.footer`. The footer band's
|
|
41
|
+
* top is placed at `pageHeight - footerMargin`.
|
|
42
|
+
*/
|
|
43
|
+
readonly footerMargin?: number;
|
|
32
44
|
}
|
|
33
45
|
/** Options for the full layout engine. */
|
|
34
46
|
export interface FullLayoutOptions extends LayoutOptions {
|
|
@@ -290,6 +290,18 @@ export interface PageGeometry {
|
|
|
290
290
|
/** Usable content area. */
|
|
291
291
|
readonly contentWidth: number;
|
|
292
292
|
readonly contentHeight: number;
|
|
293
|
+
/**
|
|
294
|
+
* Distance of the header band from the top edge of the page, in
|
|
295
|
+
* points (ECMA-376 `pgMar.header`). Header paragraphs are laid out
|
|
296
|
+
* starting at this y-offset from the page top.
|
|
297
|
+
*/
|
|
298
|
+
readonly headerOffset: number;
|
|
299
|
+
/**
|
|
300
|
+
* Distance of the footer band from the bottom edge of the page, in
|
|
301
|
+
* points (ECMA-376 `pgMar.footer`). The footer band's top sits at
|
|
302
|
+
* `height - footerOffset`.
|
|
303
|
+
*/
|
|
304
|
+
readonly footerOffset: number;
|
|
293
305
|
}
|
|
294
306
|
/** A fully laid-out page. */
|
|
295
307
|
export interface LayoutPage {
|
|
@@ -14,6 +14,15 @@ export interface CfbEntry {
|
|
|
14
14
|
readonly name: string;
|
|
15
15
|
/** Stream data. */
|
|
16
16
|
readonly data: Uint8Array;
|
|
17
|
+
/**
|
|
18
|
+
* Optional storage path for the stream. Each element is a storage
|
|
19
|
+
* (directory) name; the stream lives inside the nested storages.
|
|
20
|
+
* For example `path: ["\u0006DataSpaces", "TransformInfo"]` with
|
|
21
|
+
* `name: "..."` places the stream at
|
|
22
|
+
* `\u0006DataSpaces/TransformInfo/<name>`. Omit or use `[]` for a
|
|
23
|
+
* top-level stream under the root storage.
|
|
24
|
+
*/
|
|
25
|
+
readonly path?: readonly string[];
|
|
17
26
|
}
|
|
18
27
|
/**
|
|
19
28
|
* Read a CFB (OLE2 Compound File) and extract all stream entries.
|
|
@@ -27,9 +36,11 @@ export declare function readCfb(buffer: Uint8Array): CfbEntry[];
|
|
|
27
36
|
/**
|
|
28
37
|
* Write a set of named stream entries into a CFB (OLE2 Compound File) container.
|
|
29
38
|
*
|
|
30
|
-
* Produces a
|
|
31
|
-
*
|
|
32
|
-
*
|
|
39
|
+
* Produces a v3 CFB with 512-byte sectors. Streams smaller than 4096 bytes are
|
|
40
|
+
* stored in the mini-stream (64-byte mini-sectors) exactly as Office does;
|
|
41
|
+
* larger streams use regular sectors. Entries may declare a `path` to nest the
|
|
42
|
+
* stream inside one or more storages — required for the `\u0006DataSpaces`
|
|
43
|
+
* structure that Office demands in encrypted documents.
|
|
33
44
|
*
|
|
34
45
|
* @param entries - Named stream entries to include.
|
|
35
46
|
* @returns The CFB file as a Uint8Array.
|
|
@@ -991,6 +991,17 @@ export interface TableProperties {
|
|
|
991
991
|
readonly indent?: Twips;
|
|
992
992
|
/** Table look (conditional formatting). */
|
|
993
993
|
readonly look?: TableLook;
|
|
994
|
+
/**
|
|
995
|
+
* Number of rows in a single horizontal banding stripe (`w:tblStyleRowBandSize`).
|
|
996
|
+
* Defaults to 1 in Word. Set on table styles so the `band1Horz`/`band2Horz`
|
|
997
|
+
* conditional formats render as visible row banding.
|
|
998
|
+
*/
|
|
999
|
+
readonly rowBandSize?: number;
|
|
1000
|
+
/**
|
|
1001
|
+
* Number of columns in a single vertical banding stripe (`w:tblStyleColBandSize`).
|
|
1002
|
+
* Defaults to 1 in Word.
|
|
1003
|
+
*/
|
|
1004
|
+
readonly colBandSize?: number;
|
|
994
1005
|
/** Floating table properties. */
|
|
995
1006
|
readonly float?: TableFloat;
|
|
996
1007
|
/** Cell spacing in twips. */
|
|
@@ -1450,6 +1461,8 @@ export interface DrawingShape {
|
|
|
1450
1461
|
readonly noOutline?: boolean;
|
|
1451
1462
|
/** Text content inside the shape. */
|
|
1452
1463
|
readonly textContent?: readonly Paragraph[];
|
|
1464
|
+
/** Vertical anchoring of the text body inside the shape (a:bodyPr/@anchor). */
|
|
1465
|
+
readonly textBodyAnchor?: "t" | "ctr" | "b" | "just" | "dist";
|
|
1453
1466
|
/** Alternative text. */
|
|
1454
1467
|
readonly altText?: string;
|
|
1455
1468
|
/** Shape name. */
|
|
@@ -1475,6 +1488,10 @@ export interface DrawingShape {
|
|
|
1475
1488
|
readonly behindDoc?: boolean;
|
|
1476
1489
|
/** Rotation in 60,000ths of a degree. */
|
|
1477
1490
|
readonly rotation?: number;
|
|
1491
|
+
/** Flip the shape horizontally (a:xfrm/@flipH). */
|
|
1492
|
+
readonly flipHorizontal?: boolean;
|
|
1493
|
+
/** Flip the shape vertically (a:xfrm/@flipV). */
|
|
1494
|
+
readonly flipVertical?: boolean;
|
|
1478
1495
|
/** Raw XML string (for preserving unrecognized shape details on round-trip). */
|
|
1479
1496
|
readonly rawXml?: string;
|
|
1480
1497
|
/**
|
|
@@ -7,10 +7,16 @@
|
|
|
7
7
|
export declare const TWIPS_PER_INCH = 1440;
|
|
8
8
|
/** Twips per point. */
|
|
9
9
|
export declare const TWIPS_PER_POINT = 20;
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Twips per centimeter, derived exactly from 1 inch = 2.54 cm = 1440 twips
|
|
12
|
+
* (= 566.9291…). Using the exact factor — rather than the rounded 567 — keeps
|
|
13
|
+
* metric page sizes aligned with their canonical twip values, e.g.
|
|
14
|
+
* `cmToTwips(21)` → 11906 and `cmToTwips(29.7)` → 16838 (A4), matching
|
|
15
|
+
* `A4_PAGE_WIDTH` / `A4_PAGE_HEIGHT` in constants.ts.
|
|
16
|
+
*/
|
|
17
|
+
export declare const TWIPS_PER_CM: number;
|
|
18
|
+
/** Twips per millimeter, derived exactly from {@link TWIPS_PER_CM}. */
|
|
19
|
+
export declare const TWIPS_PER_MM: number;
|
|
14
20
|
/** EMU (English Metric Units) per inch — DrawingML coordinate space. */
|
|
15
21
|
export declare const EMU_PER_INCH = 914400;
|
|
16
22
|
/** EMU per centimeter. */
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
import type { XmlSink } from "../../xml/types.js";
|
|
8
8
|
import type { FloatingImage } from "../types.js";
|
|
9
9
|
/** Render a floating image as a standalone paragraph with wp:anchor. */
|
|
10
|
-
export declare function renderFloatingImage(xml: XmlSink, img: FloatingImage, imageRemap?: ReadonlyMap<string, string
|
|
10
|
+
export declare function renderFloatingImage(xml: XmlSink, img: FloatingImage, imageRemap?: ReadonlyMap<string, string>, nextDocPrId?: () => number): void;
|
|
@@ -29,6 +29,21 @@ export interface RenderHelpers {
|
|
|
29
29
|
readonly imageRemap?: ReadonlyMap<string, string>;
|
|
30
30
|
/** See WordRenderContext.hyperlinkRIds. */
|
|
31
31
|
readonly hyperlinkRIds?: ReadonlyWeakMap<object, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Allocates the next document-wide unique drawing object id, used for
|
|
34
|
+
* `wp:docPr/@id` (and the matching `pic:cNvPr/@id` / `wps:cNvPr/@id`).
|
|
35
|
+
*
|
|
36
|
+
* Word requires every drawing object id to be a unique positive integer
|
|
37
|
+
* across the entire document — including body, headers, footers, footnotes,
|
|
38
|
+
* endnotes, comments and text boxes. The packager seeds a single counter on
|
|
39
|
+
* the render context and exposes it here so every drawing renderer draws
|
|
40
|
+
* from the same id space, regardless of what (possibly duplicate or unset)
|
|
41
|
+
* `drawingId` the model carries.
|
|
42
|
+
*
|
|
43
|
+
* When undefined (e.g. a standalone renderer call without a context),
|
|
44
|
+
* renderers fall back to the model's `drawingId` or `1`.
|
|
45
|
+
*/
|
|
46
|
+
readonly nextDocPrId?: () => number;
|
|
32
47
|
/**
|
|
33
48
|
* Raw XML output policy. Controls how preserved/opaque rawXml fragments
|
|
34
49
|
* (opaqueRun, opaqueParagraphChild, opaqueDrawing, _advancedFillXml, …)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cj-tech-master/excelts",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.1",
|
|
4
4
|
"description": "Zero-dependency TypeScript toolkit — Excel (XLSX), PDF, CSV, Markdown, XML, ZIP/TAR, and streaming.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"archive",
|
|
@@ -340,7 +340,7 @@
|
|
|
340
340
|
"test:browser": "pnpm generate:csv-worker && rimraf dist && pnpm build:browser:bundle && vitest run --config vitest.browser.config.ts",
|
|
341
341
|
"test:watch": "vitest",
|
|
342
342
|
"build": "pnpm generate:csv-worker && rimraf dist && concurrently \"pnpm build:esm\" \"pnpm build:cjs\" \"pnpm build:browser\" \"pnpm build:browser:bundle\" && pnpm build:verify",
|
|
343
|
-
"build:verify": "tsc --noEmit --ignoreConfig --module NodeNext --moduleResolution NodeNext --lib ESNext
|
|
343
|
+
"build:verify": "tsc --noEmit --ignoreConfig --module NodeNext --moduleResolution NodeNext --lib ESNext --types node dist/types/index.d.ts dist/types/modules/archive/index.d.ts dist/types/modules/csv/index.d.ts dist/types/modules/formula/index.d.ts dist/types/modules/markdown/index.d.ts dist/types/modules/pdf/index.d.ts dist/types/modules/stream/index.d.ts dist/types/modules/xml/index.d.ts dist/types/modules/word/index.d.ts dist/types/modules/word/html.d.ts dist/types/modules/word/crypto.d.ts dist/types/modules/word/markdown.d.ts dist/types/modules/word/excel.d.ts",
|
|
344
344
|
"verify:treeshake": "node scripts/treeshake-verify.ts",
|
|
345
345
|
"analyze:browser": "rimraf dist && node --input-type=module -e \"import { execSync } from 'node:child_process'; process.env.ANALYZE='true'; execSync('rolldown -c rolldown.config.ts', { stdio: 'inherit' });\"",
|
|
346
346
|
"clean": "pnpm dlx --reporter=silent rimraf \"**/node_modules\" pnpm-lock.yaml \"**/dist\" -g && pnpm i",
|