@office-open/docx 0.6.9 → 0.6.10
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 +25 -20
- package/dist/index.d.mts +4 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __toCommonJS, n as __exportAll, r as __reExport, t as __esmMin } from "./chunk-DHfcOUro.mjs";
|
|
2
|
-
import { AppProperties, BaseXmlComponent, BuilderElement, BuilderElement as BuilderElement$1, DOCX_NS, EMPTY_OBJECT, EmptyElement, Formatter, Formatter as Formatter$1, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, OoxmlMimeType, RawPassthrough, Relationships, TargetModeType, XmlComponent,
|
|
2
|
+
import { AppProperties, BaseXmlComponent, BuilderElement, BuilderElement as BuilderElement$1, DOCX_NS, EMPTY_OBJECT, EmptyElement, Formatter, Formatter as Formatter$1, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, OoxmlMimeType, RawPassthrough, Relationships, TargetModeType, XmlComponent, addSmartArtRelationships, appendContentType, appendRelationship, attrObj, chartAttr, convertEmuToPixels, convertInchesToTwip, convertMillimetersToTwip, convertPixelsToEmu, convertToXmlComponent, createDefault, createOverride, createPacker, createReplacer, createTraverser, getNextRelationshipIndex, getReferencedMedia, hasPlaceholders, hashedId, hpsMeasureObj, hpsMeasureObj as hpsMeasureObj$1, numberValObj, numberValObj as numberValObj$1, onOffObj, onOffObj as onOffObj$1, parseArchive, parseCorePropsElement, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, strFromU8, stringContainerObj, stringEnumValObj, stringEnumValObj as stringEnumValObj$1, stringValObj, stringValObj as stringValObj$1, toJson, uniqueId, uniqueNumericIdCreator, uniqueNumericIdCreator as uniqueNumericIdCreator$1, uniqueUuid, unzipSync, wrapEl, xsdVerticalMergeRev, zipAndConvert } from "@office-open/core";
|
|
3
3
|
import { attr, attrBool, attrNum, children, colorAttr, findChild, findDeep, js2xml, textOf, xml, xml2js } from "@office-open/xml";
|
|
4
4
|
import { toUint8Array } from "undio";
|
|
5
5
|
import { PresetGeometry, buildFill, createBlipFill, createCustomGeometry, createEffectDag, createEffectList, createOutline, createScene3D, createShape3D, createTransform2D, extractBlipFillMedia } from "@office-open/core/drawingml";
|
|
@@ -8252,7 +8252,7 @@ var init_table_row$1 = __esmMin((() => {
|
|
|
8252
8252
|
constructor(options) {
|
|
8253
8253
|
super("w:tr");
|
|
8254
8254
|
this.options = options;
|
|
8255
|
-
this.coercedChildren = options.
|
|
8255
|
+
this.coercedChildren = options.cells.map((child) => child instanceof TableCell || child instanceof StructuredDocumentTagCell || child instanceof StructuredDocumentTagRow ? child : new TableCell(child));
|
|
8256
8256
|
}
|
|
8257
8257
|
get cellCount() {
|
|
8258
8258
|
return this.coercedChildren.length;
|
|
@@ -11009,7 +11009,7 @@ init_relationships();
|
|
|
11009
11009
|
* const footerWrapper = new FooterWrapper(media, 1);
|
|
11010
11010
|
* footerWrapper.add(new Paragraph("Page Footer"));
|
|
11011
11011
|
* footerWrapper.add(new Table({
|
|
11012
|
-
* rows: [new TableRow({
|
|
11012
|
+
* rows: [new TableRow({ cells: [new TableCell({ children: [new Paragraph("Cell")] })] })],
|
|
11013
11013
|
* }));
|
|
11014
11014
|
* ```
|
|
11015
11015
|
*/
|
|
@@ -11377,7 +11377,7 @@ init_relationships();
|
|
|
11377
11377
|
* const headerWrapper = new HeaderWrapper(media, 1);
|
|
11378
11378
|
* headerWrapper.add(new Paragraph("Page Header"));
|
|
11379
11379
|
* headerWrapper.add(new Table({
|
|
11380
|
-
* rows: [new TableRow({
|
|
11380
|
+
* rows: [new TableRow({ cells: [new TableCell({ children: [new Paragraph("Cell")] })] })],
|
|
11381
11381
|
* }));
|
|
11382
11382
|
* ```
|
|
11383
11383
|
*/
|
|
@@ -14526,7 +14526,7 @@ var Compiler = class {
|
|
|
14526
14526
|
* @param overrides - Optional custom XML file overrides
|
|
14527
14527
|
* @returns A Zippable object mapping file paths to their content
|
|
14528
14528
|
*/
|
|
14529
|
-
compile(file, overrides = []) {
|
|
14529
|
+
compile(file, overrides = [], mediaLevel = 0) {
|
|
14530
14530
|
const files = {};
|
|
14531
14531
|
const headerFormattedViews = /* @__PURE__ */ new Map();
|
|
14532
14532
|
const footerFormattedViews = /* @__PURE__ */ new Map();
|
|
@@ -14539,8 +14539,8 @@ var Compiler = class {
|
|
|
14539
14539
|
}
|
|
14540
14540
|
for (const subFile of overrides) files[subFile.path] = typeof subFile.data === "string" ? encoder$1.encode(subFile.data) : subFile.data;
|
|
14541
14541
|
for (const mediaData of file.media.array) {
|
|
14542
|
-
files[`word/media/${mediaData.fileName}`] = [toUint8Array(mediaData.data), { level:
|
|
14543
|
-
if (mediaData.type === "svg") files[`word/media/${mediaData.fallback.fileName}`] = [toUint8Array(mediaData.fallback.data), { level:
|
|
14542
|
+
files[`word/media/${mediaData.fileName}`] = [toUint8Array(mediaData.data), { level: mediaLevel }];
|
|
14543
|
+
if (mediaData.type === "svg") files[`word/media/${mediaData.fallback.fileName}`] = [toUint8Array(mediaData.fallback.data), { level: mediaLevel }];
|
|
14544
14544
|
}
|
|
14545
14545
|
for (const { data: buffer, name, fontKey } of file.fontTable.fontOptionsWithKey) {
|
|
14546
14546
|
const [nameWithoutExtension] = name.split(".");
|
|
@@ -14783,7 +14783,7 @@ const compiler = new Compiler();
|
|
|
14783
14783
|
* ```
|
|
14784
14784
|
*/
|
|
14785
14785
|
const Packer = createPacker({
|
|
14786
|
-
compile: (file, overrides) => compiler.compile(file, overrides),
|
|
14786
|
+
compile: (file, overrides, mediaLevel) => compiler.compile(file, overrides, mediaLevel),
|
|
14787
14787
|
mimeType: OoxmlMimeType.DOCX
|
|
14788
14788
|
});
|
|
14789
14789
|
//#endregion
|