@cj-tech-master/excelts 4.0.4 → 4.1.0-canary.20260110032830.e7d8c4e
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/index.browser.d.ts +2 -0
- package/dist/browser/index.browser.js +1 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/index.js +1 -0
- package/dist/browser/modules/excel/cell.js +39 -1
- package/dist/browser/modules/excel/enums.d.ts +2 -1
- package/dist/browser/modules/excel/enums.js +2 -1
- package/dist/browser/modules/excel/form-control.d.ts +157 -0
- package/dist/browser/modules/excel/form-control.js +267 -0
- package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +1 -0
- package/dist/browser/modules/excel/stream/workbook-writer.browser.js +19 -1
- package/dist/browser/modules/excel/table.d.ts +6 -2
- package/dist/browser/modules/excel/table.js +33 -5
- package/dist/browser/modules/excel/types.d.ts +5 -1
- package/dist/browser/modules/excel/utils/ooxml-paths.d.ts +4 -0
- package/dist/browser/modules/excel/utils/ooxml-paths.js +12 -2
- package/dist/browser/modules/excel/worksheet.d.ts +32 -0
- package/dist/browser/modules/excel/worksheet.js +44 -1
- package/dist/browser/modules/excel/xlsx/rel-type.d.ts +2 -0
- package/dist/browser/modules/excel/xlsx/rel-type.js +3 -1
- package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +24 -1
- package/dist/browser/modules/excel/xlsx/xform/core/feature-property-bag-xform.d.ts +8 -0
- package/dist/browser/modules/excel/xlsx/xform/core/feature-property-bag-xform.js +36 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.d.ts +22 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +52 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/vml-drawing-xform.d.ts +44 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +181 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/cell-xform.js +5 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +24 -1
- package/dist/browser/modules/excel/xlsx/xform/style/style-xform.d.ts +2 -0
- package/dist/browser/modules/excel/xlsx/xform/style/style-xform.js +11 -0
- package/dist/browser/modules/excel/xlsx/xform/style/styles-xform.d.ts +2 -0
- package/dist/browser/modules/excel/xlsx/xform/style/styles-xform.js +28 -4
- package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +3 -0
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +43 -5
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/modules/excel/cell.js +39 -1
- package/dist/cjs/modules/excel/enums.js +2 -1
- package/dist/cjs/modules/excel/form-control.js +270 -0
- package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +19 -1
- package/dist/cjs/modules/excel/table.js +33 -5
- package/dist/cjs/modules/excel/utils/ooxml-paths.js +14 -2
- package/dist/cjs/modules/excel/worksheet.js +44 -1
- package/dist/cjs/modules/excel/xlsx/rel-type.js +3 -1
- package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +23 -0
- package/dist/cjs/modules/excel/xlsx/xform/core/feature-property-bag-xform.js +39 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +55 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +184 -0
- package/dist/cjs/modules/excel/xlsx/xform/sheet/cell-xform.js +5 -0
- package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +23 -0
- package/dist/cjs/modules/excel/xlsx/xform/style/style-xform.js +11 -0
- package/dist/cjs/modules/excel/xlsx/xform/style/styles-xform.js +28 -4
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +42 -4
- package/dist/esm/index.browser.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/modules/excel/cell.js +39 -1
- package/dist/esm/modules/excel/enums.js +2 -1
- package/dist/esm/modules/excel/form-control.js +267 -0
- package/dist/esm/modules/excel/stream/workbook-writer.browser.js +19 -1
- package/dist/esm/modules/excel/table.js +33 -5
- package/dist/esm/modules/excel/utils/ooxml-paths.js +12 -2
- package/dist/esm/modules/excel/worksheet.js +44 -1
- package/dist/esm/modules/excel/xlsx/rel-type.js +3 -1
- package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +24 -1
- package/dist/esm/modules/excel/xlsx/xform/core/feature-property-bag-xform.js +36 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +52 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +181 -0
- package/dist/esm/modules/excel/xlsx/xform/sheet/cell-xform.js +5 -0
- package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +24 -1
- package/dist/esm/modules/excel/xlsx/xform/style/style-xform.js +11 -0
- package/dist/esm/modules/excel/xlsx/xform/style/styles-xform.js +28 -4
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +43 -5
- package/dist/iife/excelts.iife.js +629 -40
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +30 -30
- package/dist/types/index.browser.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/modules/excel/enums.d.ts +2 -1
- package/dist/types/modules/excel/form-control.d.ts +157 -0
- package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +1 -0
- package/dist/types/modules/excel/table.d.ts +6 -2
- package/dist/types/modules/excel/types.d.ts +5 -1
- package/dist/types/modules/excel/utils/ooxml-paths.d.ts +4 -0
- package/dist/types/modules/excel/worksheet.d.ts +32 -0
- package/dist/types/modules/excel/xlsx/rel-type.d.ts +2 -0
- package/dist/types/modules/excel/xlsx/xform/core/feature-property-bag-xform.d.ts +8 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.d.ts +22 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/vml-drawing-xform.d.ts +44 -0
- package/dist/types/modules/excel/xlsx/xform/style/style-xform.d.ts +2 -0
- package/dist/types/modules/excel/xlsx/xform/style/styles-xform.d.ts +2 -0
- package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +3 -0
- package/package.json +9 -9
|
@@ -12,9 +12,11 @@ export { Image } from "./modules/excel/image.js";
|
|
|
12
12
|
export * from "./modules/excel/anchor.js";
|
|
13
13
|
export { Table } from "./modules/excel/table.js";
|
|
14
14
|
export { DataValidations } from "./modules/excel/data-validations.js";
|
|
15
|
+
export { FormCheckbox } from "./modules/excel/form-control.js";
|
|
15
16
|
export * from "./modules/excel/enums.js";
|
|
16
17
|
export * from "./modules/excel/types.js";
|
|
17
18
|
export type { PivotTable, PivotTableModel, PivotTableSource, CacheField, DataField, PivotTableSubtotal, ParsedCacheDefinition, ParsedCacheRecords } from "./modules/excel/pivot-table.js";
|
|
19
|
+
export type { FormCheckboxModel, FormCheckboxOptions, FormControlRange, FormControlAnchor } from "./modules/excel/form-control.js";
|
|
18
20
|
import { WorkbookWriter } from "./modules/excel/stream/workbook-writer.browser.js";
|
|
19
21
|
import { WorkbookReader } from "./modules/excel/stream/workbook-reader.browser.js";
|
|
20
22
|
import { WorksheetWriter } from "./modules/excel/stream/worksheet-writer.js";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { Image } from "./modules/excel/image.js";
|
|
|
8
8
|
export * from "./modules/excel/anchor.js";
|
|
9
9
|
export { Table } from "./modules/excel/table.js";
|
|
10
10
|
export { DataValidations } from "./modules/excel/data-validations.js";
|
|
11
|
+
export { FormCheckbox } from "./modules/excel/form-control.js";
|
|
11
12
|
export { WorkbookWriter } from "./modules/excel/stream/workbook-writer.js";
|
|
12
13
|
export { WorkbookReader } from "./modules/excel/stream/workbook-reader.js";
|
|
13
14
|
export { WorksheetWriter } from "./modules/excel/stream/worksheet-writer.js";
|
|
@@ -15,6 +16,7 @@ export { WorksheetReader } from "./modules/excel/stream/worksheet-reader.js";
|
|
|
15
16
|
export * from "./modules/excel/enums.js";
|
|
16
17
|
export * from "./modules/excel/types.js";
|
|
17
18
|
export type { PivotTable, PivotTableModel, PivotTableSource, CacheField, DataField, PivotTableSubtotal, ParsedCacheDefinition, ParsedCacheRecords } from "./modules/excel/pivot-table.js";
|
|
19
|
+
export type { FormCheckboxModel, FormCheckboxOptions, FormControlRange, FormControlAnchor } from "./modules/excel/form-control.js";
|
|
18
20
|
export type { WorkbookReaderOptions, ParseEvent, SharedStringEvent, WorksheetReadyEvent, HyperlinksEvent } from "./modules/excel/stream/workbook-reader.js";
|
|
19
21
|
export type { WorksheetReaderOptions, WorksheetEvent, RowEvent, HyperlinkEvent, WorksheetHyperlink } from "./modules/excel/stream/worksheet-reader.js";
|
|
20
22
|
export type { WorkbookWriterOptions, ZipOptions, ZlibOptions } from "./modules/excel/stream/workbook-writer.js";
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { Worksheet } from "./worksheet.js";
|
|
2
|
+
/**
|
|
3
|
+
* Form Control Checkbox - Legacy checkbox control compatible with Office 2007+ and WPS/LibreOffice
|
|
4
|
+
*
|
|
5
|
+
* Unlike the modern In-Cell Checkbox (which only works in Microsoft 365),
|
|
6
|
+
* Form Control Checkboxes are floating controls that work in virtually all
|
|
7
|
+
* spreadsheet applications.
|
|
8
|
+
*/
|
|
9
|
+
/** EMU (English Metric Units) to pixels conversion factor at 96 DPI */
|
|
10
|
+
export declare const EMU_PER_PIXEL = 9525;
|
|
11
|
+
/** EMU to points conversion factor */
|
|
12
|
+
export declare const EMU_PER_POINT = 12700;
|
|
13
|
+
/** Anchor position for form control placement */
|
|
14
|
+
export interface FormControlAnchor {
|
|
15
|
+
/** Column index (0-based) */
|
|
16
|
+
col: number;
|
|
17
|
+
/** Column offset in EMUs (1 pixel ≈ 9525 EMUs at 96 DPI) */
|
|
18
|
+
colOff: number;
|
|
19
|
+
/** Row index (0-based) */
|
|
20
|
+
row: number;
|
|
21
|
+
/** Row offset in EMUs */
|
|
22
|
+
rowOff: number;
|
|
23
|
+
}
|
|
24
|
+
/** Checkbox state values */
|
|
25
|
+
export type CheckboxState = "Checked" | "Unchecked" | "Mixed";
|
|
26
|
+
/** Options for adding a form control checkbox */
|
|
27
|
+
export interface FormCheckboxOptions {
|
|
28
|
+
/** Cell reference where the checkbox value (TRUE/FALSE) will be stored */
|
|
29
|
+
link?: string;
|
|
30
|
+
/** Initial checked state */
|
|
31
|
+
checked?: boolean;
|
|
32
|
+
/** Label text displayed next to the checkbox */
|
|
33
|
+
text?: string;
|
|
34
|
+
/** Whether to use flat appearance (no 3D effect) */
|
|
35
|
+
noThreeD?: boolean;
|
|
36
|
+
/** Whether to print the checkbox */
|
|
37
|
+
print?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** Internal model for form control checkbox */
|
|
40
|
+
export interface FormCheckboxModel {
|
|
41
|
+
/** Unique shape ID (e.g., 1025, 1026, ...) */
|
|
42
|
+
shapeId: number;
|
|
43
|
+
/** Control property ID (rId in relationships) */
|
|
44
|
+
ctrlPropId: number;
|
|
45
|
+
/** Top-left anchor */
|
|
46
|
+
tl: FormControlAnchor;
|
|
47
|
+
/** Bottom-right anchor */
|
|
48
|
+
br: FormControlAnchor;
|
|
49
|
+
/** Cell link (e.g., "$A$1") */
|
|
50
|
+
link?: string;
|
|
51
|
+
/** Checked state */
|
|
52
|
+
checked: CheckboxState;
|
|
53
|
+
/** Label text */
|
|
54
|
+
text: string;
|
|
55
|
+
/** Use flat appearance */
|
|
56
|
+
noThreeD: boolean;
|
|
57
|
+
/** Print control */
|
|
58
|
+
print: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** Range input for form control - can be a cell reference or position object */
|
|
61
|
+
export type FormControlRange = string | {
|
|
62
|
+
/** Top-left position */
|
|
63
|
+
tl: {
|
|
64
|
+
col: number;
|
|
65
|
+
row: number;
|
|
66
|
+
colOff?: number;
|
|
67
|
+
rowOff?: number;
|
|
68
|
+
} | string;
|
|
69
|
+
/** Bottom-right position (optional, defaults to reasonable size) */
|
|
70
|
+
br?: {
|
|
71
|
+
col: number;
|
|
72
|
+
row: number;
|
|
73
|
+
colOff?: number;
|
|
74
|
+
rowOff?: number;
|
|
75
|
+
} | string;
|
|
76
|
+
} | {
|
|
77
|
+
/** Start column (0-based) */
|
|
78
|
+
startCol: number;
|
|
79
|
+
/** Start row (0-based) */
|
|
80
|
+
startRow: number;
|
|
81
|
+
/** End column (0-based) */
|
|
82
|
+
endCol: number;
|
|
83
|
+
/** End row (0-based) */
|
|
84
|
+
endRow: number;
|
|
85
|
+
/** Column offset from start in EMUs */
|
|
86
|
+
startColOff?: number;
|
|
87
|
+
/** Row offset from start in EMUs */
|
|
88
|
+
startRowOff?: number;
|
|
89
|
+
/** Column offset from end in EMUs */
|
|
90
|
+
endColOff?: number;
|
|
91
|
+
/** Row offset from end in EMUs */
|
|
92
|
+
endRowOff?: number;
|
|
93
|
+
};
|
|
94
|
+
declare class FormCheckbox {
|
|
95
|
+
worksheet: Worksheet;
|
|
96
|
+
model: FormCheckboxModel;
|
|
97
|
+
constructor(worksheet: Worksheet, range: FormControlRange, options?: FormCheckboxOptions);
|
|
98
|
+
/**
|
|
99
|
+
* Get the checked state
|
|
100
|
+
*/
|
|
101
|
+
get checked(): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Set the checked state
|
|
104
|
+
*/
|
|
105
|
+
set checked(value: boolean);
|
|
106
|
+
/**
|
|
107
|
+
* Get the linked cell address
|
|
108
|
+
*/
|
|
109
|
+
get link(): string | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Set the linked cell address
|
|
112
|
+
*/
|
|
113
|
+
set link(value: string | undefined);
|
|
114
|
+
/**
|
|
115
|
+
* Get the label text
|
|
116
|
+
*/
|
|
117
|
+
get text(): string;
|
|
118
|
+
/**
|
|
119
|
+
* Set the label text
|
|
120
|
+
*/
|
|
121
|
+
set text(value: string);
|
|
122
|
+
/**
|
|
123
|
+
* Convert cell reference to absolute format (e.g., "A1" -> "$A$1")
|
|
124
|
+
*/
|
|
125
|
+
private _toAbsoluteRef;
|
|
126
|
+
/**
|
|
127
|
+
* Parse range input into anchor positions
|
|
128
|
+
*/
|
|
129
|
+
private _parseRange;
|
|
130
|
+
/**
|
|
131
|
+
* Convert anchor to VML anchor string format
|
|
132
|
+
* Format: "fromCol, fromColOff, fromRow, fromRowOff, toCol, toColOff, toRow, toRowOff"
|
|
133
|
+
* VML uses pixels for offsets
|
|
134
|
+
*/
|
|
135
|
+
getVmlAnchor(): string;
|
|
136
|
+
/**
|
|
137
|
+
* Get VML style string for positioning
|
|
138
|
+
*/
|
|
139
|
+
getVmlStyle(): string;
|
|
140
|
+
/**
|
|
141
|
+
* Get the numeric checked value for VML (0, 1, or 2)
|
|
142
|
+
*/
|
|
143
|
+
getVmlCheckedValue(): number;
|
|
144
|
+
/**
|
|
145
|
+
* Convert anchor to VML anchor string format from model
|
|
146
|
+
*/
|
|
147
|
+
static getVmlAnchor(model: FormCheckboxModel): string;
|
|
148
|
+
/**
|
|
149
|
+
* Get VML style string for positioning from model
|
|
150
|
+
*/
|
|
151
|
+
static getVmlStyle(model: FormCheckboxModel): string;
|
|
152
|
+
/**
|
|
153
|
+
* Get the numeric checked value for VML from model (0, 1, or 2)
|
|
154
|
+
*/
|
|
155
|
+
static getVmlCheckedValue(model: FormCheckboxModel): number;
|
|
156
|
+
}
|
|
157
|
+
export { FormCheckbox };
|
|
@@ -132,6 +132,7 @@ export declare abstract class WorkbookWriterBase<TWorksheetWriter extends Worksh
|
|
|
132
132
|
addApp(): Promise<void>;
|
|
133
133
|
addCore(): Promise<void>;
|
|
134
134
|
addSharedStrings(): Promise<void>;
|
|
135
|
+
addFeaturePropertyBag(): Promise<void>;
|
|
135
136
|
addWorkbookRels(): Promise<void>;
|
|
136
137
|
addWorkbook(): Promise<void>;
|
|
137
138
|
_finalize(): Promise<this>;
|
|
@@ -52,8 +52,12 @@ declare class Table {
|
|
|
52
52
|
set model(value: TableModel);
|
|
53
53
|
cacheState(): void;
|
|
54
54
|
commit(): void;
|
|
55
|
-
addRow(values: CellValue[], rowNumber?: number
|
|
56
|
-
|
|
55
|
+
addRow(values: CellValue[], rowNumber?: number, options?: {
|
|
56
|
+
commit?: boolean;
|
|
57
|
+
}): void;
|
|
58
|
+
removeRows(rowIndex: number, count?: number, options?: {
|
|
59
|
+
commit?: boolean;
|
|
60
|
+
}): void;
|
|
57
61
|
getColumn(colIndex: number): Column;
|
|
58
62
|
addColumn(column: TableColumnProperties, values: CellValue[], colIndex?: number): void;
|
|
59
63
|
removeColumns(colIndex: number, count?: number): void;
|
|
@@ -274,7 +274,11 @@ export interface CellSharedFormulaValue {
|
|
|
274
274
|
result?: number | string | boolean | Date | CellErrorValue;
|
|
275
275
|
date1904?: boolean;
|
|
276
276
|
}
|
|
277
|
-
export
|
|
277
|
+
export interface CellCheckboxValue {
|
|
278
|
+
/** Indicates this is a checkbox value */
|
|
279
|
+
checkbox: boolean;
|
|
280
|
+
}
|
|
281
|
+
export type CellValue = null | number | string | boolean | Date | undefined | CellErrorValue | CellRichTextValue | CellHyperlinkValue | CellFormulaValue | CellArrayFormulaValue | CellSharedFormulaValue | CellCheckboxValue;
|
|
278
282
|
export interface CommentMargins {
|
|
279
283
|
insetmode: "auto" | "custom";
|
|
280
284
|
inset: number[];
|
|
@@ -8,6 +8,7 @@ export declare const OOXML_PATHS: {
|
|
|
8
8
|
readonly xlSharedStrings: "xl/sharedStrings.xml";
|
|
9
9
|
readonly xlStyles: "xl/styles.xml";
|
|
10
10
|
readonly xlTheme1: "xl/theme/theme1.xml";
|
|
11
|
+
readonly xlFeaturePropertyBag: "xl/featurePropertyBag/featurePropertyBag.xml";
|
|
11
12
|
};
|
|
12
13
|
export declare function normalizeZipPath(path: string): string;
|
|
13
14
|
export declare function getWorksheetNoFromWorksheetPath(path: string): number | undefined;
|
|
@@ -50,6 +51,7 @@ export declare const OOXML_REL_TARGETS: {
|
|
|
50
51
|
readonly workbookStyles: "styles.xml";
|
|
51
52
|
readonly workbookSharedStrings: "sharedStrings.xml";
|
|
52
53
|
readonly workbookTheme1: "theme/theme1.xml";
|
|
54
|
+
readonly workbookFeaturePropertyBag: "featurePropertyBag/featurePropertyBag.xml";
|
|
53
55
|
};
|
|
54
56
|
export declare function pivotCacheDefinitionRelTargetFromWorkbook(n: number | string): string;
|
|
55
57
|
export declare function commentsRelTargetFromWorksheet(sheetId: number | string): string;
|
|
@@ -62,3 +64,5 @@ export declare function pivotTableRelTargetFromWorksheetName(pivotName: string):
|
|
|
62
64
|
export declare function tableRelTargetFromWorksheet(target: string): string;
|
|
63
65
|
export declare function tableRelTargetFromWorksheetName(name: string): string;
|
|
64
66
|
export declare function mediaRelTargetFromRels(filename: string): string;
|
|
67
|
+
export declare function ctrlPropPath(id: number | string): string;
|
|
68
|
+
export declare function ctrlPropRelTargetFromWorksheet(id: number | string): string;
|
|
@@ -5,6 +5,7 @@ import type { Cell, FormulaResult } from "./cell.js";
|
|
|
5
5
|
import { Image, type ImageModel } from "./image.js";
|
|
6
6
|
import { Table, type TableModel } from "./table.js";
|
|
7
7
|
import { DataValidations } from "./data-validations.js";
|
|
8
|
+
import { FormCheckbox, type FormCheckboxModel, type FormCheckboxOptions, type FormControlRange } from "./form-control.js";
|
|
8
9
|
import { type PivotTable, type PivotTableModel } from "./pivot-table.js";
|
|
9
10
|
import type { Workbook } from "./workbook.js";
|
|
10
11
|
import type { AddImageRange, AutoFilter, CellValue, ColBreak, ConditionalFormattingOptions, DataValidation, RowBreak, RowValues, TableProperties, WorksheetProperties, WorksheetView } from "./types.js";
|
|
@@ -104,6 +105,7 @@ interface WorksheetModel {
|
|
|
104
105
|
tables: TableModel[];
|
|
105
106
|
pivotTables: PivotTable[];
|
|
106
107
|
conditionalFormattings: ConditionalFormattingOptions[];
|
|
108
|
+
formControls: FormCheckboxModel[];
|
|
107
109
|
cols?: ColumnModel[];
|
|
108
110
|
rows?: RowModel[];
|
|
109
111
|
dimensions?: Range;
|
|
@@ -135,6 +137,7 @@ declare class Worksheet {
|
|
|
135
137
|
};
|
|
136
138
|
pivotTables: PivotTable[];
|
|
137
139
|
conditionalFormattings: ConditionalFormattingOptions[];
|
|
140
|
+
formControls: FormCheckbox[];
|
|
138
141
|
private _headerRowCount?;
|
|
139
142
|
constructor(options: WorksheetOptions);
|
|
140
143
|
get name(): string;
|
|
@@ -295,6 +298,35 @@ declare class Worksheet {
|
|
|
295
298
|
*/
|
|
296
299
|
addBackgroundImage(imageId: string | number): void;
|
|
297
300
|
getBackgroundImageId(): string | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* Add a form control checkbox to the worksheet.
|
|
303
|
+
*
|
|
304
|
+
* Form control checkboxes are the legacy style that work in Office 2007+,
|
|
305
|
+
* WPS Office, LibreOffice, and other spreadsheet applications.
|
|
306
|
+
*
|
|
307
|
+
* Unlike modern in-cell checkboxes (which only work in Microsoft 365),
|
|
308
|
+
* form control checkboxes are floating controls positioned over cells.
|
|
309
|
+
*
|
|
310
|
+
* @param range - Cell reference (e.g., "B2") or range (e.g., "B2:D3") for positioning
|
|
311
|
+
* @param options - Checkbox options
|
|
312
|
+
* @returns The created FormCheckbox instance
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* // Simple checkbox at B2
|
|
316
|
+
* ws.addFormCheckbox("B2");
|
|
317
|
+
*
|
|
318
|
+
* // Checkbox with label and linked cell
|
|
319
|
+
* ws.addFormCheckbox("B2:D3", {
|
|
320
|
+
* text: "Accept terms",
|
|
321
|
+
* link: "A2",
|
|
322
|
+
* checked: false
|
|
323
|
+
* });
|
|
324
|
+
*/
|
|
325
|
+
addFormCheckbox(range: FormControlRange, options?: FormCheckboxOptions): FormCheckbox;
|
|
326
|
+
/**
|
|
327
|
+
* Get all form control checkboxes in the worksheet
|
|
328
|
+
*/
|
|
329
|
+
getFormCheckboxes(): FormCheckbox[];
|
|
298
330
|
/**
|
|
299
331
|
* Protect the worksheet with optional password and options
|
|
300
332
|
*/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseXform } from "../base-xform.js";
|
|
2
|
+
import type { FormCheckboxModel } from "../../../form-control.js";
|
|
3
|
+
/**
|
|
4
|
+
* Control Properties Xform - Generates ctrlProp*.xml for form controls
|
|
5
|
+
*
|
|
6
|
+
* Each form control (checkbox, button, etc.) has an associated ctrlProp file
|
|
7
|
+
* that stores its properties like objectType, checked state, and linked cell.
|
|
8
|
+
*/
|
|
9
|
+
declare class CtrlPropXform extends BaseXform {
|
|
10
|
+
model: FormCheckboxModel;
|
|
11
|
+
get tag(): string;
|
|
12
|
+
render(xmlStream: any, model?: FormCheckboxModel): void;
|
|
13
|
+
/**
|
|
14
|
+
* Generate XML string directly (convenience method)
|
|
15
|
+
* Uses render() internally to ensure consistency
|
|
16
|
+
*/
|
|
17
|
+
toXml(model: FormCheckboxModel): string;
|
|
18
|
+
parseOpen(): boolean;
|
|
19
|
+
parseText(): void;
|
|
20
|
+
parseClose(): boolean;
|
|
21
|
+
}
|
|
22
|
+
export { CtrlPropXform };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BaseXform } from "../base-xform.js";
|
|
2
|
+
import { type FormCheckboxModel } from "../../../form-control.js";
|
|
3
|
+
/**
|
|
4
|
+
* Unified VML Drawing Xform - Combines Notes (comments) and Form Controls
|
|
5
|
+
*
|
|
6
|
+
* Excel uses a single VML file per worksheet that can contain:
|
|
7
|
+
* - Comment/note shapes (shapetype 202)
|
|
8
|
+
* - Form control shapes (checkbox shapetype 201, etc.)
|
|
9
|
+
*
|
|
10
|
+
* This unified xform renders both into a single VML file.
|
|
11
|
+
*/
|
|
12
|
+
interface VmlDrawingModel {
|
|
13
|
+
/** Comment/note shapes */
|
|
14
|
+
comments?: any[];
|
|
15
|
+
/** Form control checkboxes */
|
|
16
|
+
formControls?: FormCheckboxModel[];
|
|
17
|
+
}
|
|
18
|
+
declare class VmlDrawingXform extends BaseXform {
|
|
19
|
+
map: {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
parser: any;
|
|
23
|
+
model: VmlDrawingModel;
|
|
24
|
+
constructor();
|
|
25
|
+
get tag(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Render VML drawing containing both notes and form controls
|
|
28
|
+
*/
|
|
29
|
+
render(xmlStream: any, model?: VmlDrawingModel): void;
|
|
30
|
+
/**
|
|
31
|
+
* Render a checkbox form control shape
|
|
32
|
+
*/
|
|
33
|
+
private _renderCheckboxShape;
|
|
34
|
+
parseOpen(node: any): boolean;
|
|
35
|
+
parseText(text: string): void;
|
|
36
|
+
parseClose(name: string): boolean;
|
|
37
|
+
static DRAWING_ATTRIBUTES: {
|
|
38
|
+
"xmlns:v": string;
|
|
39
|
+
"xmlns:o": string;
|
|
40
|
+
"xmlns:x": string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export { VmlDrawingXform };
|
|
44
|
+
export type { VmlDrawingModel };
|
|
@@ -11,6 +11,7 @@ interface StylesModel {
|
|
|
11
11
|
declare class StylesXform extends BaseXform {
|
|
12
12
|
private index?;
|
|
13
13
|
private weakMap?;
|
|
14
|
+
private _hasCheckboxes?;
|
|
14
15
|
parser: any;
|
|
15
16
|
static Mock: typeof StylesXform;
|
|
16
17
|
constructor(initialise?: boolean);
|
|
@@ -24,6 +25,7 @@ declare class StylesXform extends BaseXform {
|
|
|
24
25
|
getStyleModel(id: number): any;
|
|
25
26
|
addDxfStyle(style: any): number;
|
|
26
27
|
getDxfStyle(id: number): any;
|
|
28
|
+
get hasCheckboxes(): boolean;
|
|
27
29
|
_addStyle(style: any): number;
|
|
28
30
|
_addNumFmtStr(formatCode: string): number;
|
|
29
31
|
_addFont(font: any): number;
|
|
@@ -92,6 +92,8 @@ declare class XLSX {
|
|
|
92
92
|
PivotCacheDefinition: string;
|
|
93
93
|
PivotCacheRecords: string;
|
|
94
94
|
PivotTable: string;
|
|
95
|
+
FeaturePropertyBag: string;
|
|
96
|
+
CtrlProp: string;
|
|
95
97
|
};
|
|
96
98
|
constructor(workbook: Workbook);
|
|
97
99
|
/**
|
|
@@ -195,6 +197,7 @@ declare class XLSX {
|
|
|
195
197
|
addThemes(zip: IZipWriter, model: any): Promise<void>;
|
|
196
198
|
addOfficeRels(zip: IZipWriter, _model: any): Promise<void>;
|
|
197
199
|
addWorkbookRels(zip: IZipWriter, model: any): Promise<void>;
|
|
200
|
+
addFeaturePropertyBag(zip: IZipWriter, model: any): Promise<void>;
|
|
198
201
|
addSharedStrings(zip: IZipWriter, model: any): Promise<void>;
|
|
199
202
|
addStyles(zip: IZipWriter, model: any): Promise<void>;
|
|
200
203
|
addWorkbook(zip: IZipWriter, model: any): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cj-tech-master/excelts",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.1.0-canary.20260110032830.e7d8c4e",
|
|
4
4
|
"description": "TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@eslint/js": "^9.39.2",
|
|
89
89
|
"@types/node": "^25.0.3",
|
|
90
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
91
|
-
"@typescript-eslint/parser": "^8.
|
|
92
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
90
|
+
"@typescript-eslint/eslint-plugin": "^8.52.0",
|
|
91
|
+
"@typescript-eslint/parser": "^8.52.0",
|
|
92
|
+
"@typescript/native-preview": "^7.0.0-dev.20260108.1",
|
|
93
93
|
"@vitest/browser": "^4.0.16",
|
|
94
94
|
"@vitest/browser-playwright": "^4.0.16",
|
|
95
95
|
"@vitest/ui": "^4.0.16",
|
|
@@ -99,17 +99,17 @@
|
|
|
99
99
|
"eslint-config-prettier": "^10.1.8",
|
|
100
100
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
101
101
|
"eslint-plugin-import-x": "^4.16.1",
|
|
102
|
-
"eslint-plugin-oxlint": "^1.
|
|
102
|
+
"eslint-plugin-oxlint": "^1.38.0",
|
|
103
103
|
"eslint-plugin-unused-imports": "^4.3.0",
|
|
104
104
|
"husky": "^9.1.7",
|
|
105
|
-
"oxlint": "^1.
|
|
105
|
+
"oxlint": "^1.38.0",
|
|
106
106
|
"playwright": "^1.57.0",
|
|
107
107
|
"prettier": "^3.7.4",
|
|
108
108
|
"rimraf": "^6.1.2",
|
|
109
|
-
"rolldown": "^1.0.0-beta.
|
|
109
|
+
"rolldown": "^1.0.0-beta.59",
|
|
110
110
|
"rollup-plugin-visualizer": "^6.0.5",
|
|
111
111
|
"typescript": "^5.9.3",
|
|
112
|
-
"typescript-eslint": "^8.
|
|
112
|
+
"typescript-eslint": "^8.52.0",
|
|
113
113
|
"vite-tsconfig-paths": "^6.0.3",
|
|
114
114
|
"vitest": "^4.0.16"
|
|
115
115
|
},
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"test:browser": "rimraf dist && npm run build:browser:bundle && vitest run --config vitest.browser.config.ts",
|
|
121
121
|
"test:watch": "vitest",
|
|
122
122
|
"build": "rimraf dist && concurrently \"npm run build:esm\" \"npm run build:cjs\" \"npm run build:browser\" \"npm run build:browser:bundle\" && npm run build:verify",
|
|
123
|
-
"build:verify": "
|
|
123
|
+
"build:verify": "tsc --noEmit --module NodeNext --moduleResolution NodeNext dist/types/index.d.ts",
|
|
124
124
|
"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' });\"",
|
|
125
125
|
"clean": "pnpm dlx --reporter=silent rimraf \"**/node_modules\" pnpm-lock.yaml \"**/dist\" -g && pnpm i",
|
|
126
126
|
"lint": "eslint && oxlint",
|