@docx4j/core-ts 0.1.1 → 0.1.2
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/opc/ContentTypes.d.mts +10 -0
- package/dist/opc/ContentTypes.mjs +13 -0
- package/dist/parts/Namespaces.d.mts +18 -0
- package/dist/parts/Namespaces.mjs +20 -0
- package/dist/parts/Part.d.mts +6 -0
- package/dist/parts/Part.mjs +13 -0
- package/dist/parts/PartRegistry.mjs +12 -1
- package/dist/parts/sml/index.d.mts +61 -0
- package/dist/parts/sml/index.mjs +98 -4
- package/package.json +2 -2
|
@@ -92,6 +92,16 @@ export declare const ContentTypes: {
|
|
|
92
92
|
readonly SPREADSHEETML_COMMENTS: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml";
|
|
93
93
|
readonly SPREADSHEETML_CONNECTIONS: "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml";
|
|
94
94
|
readonly SPREADSHEETML_EXTERNAL_LINK: "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml";
|
|
95
|
+
readonly SPREADSHEETML_SLICER_CACHE: "application/vnd.ms-excel.slicerCache+xml";
|
|
96
|
+
readonly SPREADSHEETML_SLICERS: "application/vnd.ms-excel.slicer+xml";
|
|
97
|
+
readonly SPREADSHEETML_TIMELINE_CACHE: "application/vnd.ms-excel.timelineCache+xml";
|
|
98
|
+
readonly SPREADSHEETML_TIMELINES: "application/vnd.ms-excel.timeline+xml";
|
|
99
|
+
readonly SPREADSHEETML_CONTROL_PROPERTIES: "application/vnd.ms-excel.controlproperties+xml";
|
|
100
|
+
readonly SPREADSHEETML_CUSTOM_DATA_PROPERTIES: "application/vnd.openxmlformats-officedocument.customDataProperties+xml";
|
|
101
|
+
/** Generic, so `CustomDataPart` is registered by relationship type instead. */
|
|
102
|
+
readonly SPREADSHEETML_CUSTOM_DATA: "application/binary";
|
|
103
|
+
readonly SPREADSHEETML_SURVEY: "application/vnd.ms-excel.Survey+xml";
|
|
104
|
+
readonly SPREADSHEETML_DATA_MODEL: "application/vnd.openxmlformats-officedocument.model+data";
|
|
95
105
|
readonly DIGITAL_SIGNATURE_ORIGIN_PART: "application/vnd.openxmlformats-package.digital-signature-origin";
|
|
96
106
|
readonly DIGITAL_SIGNATURE_XML_SIGNATURE_PART: "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml";
|
|
97
107
|
readonly INK_ML: "application/inkml+xml";
|
|
@@ -92,6 +92,19 @@ export const ContentTypes = {
|
|
|
92
92
|
SPREADSHEETML_COMMENTS: 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml',
|
|
93
93
|
SPREADSHEETML_CONNECTIONS: 'application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml',
|
|
94
94
|
SPREADSHEETML_EXTERNAL_LINK: 'application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml',
|
|
95
|
+
// The Excel 2010 and 2013 extension parts ([MS-XLSX] 2.1; docx4j 17.2.0 CR-022, CR-004 here).
|
|
96
|
+
// The strings are Excel 365's as docx4j measured them: the timeline pair is lowercase, and
|
|
97
|
+
// the survey's capital S is Excel's too.
|
|
98
|
+
SPREADSHEETML_SLICER_CACHE: 'application/vnd.ms-excel.slicerCache+xml',
|
|
99
|
+
SPREADSHEETML_SLICERS: 'application/vnd.ms-excel.slicer+xml',
|
|
100
|
+
SPREADSHEETML_TIMELINE_CACHE: 'application/vnd.ms-excel.timelineCache+xml',
|
|
101
|
+
SPREADSHEETML_TIMELINES: 'application/vnd.ms-excel.timeline+xml',
|
|
102
|
+
SPREADSHEETML_CONTROL_PROPERTIES: 'application/vnd.ms-excel.controlproperties+xml',
|
|
103
|
+
SPREADSHEETML_CUSTOM_DATA_PROPERTIES: 'application/vnd.openxmlformats-officedocument.customDataProperties+xml',
|
|
104
|
+
/** Generic, so `CustomDataPart` is registered by relationship type instead. */
|
|
105
|
+
SPREADSHEETML_CUSTOM_DATA: 'application/binary',
|
|
106
|
+
SPREADSHEETML_SURVEY: 'application/vnd.ms-excel.Survey+xml',
|
|
107
|
+
SPREADSHEETML_DATA_MODEL: 'application/vnd.openxmlformats-officedocument.model+data',
|
|
95
108
|
DIGITAL_SIGNATURE_ORIGIN_PART: 'application/vnd.openxmlformats-package.digital-signature-origin',
|
|
96
109
|
DIGITAL_SIGNATURE_XML_SIGNATURE_PART: 'application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml',
|
|
97
110
|
INK_ML: 'application/inkml+xml',
|
|
@@ -91,6 +91,24 @@ export declare const Namespaces: {
|
|
|
91
91
|
readonly SPREADSHEETML_PIVOT_CACHE_DEFINITION: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition";
|
|
92
92
|
readonly SPREADSHEETML_PIVOT_CACHE_RECORDS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords";
|
|
93
93
|
readonly SPREADSHEETML_EXTERNAL_LINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink";
|
|
94
|
+
/** `/xl/slicerCaches/slicerCache1.xml`, from the workbook. */
|
|
95
|
+
readonly SPREADSHEETML_SLICER_CACHE: "http://schemas.microsoft.com/office/2007/relationships/slicerCache";
|
|
96
|
+
/** `/xl/slicers/slicer1.xml`, from a worksheet. */
|
|
97
|
+
readonly SPREADSHEETML_SLICERS: "http://schemas.microsoft.com/office/2007/relationships/slicer";
|
|
98
|
+
/** `/xl/timelineCaches/timelineCache1.xml`, from the workbook. */
|
|
99
|
+
readonly SPREADSHEETML_TIMELINE_CACHE: "http://schemas.microsoft.com/office/2011/relationships/timelineCache";
|
|
100
|
+
/** `/xl/timelines/timeline1.xml`, from a worksheet. */
|
|
101
|
+
readonly SPREADSHEETML_TIMELINES: "http://schemas.microsoft.com/office/2011/relationships/timeline";
|
|
102
|
+
/** `/xl/ctrlProps/ctrlProp1.xml`, from a worksheet, for one of its form controls. */
|
|
103
|
+
readonly SPREADSHEETML_CONTROL_PROPERTIES: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp";
|
|
104
|
+
/** `/xl/customDataProps/customDataProps1.xml`, from the workbook. */
|
|
105
|
+
readonly SPREADSHEETML_CUSTOM_DATA_PROPERTIES: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customDataProps";
|
|
106
|
+
/** `/xl/customData/customData1.dat`, from its properties part. */
|
|
107
|
+
readonly SPREADSHEETML_CUSTOM_DATA: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customData";
|
|
108
|
+
/** `/xl/surveys/survey1.xml`, from the workbook. */
|
|
109
|
+
readonly SPREADSHEETML_SURVEY: "http://schemas.microsoft.com/office/2010/relationships/Survey";
|
|
110
|
+
/** `/xl/model/item.data` ([MS-XLDM]), from the workbook. */
|
|
111
|
+
readonly SPREADSHEETML_DATA_MODEL: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/powerPivotData";
|
|
94
112
|
readonly WEB_EXTENSION_TASKPANES: "http://schemas.microsoft.com/office/webextensions/taskpanes/2010/11";
|
|
95
113
|
readonly WEB_EXTENSION_WEBEXTENSION: "http://schemas.microsoft.com/office/webextensions/webextension/2010/11";
|
|
96
114
|
readonly XML_EVENTS: "http://www.w3.org/2001/xml-events";
|
|
@@ -91,6 +91,26 @@ export const Namespaces = {
|
|
|
91
91
|
SPREADSHEETML_PIVOT_CACHE_DEFINITION: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition',
|
|
92
92
|
SPREADSHEETML_PIVOT_CACHE_RECORDS: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords',
|
|
93
93
|
SPREADSHEETML_EXTERNAL_LINK: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink',
|
|
94
|
+
// The Excel 2010 and 2013 extension parts (CR-004): slicers and their caches are 2007,
|
|
95
|
+
// timelines 2011, the survey 2010; the rest are the officeDocument ones.
|
|
96
|
+
/** `/xl/slicerCaches/slicerCache1.xml`, from the workbook. */
|
|
97
|
+
SPREADSHEETML_SLICER_CACHE: 'http://schemas.microsoft.com/office/2007/relationships/slicerCache',
|
|
98
|
+
/** `/xl/slicers/slicer1.xml`, from a worksheet. */
|
|
99
|
+
SPREADSHEETML_SLICERS: 'http://schemas.microsoft.com/office/2007/relationships/slicer',
|
|
100
|
+
/** `/xl/timelineCaches/timelineCache1.xml`, from the workbook. */
|
|
101
|
+
SPREADSHEETML_TIMELINE_CACHE: 'http://schemas.microsoft.com/office/2011/relationships/timelineCache',
|
|
102
|
+
/** `/xl/timelines/timeline1.xml`, from a worksheet. */
|
|
103
|
+
SPREADSHEETML_TIMELINES: 'http://schemas.microsoft.com/office/2011/relationships/timeline',
|
|
104
|
+
/** `/xl/ctrlProps/ctrlProp1.xml`, from a worksheet, for one of its form controls. */
|
|
105
|
+
SPREADSHEETML_CONTROL_PROPERTIES: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp',
|
|
106
|
+
/** `/xl/customDataProps/customDataProps1.xml`, from the workbook. */
|
|
107
|
+
SPREADSHEETML_CUSTOM_DATA_PROPERTIES: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/customDataProps',
|
|
108
|
+
/** `/xl/customData/customData1.dat`, from its properties part. */
|
|
109
|
+
SPREADSHEETML_CUSTOM_DATA: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/customData',
|
|
110
|
+
/** `/xl/surveys/survey1.xml`, from the workbook. */
|
|
111
|
+
SPREADSHEETML_SURVEY: 'http://schemas.microsoft.com/office/2010/relationships/Survey',
|
|
112
|
+
/** `/xl/model/item.data` ([MS-XLDM]), from the workbook. */
|
|
113
|
+
SPREADSHEETML_DATA_MODEL: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/powerPivotData',
|
|
94
114
|
WEB_EXTENSION_TASKPANES: 'http://schemas.microsoft.com/office/webextensions/taskpanes/2010/11',
|
|
95
115
|
WEB_EXTENSION_WEBEXTENSION: 'http://schemas.microsoft.com/office/webextensions/webextension/2010/11',
|
|
96
116
|
XML_EVENTS: 'http://www.w3.org/2001/xml-events',
|
package/dist/parts/Part.d.mts
CHANGED
|
@@ -39,6 +39,12 @@ export declare abstract class Part implements RelationshipSource {
|
|
|
39
39
|
* its content type in the content type manager, and a relationship in this part's relationships.
|
|
40
40
|
*/
|
|
41
41
|
addTargetPart(target: Part, mode?: AddPartBehaviour, proposedRelId?: string): Relationship;
|
|
42
|
+
/**
|
|
43
|
+
* This part's targets of one relationship type that are instances of a class, in relationship
|
|
44
|
+
* order: what a shortcut for a collection of parts (a sheet's slicers, a workbook's slicer
|
|
45
|
+
* caches) is made of.
|
|
46
|
+
*/
|
|
47
|
+
protected partsByRelationshipType<T extends Part>(relationshipType: string, cls: abstract new (...args: never[]) => T): T[];
|
|
42
48
|
/** Subclasses keep typed references to well-known targets (styles, numbering, ...); returns true when one was set. */
|
|
43
49
|
setPartShortcut(_part: Part, _relationshipType: string): boolean;
|
|
44
50
|
/** The bytes this part was loaded from, if it came from a container. Undefined for new parts. */
|
package/dist/parts/Part.mjs
CHANGED
|
@@ -47,6 +47,19 @@ export class Part {
|
|
|
47
47
|
this.setPartShortcut(target, target.relationshipType);
|
|
48
48
|
return rel;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* This part's targets of one relationship type that are instances of a class, in relationship
|
|
52
|
+
* order: what a shortcut for a collection of parts (a sheet's slicers, a workbook's slicer
|
|
53
|
+
* caches) is made of.
|
|
54
|
+
*/
|
|
55
|
+
partsByRelationshipType(relationshipType, cls) {
|
|
56
|
+
const rp = this.relationshipsPart;
|
|
57
|
+
if (!rp)
|
|
58
|
+
return [];
|
|
59
|
+
return rp.getRelationshipsByType(relationshipType)
|
|
60
|
+
.map((r) => rp.getPart(r))
|
|
61
|
+
.filter((p) => p instanceof cls);
|
|
62
|
+
}
|
|
50
63
|
/** Subclasses keep typed references to well-known targets (styles, numbering, ...); returns true when one was set. */
|
|
51
64
|
setPartShortcut(_part, _relationshipType) {
|
|
52
65
|
return false;
|
|
@@ -61,6 +61,7 @@ export const defaultPartRegistry = new PartRegistry()
|
|
|
61
61
|
.registerForRelationship(Namespaces.EMBEDDED_PKG, (n, ct) => new EmbeddedPackagePart(n, ct))
|
|
62
62
|
.registerForRelationship(Namespaces.OLE_OBJECT, (n, ct) => new OleObjectBinaryPart(n, ct))
|
|
63
63
|
.registerForRelationship(Namespaces.CUSTOM_XML_DATA_STORAGE, (n, ct) => new CustomXmlDataStoragePart(n, ct))
|
|
64
|
+
.registerForRelationship(Namespaces.SPREADSHEETML_CUSTOM_DATA, (n, ct) => new sml.CustomDataPart(n, ct))
|
|
64
65
|
.register(ContentTypes.WORDPROCESSINGML_DOCUMENT, (n, ct) => new wml.MainDocumentPart(n, ct))
|
|
65
66
|
.register(ContentTypes.WORDPROCESSINGML_DOCUMENT_MACROENABLED, (n, ct) => new wml.MainDocumentPart(n, ct))
|
|
66
67
|
.register(ContentTypes.WORDPROCESSINGML_TEMPLATE, (n, ct) => new wml.MainDocumentPart(n, ct))
|
|
@@ -140,4 +141,14 @@ export const defaultPartRegistry = new PartRegistry()
|
|
|
140
141
|
.register(ContentTypes.SPREADSHEETML_QUERY_TABLE, (n) => new sml.QueryTablePart(n))
|
|
141
142
|
.register(ContentTypes.SPREADSHEETML_CONNECTIONS, (n) => new sml.ConnectionsPart(n))
|
|
142
143
|
.register(ContentTypes.SPREADSHEETML_EXTERNAL_LINK, (n) => new sml.ExternalLinkPart(n))
|
|
143
|
-
.register(ContentTypes.SPREADSHEETML_PRINTER_SETTINGS, (n) => new sml.PrinterSettingsPart(n))
|
|
144
|
+
.register(ContentTypes.SPREADSHEETML_PRINTER_SETTINGS, (n) => new sml.PrinterSettingsPart(n))
|
|
145
|
+
// The Excel 2010 and 2013 extension parts (CR-004). `CustomDataPart`'s content type is the
|
|
146
|
+
// generic `application/binary`, so it is registered by relationship type above instead.
|
|
147
|
+
.register(ContentTypes.SPREADSHEETML_SLICER_CACHE, (n) => new sml.SlicerCachePart(n))
|
|
148
|
+
.register(ContentTypes.SPREADSHEETML_SLICERS, (n) => new sml.SlicersPart(n))
|
|
149
|
+
.register(ContentTypes.SPREADSHEETML_TIMELINE_CACHE, (n) => new sml.TimelineCachePart(n))
|
|
150
|
+
.register(ContentTypes.SPREADSHEETML_TIMELINES, (n) => new sml.TimelinesPart(n))
|
|
151
|
+
.register(ContentTypes.SPREADSHEETML_CONTROL_PROPERTIES, (n) => new sml.ControlPropertiesPart(n))
|
|
152
|
+
.register(ContentTypes.SPREADSHEETML_CUSTOM_DATA_PROPERTIES, (n) => new sml.CustomDataPropertiesPart(n))
|
|
153
|
+
.register(ContentTypes.SPREADSHEETML_SURVEY, (n) => new sml.SurveyPart(n))
|
|
154
|
+
.register(ContentTypes.SPREADSHEETML_DATA_MODEL, (n) => new sml.DataModelPart(n));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as sml from '@docx4j/generated-objects-ts/modules/org_xlsx4j_sml';
|
|
2
2
|
import { XmlPart } from '../XmlPart.mjs';
|
|
3
|
+
import { DefaultXmlPart } from '../DefaultXmlPart.mjs';
|
|
3
4
|
import { BinaryPart } from '../BinaryPart.mjs';
|
|
4
5
|
import { Part } from '../Part.mjs';
|
|
5
6
|
import { PartName } from '../../opc/PartName.mjs';
|
|
@@ -9,6 +10,10 @@ export declare class WorkbookPart extends XmlPart<sml.Workbook> {
|
|
|
9
10
|
stylesPart: StylesPart | undefined;
|
|
10
11
|
themePart: ThemePart | undefined;
|
|
11
12
|
calcChainPart: CalcChainPart | undefined;
|
|
13
|
+
/** The workbook's survey part, if it has one (CR-004). */
|
|
14
|
+
surveyPart: SurveyPart | undefined;
|
|
15
|
+
/** The Power Pivot data model (`/xl/model/item.data`), if the workbook has one (CR-004). */
|
|
16
|
+
dataModelPart: DataModelPart | undefined;
|
|
12
17
|
constructor(partName?: PartName | string, contentType?: string);
|
|
13
18
|
setPartShortcut(part: Part, relationshipType: string): boolean;
|
|
14
19
|
/**
|
|
@@ -20,6 +25,12 @@ export declare class WorkbookPart extends XmlPart<sml.Workbook> {
|
|
|
20
25
|
getWorksheetParts(): Promise<WorksheetPart[]>;
|
|
21
26
|
/** The worksheet at an index of `sheets` (docx4j `WorkbookPart.getWorksheet(int)`). */
|
|
22
27
|
getWorksheet(index: number): WorksheetPart;
|
|
28
|
+
/** The workbook's slicer caches (`/xl/slicerCaches/slicerCacheN.xml`), in relationship order. */
|
|
29
|
+
get slicerCacheParts(): SlicerCachePart[];
|
|
30
|
+
/** The workbook's timeline caches (`/xl/timelineCaches/timelineCacheN.xml`), in relationship order. */
|
|
31
|
+
get timelineCacheParts(): TimelineCachePart[];
|
|
32
|
+
/** The workbook's custom data properties parts, in relationship order; each names a `CustomDataPart`. */
|
|
33
|
+
get customDataPropertiesParts(): CustomDataPropertiesPart[];
|
|
23
34
|
/** docx4j `WorkbookPart.isDate1904()`. */
|
|
24
35
|
get isDate1904(): boolean;
|
|
25
36
|
}
|
|
@@ -32,6 +43,16 @@ export declare class WorksheetPart extends XmlPart<sml.Worksheet> {
|
|
|
32
43
|
setPartShortcut(part: Part, relationshipType: string): boolean;
|
|
33
44
|
/** The sheet's table parts (`xl/tables/tableN.xml`), in relationship order. */
|
|
34
45
|
get tableParts(): TablePart[];
|
|
46
|
+
/** The sheet's slicers parts (`/xl/slicers/slicerN.xml`), in relationship order (CR-004). */
|
|
47
|
+
get slicersParts(): SlicersPart[];
|
|
48
|
+
/** The sheet's timelines parts (`/xl/timelines/timelineN.xml`), in relationship order (CR-004). */
|
|
49
|
+
get timelinesParts(): TimelinesPart[];
|
|
50
|
+
/**
|
|
51
|
+
* The sheet's form-control properties parts (`/xl/ctrlProps/ctrlPropN.xml`), in relationship
|
|
52
|
+
* order: one per `x:control`, whose `r:id` names it from inside the sheet's
|
|
53
|
+
* `mc:AlternateContent` (CR-004).
|
|
54
|
+
*/
|
|
55
|
+
get controlPropertiesParts(): ControlPropertiesPart[];
|
|
35
56
|
/** The workbook this sheet belongs to, through its source relationship. */
|
|
36
57
|
get workbookPart(): WorkbookPart | undefined;
|
|
37
58
|
}
|
|
@@ -77,3 +98,43 @@ export declare class ExternalLinkPart extends XmlPart<sml.CTExternalLink> {
|
|
|
77
98
|
export declare class PrinterSettingsPart extends BinaryPart {
|
|
78
99
|
constructor(partName: PartName | string);
|
|
79
100
|
}
|
|
101
|
+
/** A slicer cache (`x14:slicerCacheDefinition`), from the workbook. docx4j `SlicerCachePart`. */
|
|
102
|
+
export declare class SlicerCachePart extends DefaultXmlPart {
|
|
103
|
+
constructor(partName?: PartName | string);
|
|
104
|
+
}
|
|
105
|
+
/** A sheet's slicers (`x14:slicers`). docx4j `SlicersPart`. */
|
|
106
|
+
export declare class SlicersPart extends DefaultXmlPart {
|
|
107
|
+
constructor(partName?: PartName | string);
|
|
108
|
+
}
|
|
109
|
+
/** A timeline cache (`x15:timelineCacheDefinition`), from the workbook. docx4j `TimelineCachePart`. */
|
|
110
|
+
export declare class TimelineCachePart extends DefaultXmlPart {
|
|
111
|
+
constructor(partName?: PartName | string);
|
|
112
|
+
}
|
|
113
|
+
/** A sheet's timelines (`x15:timelines`). docx4j `TimelinesPart`. */
|
|
114
|
+
export declare class TimelinesPart extends DefaultXmlPart {
|
|
115
|
+
constructor(partName?: PartName | string);
|
|
116
|
+
}
|
|
117
|
+
/** A form control's properties (`x14:formControlPr`), from a worksheet. docx4j `ControlPropertiesPart`. */
|
|
118
|
+
export declare class ControlPropertiesPart extends DefaultXmlPart {
|
|
119
|
+
constructor(partName?: PartName | string);
|
|
120
|
+
}
|
|
121
|
+
/** The properties of a custom data part (`x14:datastoreItem`). docx4j `CustomDataPropertiesPart`. */
|
|
122
|
+
export declare class CustomDataPropertiesPart extends DefaultXmlPart {
|
|
123
|
+
constructor(partName?: PartName | string);
|
|
124
|
+
}
|
|
125
|
+
/** A survey (`x15:survey`), from the workbook. docx4j `SurveyPart`. */
|
|
126
|
+
export declare class SurveyPart extends DefaultXmlPart {
|
|
127
|
+
constructor(partName?: PartName | string);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Custom data, whatever an add-in put there (docx4j `CustomDataPart`). Its content type is the
|
|
131
|
+
* generic `application/binary`, so the registry chooses it by relationship type, as it does for
|
|
132
|
+
* altChunk, embedded packages, OLE objects and custom XML (CR-001 section 5.4).
|
|
133
|
+
*/
|
|
134
|
+
export declare class CustomDataPart extends BinaryPart {
|
|
135
|
+
constructor(partName?: PartName | string, contentType?: string);
|
|
136
|
+
}
|
|
137
|
+
/** The Power Pivot data model (`/xl/model/item.data`, [MS-XLDM]). docx4j `DataModelPart`. */
|
|
138
|
+
export declare class DataModelPart extends BinaryPart {
|
|
139
|
+
constructor(partName?: PartName | string);
|
|
140
|
+
}
|
package/dist/parts/sml/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { XmlPart } from '../XmlPart.mjs';
|
|
2
|
+
import { DefaultXmlPart } from '../DefaultXmlPart.mjs';
|
|
2
3
|
import { BinaryPart } from '../BinaryPart.mjs';
|
|
3
4
|
import { ContentTypes } from '../../opc/ContentTypes.mjs';
|
|
4
5
|
import { Namespaces } from '../Namespaces.mjs';
|
|
@@ -22,6 +23,12 @@ export class WorkbookPart extends XmlPart {
|
|
|
22
23
|
case Namespaces.SPREADSHEETML_CALC_CHAIN:
|
|
23
24
|
this.calcChainPart = part;
|
|
24
25
|
return true;
|
|
26
|
+
case Namespaces.SPREADSHEETML_SURVEY:
|
|
27
|
+
this.surveyPart = part;
|
|
28
|
+
return true;
|
|
29
|
+
case Namespaces.SPREADSHEETML_DATA_MODEL:
|
|
30
|
+
this.dataModelPart = part;
|
|
31
|
+
return true;
|
|
25
32
|
default: return false;
|
|
26
33
|
}
|
|
27
34
|
}
|
|
@@ -61,6 +68,18 @@ export class WorkbookPart extends XmlPart {
|
|
|
61
68
|
throw new Xlsx4jException(`No sheet at index ${index}. (There are ${sheets.length} sheets) `);
|
|
62
69
|
return sheet;
|
|
63
70
|
}
|
|
71
|
+
/** The workbook's slicer caches (`/xl/slicerCaches/slicerCacheN.xml`), in relationship order. */
|
|
72
|
+
get slicerCacheParts() {
|
|
73
|
+
return this.partsByRelationshipType(Namespaces.SPREADSHEETML_SLICER_CACHE, SlicerCachePart);
|
|
74
|
+
}
|
|
75
|
+
/** The workbook's timeline caches (`/xl/timelineCaches/timelineCacheN.xml`), in relationship order. */
|
|
76
|
+
get timelineCacheParts() {
|
|
77
|
+
return this.partsByRelationshipType(Namespaces.SPREADSHEETML_TIMELINE_CACHE, TimelineCachePart);
|
|
78
|
+
}
|
|
79
|
+
/** The workbook's custom data properties parts, in relationship order; each names a `CustomDataPart`. */
|
|
80
|
+
get customDataPropertiesParts() {
|
|
81
|
+
return this.partsByRelationshipType(Namespaces.SPREADSHEETML_CUSTOM_DATA_PROPERTIES, CustomDataPropertiesPart);
|
|
82
|
+
}
|
|
64
83
|
/** docx4j `WorkbookPart.isDate1904()`. */
|
|
65
84
|
get isDate1904() {
|
|
66
85
|
var _a;
|
|
@@ -84,10 +103,23 @@ export class WorksheetPart extends XmlPart {
|
|
|
84
103
|
}
|
|
85
104
|
/** The sheet's table parts (`xl/tables/tableN.xml`), in relationship order. */
|
|
86
105
|
get tableParts() {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
106
|
+
return this.partsByRelationshipType(Namespaces.SPREADSHEETML_TABLE, TablePart);
|
|
107
|
+
}
|
|
108
|
+
/** The sheet's slicers parts (`/xl/slicers/slicerN.xml`), in relationship order (CR-004). */
|
|
109
|
+
get slicersParts() {
|
|
110
|
+
return this.partsByRelationshipType(Namespaces.SPREADSHEETML_SLICERS, SlicersPart);
|
|
111
|
+
}
|
|
112
|
+
/** The sheet's timelines parts (`/xl/timelines/timelineN.xml`), in relationship order (CR-004). */
|
|
113
|
+
get timelinesParts() {
|
|
114
|
+
return this.partsByRelationshipType(Namespaces.SPREADSHEETML_TIMELINES, TimelinesPart);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The sheet's form-control properties parts (`/xl/ctrlProps/ctrlPropN.xml`), in relationship
|
|
118
|
+
* order: one per `x:control`, whose `r:id` names it from inside the sheet's
|
|
119
|
+
* `mc:AlternateContent` (CR-004).
|
|
120
|
+
*/
|
|
121
|
+
get controlPropertiesParts() {
|
|
122
|
+
return this.partsByRelationshipType(Namespaces.SPREADSHEETML_CONTROL_PROPERTIES, ControlPropertiesPart);
|
|
91
123
|
}
|
|
92
124
|
/** The workbook this sheet belongs to, through its source relationship. */
|
|
93
125
|
get workbookPart() {
|
|
@@ -164,3 +196,65 @@ export class PrinterSettingsPart extends BinaryPart {
|
|
|
164
196
|
super(partName, ContentTypes.SPREADSHEETML_PRINTER_SETTINGS, Namespaces.SPREADSHEETML_PRINTER_SETTINGS);
|
|
165
197
|
}
|
|
166
198
|
}
|
|
199
|
+
// The Excel 2010 and 2013 extension parts (CR-004 phase A; docx4j
|
|
200
|
+
// org.docx4j.openpackaging.parts.SpreadsheetML). The seven XML ones are `DefaultXmlPart`s for
|
|
201
|
+
// now: their DOM round-trips byte for byte, and nothing re-marshals them, so an `mc:Ignorable`
|
|
202
|
+
// they carry is untouched. Phase B makes them `XmlPart`s over the `x14` and `x15` roots.
|
|
203
|
+
/** A slicer cache (`x14:slicerCacheDefinition`), from the workbook. docx4j `SlicerCachePart`. */
|
|
204
|
+
export class SlicerCachePart extends DefaultXmlPart {
|
|
205
|
+
constructor(partName = '/xl/slicerCaches/slicerCache1.xml') {
|
|
206
|
+
super(partName, ContentTypes.SPREADSHEETML_SLICER_CACHE, Namespaces.SPREADSHEETML_SLICER_CACHE);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/** A sheet's slicers (`x14:slicers`). docx4j `SlicersPart`. */
|
|
210
|
+
export class SlicersPart extends DefaultXmlPart {
|
|
211
|
+
constructor(partName = '/xl/slicers/slicer1.xml') {
|
|
212
|
+
super(partName, ContentTypes.SPREADSHEETML_SLICERS, Namespaces.SPREADSHEETML_SLICERS);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/** A timeline cache (`x15:timelineCacheDefinition`), from the workbook. docx4j `TimelineCachePart`. */
|
|
216
|
+
export class TimelineCachePart extends DefaultXmlPart {
|
|
217
|
+
constructor(partName = '/xl/timelineCaches/timelineCache1.xml') {
|
|
218
|
+
super(partName, ContentTypes.SPREADSHEETML_TIMELINE_CACHE, Namespaces.SPREADSHEETML_TIMELINE_CACHE);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/** A sheet's timelines (`x15:timelines`). docx4j `TimelinesPart`. */
|
|
222
|
+
export class TimelinesPart extends DefaultXmlPart {
|
|
223
|
+
constructor(partName = '/xl/timelines/timeline1.xml') {
|
|
224
|
+
super(partName, ContentTypes.SPREADSHEETML_TIMELINES, Namespaces.SPREADSHEETML_TIMELINES);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/** A form control's properties (`x14:formControlPr`), from a worksheet. docx4j `ControlPropertiesPart`. */
|
|
228
|
+
export class ControlPropertiesPart extends DefaultXmlPart {
|
|
229
|
+
constructor(partName = '/xl/ctrlProps/ctrlProp1.xml') {
|
|
230
|
+
super(partName, ContentTypes.SPREADSHEETML_CONTROL_PROPERTIES, Namespaces.SPREADSHEETML_CONTROL_PROPERTIES);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/** The properties of a custom data part (`x14:datastoreItem`). docx4j `CustomDataPropertiesPart`. */
|
|
234
|
+
export class CustomDataPropertiesPart extends DefaultXmlPart {
|
|
235
|
+
constructor(partName = '/xl/customDataProps/customDataProps1.xml') {
|
|
236
|
+
super(partName, ContentTypes.SPREADSHEETML_CUSTOM_DATA_PROPERTIES, Namespaces.SPREADSHEETML_CUSTOM_DATA_PROPERTIES);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/** A survey (`x15:survey`), from the workbook. docx4j `SurveyPart`. */
|
|
240
|
+
export class SurveyPart extends DefaultXmlPart {
|
|
241
|
+
constructor(partName = '/xl/surveys/survey1.xml') {
|
|
242
|
+
super(partName, ContentTypes.SPREADSHEETML_SURVEY, Namespaces.SPREADSHEETML_SURVEY);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Custom data, whatever an add-in put there (docx4j `CustomDataPart`). Its content type is the
|
|
247
|
+
* generic `application/binary`, so the registry chooses it by relationship type, as it does for
|
|
248
|
+
* altChunk, embedded packages, OLE objects and custom XML (CR-001 section 5.4).
|
|
249
|
+
*/
|
|
250
|
+
export class CustomDataPart extends BinaryPart {
|
|
251
|
+
constructor(partName = '/xl/customData/customData1.dat', contentType = ContentTypes.SPREADSHEETML_CUSTOM_DATA) {
|
|
252
|
+
super(partName, contentType, Namespaces.SPREADSHEETML_CUSTOM_DATA);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/** The Power Pivot data model (`/xl/model/item.data`, [MS-XLDM]). docx4j `DataModelPart`. */
|
|
256
|
+
export class DataModelPart extends BinaryPart {
|
|
257
|
+
constructor(partName = '/xl/model/item.data') {
|
|
258
|
+
super(partName, ContentTypes.SPREADSHEETML_DATA_MODEL, Namespaces.SPREADSHEETML_DATA_MODEL);
|
|
259
|
+
}
|
|
260
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docx4j/core-ts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "docx4j-core for TypeScript: Open Packaging (docx/pptx/xlsx zip and flat OPC), typed parts and relationships, style, numbering and font resolution over @docx4j/generated-objects-ts. Node, browsers, Word add-ins.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"license": "Apache-2.0",
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@docx4j/generated-objects-ts": "^0.
|
|
78
|
+
"@docx4j/generated-objects-ts": "^0.2.0",
|
|
79
79
|
"fflate": "^0.8.2"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|