docx-plus 0.0.12 → 0.0.13

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/index.cjs CHANGED
@@ -23015,8 +23015,8 @@ var Numbering = class extends XmlComponent {
23015
23015
  /**
23016
23016
  * Creates a compatibility setting for a WordprocessingML document.
23017
23017
  *
23018
- * Currently hard-coded to set Microsoft Word compatibility mode version.
23019
- * This controls which Word version's formatting and layout behavior the document emulates.
23018
+ * This controls which Word version's formatting and layout behavior the document emulates,
23019
+ * as well as other compatibility behaviors.
23020
23020
  *
23021
23021
  * Common version values:
23022
23022
  * - 11: Word 2003
@@ -23038,25 +23038,25 @@ var Numbering = class extends XmlComponent {
23038
23038
  * @example
23039
23039
  * ```typescript
23040
23040
  * // Set compatibility mode to Word 2013+
23041
- * createCompatibilitySetting(15);
23041
+ * createCompatibilitySetting("compatibilityMode", 15);
23042
23042
  *
23043
- * // Set compatibility mode to Word 2010
23044
- * createCompatibilitySetting(14);
23043
+ * // Enable OpenType features
23044
+ * createCompatibilitySetting("enableOpenTypeFeatures", 1);
23045
23045
  * ```
23046
23046
  */
23047
- const createCompatibilitySetting = (version) => new BuilderElement({
23047
+ const createCompatibilitySetting = (name, val, uri = "http://schemas.microsoft.com/office/word") => new BuilderElement({
23048
23048
  attributes: {
23049
23049
  name: {
23050
23050
  key: "w:name",
23051
- value: "compatibilityMode"
23051
+ value: name
23052
23052
  },
23053
23053
  uri: {
23054
23054
  key: "w:uri",
23055
- value: "http://schemas.microsoft.com/office/word"
23055
+ value: uri
23056
23056
  },
23057
- version: {
23057
+ val: {
23058
23058
  key: "w:val",
23059
- value: version
23059
+ value: val
23060
23060
  }
23061
23061
  },
23062
23062
  name: "w:compatSetting"
@@ -23115,7 +23115,7 @@ const createCompatibilitySetting = (version) => new BuilderElement({
23115
23115
  var Compatibility = class extends XmlComponent {
23116
23116
  constructor(options) {
23117
23117
  super("w:compat");
23118
- if (options.version) this.root.push(createCompatibilitySetting(options.version));
23118
+ if (options.version) this.root.push(createCompatibilitySetting("compatibilityMode", options.version));
23119
23119
  if (options.useSingleBorderforContiguousCells) this.root.push(new OnOffElement("w:useSingleBorderforContiguousCells", options.useSingleBorderforContiguousCells));
23120
23120
  if (options.wordPerfectJustification) this.root.push(new OnOffElement("w:wpJustification", options.wordPerfectJustification));
23121
23121
  if (options.noTabStopForHangingIndent) this.root.push(new OnOffElement("w:noTabHangInd", options.noTabStopForHangingIndent));
@@ -23181,6 +23181,9 @@ var Compatibility = class extends XmlComponent {
23181
23181
  if (options.ignoreVerticalAlignmentInTextboxes) this.root.push(new OnOffElement("w:doNotVertAlignInTxbx", options.ignoreVerticalAlignmentInTextboxes));
23182
23182
  if (options.useAnsiKerningPairs) this.root.push(new OnOffElement("w:useAnsiKerningPairs", options.useAnsiKerningPairs));
23183
23183
  if (options.cachedColumnBalance) this.root.push(new OnOffElement("w:cachedColBalance", options.cachedColumnBalance));
23184
+ if (options.overrideTableStyleFontSizeAndJustification) this.root.push(createCompatibilitySetting("overrideTableStyleFontSizeAndJustification", 1));
23185
+ if (options.enableOpenTypeFeatures) this.root.push(createCompatibilitySetting("enableOpenTypeFeatures", 1));
23186
+ if (options.doNotFlipMirrorIndents) this.root.push(createCompatibilitySetting("doNotFlipMirrorIndents", 1));
23184
23187
  }
23185
23188
  };
23186
23189
  //#endregion
@@ -23276,7 +23279,7 @@ var SettingsAttributes = class extends XmlAttributeComponent {
23276
23279
  */
23277
23280
  var Settings = class extends XmlComponent {
23278
23281
  constructor(options) {
23279
- var _options$hyphenation, _options$hyphenation2, _options$hyphenation3, _options$hyphenation4, _ref, _options$compatibilit, _options$compatibilit2;
23282
+ var _options$defaultTabSt, _options$hyphenation, _options$hyphenation2, _options$hyphenation3, _options$hyphenation4, _options$characterSpa, _ref, _options$compatibilit, _options$compatibilit2, _options$compatibilit3, _options$compatibilit4, _options$compatibilit5, _options$compatibilit6, _options$compatibilit7, _options$compatibilit8, _options$compatibilit9, _options$compatibilit10, _options$compatibilit11, _options$compatibilit12, _options$compatibilit13, _options$compatibilit14, _options$compatibilit15, _options$compatibilit16, _options$compatibilit17, _options$compatibilit18, _options$compatibilit19, _options$compatibilit20, _options$compatibilit21, _options$compatibilit22;
23280
23283
  super("w:settings");
23281
23284
  this.root.push(new SettingsAttributes({
23282
23285
  Ignorable: "w14 w15 wp14",
@@ -23297,18 +23300,28 @@ var Settings = class extends XmlComponent {
23297
23300
  wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
23298
23301
  wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
23299
23302
  }));
23300
- this.root.push(new OnOffElement("w:displayBackgroundShape", true));
23301
23303
  if (options.trackRevisions !== void 0) this.root.push(new OnOffElement("w:trackRevisions", options.trackRevisions));
23302
23304
  if (options.evenAndOddHeaders !== void 0) this.root.push(new OnOffElement("w:evenAndOddHeaders", options.evenAndOddHeaders));
23303
23305
  if (options.updateFields !== void 0) this.root.push(new OnOffElement("w:updateFields", options.updateFields));
23304
- if (options.defaultTabStop !== void 0) this.root.push(new NumberValueElement("w:defaultTabStop", options.defaultTabStop));
23306
+ this.root.push(new NumberValueElement("w:defaultTabStop", (_options$defaultTabSt = options.defaultTabStop) !== null && _options$defaultTabSt !== void 0 ? _options$defaultTabSt : 420));
23305
23307
  if (((_options$hyphenation = options.hyphenation) === null || _options$hyphenation === void 0 ? void 0 : _options$hyphenation.autoHyphenation) !== void 0) this.root.push(new OnOffElement("w:autoHyphenation", options.hyphenation.autoHyphenation));
23306
23308
  if (((_options$hyphenation2 = options.hyphenation) === null || _options$hyphenation2 === void 0 ? void 0 : _options$hyphenation2.hyphenationZone) !== void 0) this.root.push(new NumberValueElement("w:hyphenationZone", options.hyphenation.hyphenationZone));
23307
23309
  if (((_options$hyphenation3 = options.hyphenation) === null || _options$hyphenation3 === void 0 ? void 0 : _options$hyphenation3.consecutiveHyphenLimit) !== void 0) this.root.push(new NumberValueElement("w:consecutiveHyphenLimit", options.hyphenation.consecutiveHyphenLimit));
23308
23310
  if (((_options$hyphenation4 = options.hyphenation) === null || _options$hyphenation4 === void 0 ? void 0 : _options$hyphenation4.doNotHyphenateCaps) !== void 0) this.root.push(new OnOffElement("w:doNotHyphenateCaps", options.hyphenation.doNotHyphenateCaps));
23311
+ this.root.push(new StringValueElement("w:characterSpacingControl", (_options$characterSpa = options.characterSpacingControl) !== null && _options$characterSpa !== void 0 ? _options$characterSpa : "compressPunctuation"));
23309
23312
  this.root.push(new Compatibility({
23310
23313
  ...options.compatibility,
23311
- version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15
23314
+ version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15,
23315
+ spaceForUnderline: (_options$compatibilit3 = (_options$compatibilit4 = options.compatibility) === null || _options$compatibilit4 === void 0 ? void 0 : _options$compatibilit4.spaceForUnderline) !== null && _options$compatibilit3 !== void 0 ? _options$compatibilit3 : true,
23316
+ balanceSingleByteDoubleByteWidth: (_options$compatibilit5 = (_options$compatibilit6 = options.compatibility) === null || _options$compatibilit6 === void 0 ? void 0 : _options$compatibilit6.balanceSingleByteDoubleByteWidth) !== null && _options$compatibilit5 !== void 0 ? _options$compatibilit5 : true,
23317
+ doNotLeaveBackslashAlone: (_options$compatibilit7 = (_options$compatibilit8 = options.compatibility) === null || _options$compatibilit8 === void 0 ? void 0 : _options$compatibilit8.doNotLeaveBackslashAlone) !== null && _options$compatibilit7 !== void 0 ? _options$compatibilit7 : true,
23318
+ underlineTrailingSpaces: (_options$compatibilit9 = (_options$compatibilit10 = options.compatibility) === null || _options$compatibilit10 === void 0 ? void 0 : _options$compatibilit10.underlineTrailingSpaces) !== null && _options$compatibilit9 !== void 0 ? _options$compatibilit9 : true,
23319
+ doNotExpandShiftReturn: (_options$compatibilit11 = (_options$compatibilit12 = options.compatibility) === null || _options$compatibilit12 === void 0 ? void 0 : _options$compatibilit12.doNotExpandShiftReturn) !== null && _options$compatibilit11 !== void 0 ? _options$compatibilit11 : true,
23320
+ adjustLineHeightInTable: (_options$compatibilit13 = (_options$compatibilit14 = options.compatibility) === null || _options$compatibilit14 === void 0 ? void 0 : _options$compatibilit14.adjustLineHeightInTable) !== null && _options$compatibilit13 !== void 0 ? _options$compatibilit13 : true,
23321
+ useFELayout: (_options$compatibilit15 = (_options$compatibilit16 = options.compatibility) === null || _options$compatibilit16 === void 0 ? void 0 : _options$compatibilit16.useFELayout) !== null && _options$compatibilit15 !== void 0 ? _options$compatibilit15 : true,
23322
+ overrideTableStyleFontSizeAndJustification: (_options$compatibilit17 = (_options$compatibilit18 = options.compatibility) === null || _options$compatibilit18 === void 0 ? void 0 : _options$compatibilit18.overrideTableStyleFontSizeAndJustification) !== null && _options$compatibilit17 !== void 0 ? _options$compatibilit17 : true,
23323
+ enableOpenTypeFeatures: (_options$compatibilit19 = (_options$compatibilit20 = options.compatibility) === null || _options$compatibilit20 === void 0 ? void 0 : _options$compatibilit20.enableOpenTypeFeatures) !== null && _options$compatibilit19 !== void 0 ? _options$compatibilit19 : true,
23324
+ doNotFlipMirrorIndents: (_options$compatibilit21 = (_options$compatibilit22 = options.compatibility) === null || _options$compatibilit22 === void 0 ? void 0 : _options$compatibilit22.doNotFlipMirrorIndents) !== null && _options$compatibilit21 !== void 0 ? _options$compatibilit21 : true
23312
23325
  }));
23313
23326
  }
23314
23327
  };
@@ -24145,11 +24158,11 @@ var ExternalStylesFactory = class {
24145
24158
  * Factory for creating default document styles.
24146
24159
  *
24147
24160
  * This factory creates a complete set of default styles for common document elements
24148
- * such as headings, hyperlinks, and footnotes with sensible default formatting.
24161
+ * such as headings, hyperlinks, and footnotes.
24149
24162
  *
24150
24163
  * @example
24151
24164
  * ```typescript
24152
- * // Create default styles with custom heading colors
24165
+ * // Create default styles with custom heading formatting
24153
24166
  * const factory = new DefaultStylesFactory();
24154
24167
  * const styles = factory.newInstance({
24155
24168
  * heading1: {
@@ -24178,42 +24191,12 @@ var DefaultStylesFactory = class {
24178
24191
  run: { size: 56 },
24179
24192
  ...options.title
24180
24193
  }),
24181
- new Heading1Style({
24182
- run: {
24183
- color: "2E74B5",
24184
- size: 32
24185
- },
24186
- ...options.heading1
24187
- }),
24188
- new Heading2Style({
24189
- run: {
24190
- color: "2E74B5",
24191
- size: 26
24192
- },
24193
- ...options.heading2
24194
- }),
24195
- new Heading3Style({
24196
- run: {
24197
- color: "1F4D78",
24198
- size: 24
24199
- },
24200
- ...options.heading3
24201
- }),
24202
- new Heading4Style({
24203
- run: {
24204
- color: "2E74B5",
24205
- italics: true
24206
- },
24207
- ...options.heading4
24208
- }),
24209
- new Heading5Style({
24210
- run: { color: "2E74B5" },
24211
- ...options.heading5
24212
- }),
24213
- new Heading6Style({
24214
- run: { color: "1F4D78" },
24215
- ...options.heading6
24216
- }),
24194
+ new Heading1Style(options.heading1 || {}),
24195
+ new Heading2Style(options.heading2 || {}),
24196
+ new Heading3Style(options.heading3 || {}),
24197
+ new Heading4Style(options.heading4 || {}),
24198
+ new Heading5Style(options.heading5 || {}),
24199
+ new Heading6Style(options.heading6 || {}),
24217
24200
  new StrongStyle({
24218
24201
  run: { bold: true },
24219
24202
  ...options.strong
@@ -24355,6 +24338,7 @@ var File = class {
24355
24338
  compatibilityModeVersion: options.compatabilityModeVersion,
24356
24339
  defaultTabStop: options.defaultTabStop,
24357
24340
  evenAndOddHeaders: options.evenAndOddHeaderAndFooters ? true : false,
24341
+ characterSpacingControl: options.characterSpacingControl,
24358
24342
  hyphenation: {
24359
24343
  autoHyphenation: (_options$hyphenation = options.hyphenation) === null || _options$hyphenation === void 0 ? void 0 : _options$hyphenation.autoHyphenation,
24360
24344
  consecutiveHyphenLimit: (_options$hyphenation2 = options.hyphenation) === null || _options$hyphenation2 === void 0 ? void 0 : _options$hyphenation2.consecutiveHyphenLimit,
package/dist/index.d.cts CHANGED
@@ -2496,6 +2496,9 @@ interface ICompatibilityOptions {
2496
2496
  readonly ignoreVerticalAlignmentInTextboxes?: boolean;
2497
2497
  readonly useAnsiKerningPairs?: boolean;
2498
2498
  readonly cachedColumnBalance?: boolean;
2499
+ readonly overrideTableStyleFontSizeAndJustification?: boolean;
2500
+ readonly enableOpenTypeFeatures?: boolean;
2501
+ readonly doNotFlipMirrorIndents?: boolean;
2499
2502
  }
2500
2503
  //#endregion
2501
2504
  //#region src/file/settings/settings.d.ts
@@ -2507,6 +2510,7 @@ interface ISettingsOptions {
2507
2510
  readonly compatibility?: ICompatibilityOptions;
2508
2511
  readonly defaultTabStop?: number;
2509
2512
  readonly hyphenation?: IHyphenationOptions;
2513
+ readonly characterSpacingControl?: "compressPunctuation" | "doNotCompress";
2510
2514
  }
2511
2515
  interface IHyphenationOptions {
2512
2516
  readonly autoHyphenation?: boolean;
@@ -3063,6 +3067,7 @@ interface IPropertiesOptions {
3063
3067
  readonly defaultTabStop?: number;
3064
3068
  readonly fonts?: readonly FontOptions[];
3065
3069
  readonly hyphenation?: IHyphenationOptions;
3070
+ readonly characterSpacingControl?: "compressPunctuation" | "doNotCompress";
3066
3071
  }
3067
3072
  declare class CoreProperties extends XmlComponent {
3068
3073
  constructor(options: Omit<IPropertiesOptions, "sections">);
package/dist/index.d.mts CHANGED
@@ -2498,6 +2498,9 @@ interface ICompatibilityOptions {
2498
2498
  readonly ignoreVerticalAlignmentInTextboxes?: boolean;
2499
2499
  readonly useAnsiKerningPairs?: boolean;
2500
2500
  readonly cachedColumnBalance?: boolean;
2501
+ readonly overrideTableStyleFontSizeAndJustification?: boolean;
2502
+ readonly enableOpenTypeFeatures?: boolean;
2503
+ readonly doNotFlipMirrorIndents?: boolean;
2501
2504
  }
2502
2505
  //#endregion
2503
2506
  //#region src/file/settings/settings.d.ts
@@ -2509,6 +2512,7 @@ interface ISettingsOptions {
2509
2512
  readonly compatibility?: ICompatibilityOptions;
2510
2513
  readonly defaultTabStop?: number;
2511
2514
  readonly hyphenation?: IHyphenationOptions;
2515
+ readonly characterSpacingControl?: "compressPunctuation" | "doNotCompress";
2512
2516
  }
2513
2517
  interface IHyphenationOptions {
2514
2518
  readonly autoHyphenation?: boolean;
@@ -3065,6 +3069,7 @@ interface IPropertiesOptions {
3065
3069
  readonly defaultTabStop?: number;
3066
3070
  readonly fonts?: readonly FontOptions[];
3067
3071
  readonly hyphenation?: IHyphenationOptions;
3072
+ readonly characterSpacingControl?: "compressPunctuation" | "doNotCompress";
3068
3073
  }
3069
3074
  declare class CoreProperties extends XmlComponent {
3070
3075
  constructor(options: Omit<IPropertiesOptions, "sections">);
@@ -23012,8 +23012,8 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
23012
23012
  /**
23013
23013
  * Creates a compatibility setting for a WordprocessingML document.
23014
23014
  *
23015
- * Currently hard-coded to set Microsoft Word compatibility mode version.
23016
- * This controls which Word version's formatting and layout behavior the document emulates.
23015
+ * This controls which Word version's formatting and layout behavior the document emulates,
23016
+ * as well as other compatibility behaviors.
23017
23017
  *
23018
23018
  * Common version values:
23019
23019
  * - 11: Word 2003
@@ -23035,25 +23035,25 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
23035
23035
  * @example
23036
23036
  * ```typescript
23037
23037
  * // Set compatibility mode to Word 2013+
23038
- * createCompatibilitySetting(15);
23038
+ * createCompatibilitySetting("compatibilityMode", 15);
23039
23039
  *
23040
- * // Set compatibility mode to Word 2010
23041
- * createCompatibilitySetting(14);
23040
+ * // Enable OpenType features
23041
+ * createCompatibilitySetting("enableOpenTypeFeatures", 1);
23042
23042
  * ```
23043
23043
  */
23044
- const createCompatibilitySetting = (version) => new BuilderElement({
23044
+ const createCompatibilitySetting = (name, val, uri = "http://schemas.microsoft.com/office/word") => new BuilderElement({
23045
23045
  attributes: {
23046
23046
  name: {
23047
23047
  key: "w:name",
23048
- value: "compatibilityMode"
23048
+ value: name
23049
23049
  },
23050
23050
  uri: {
23051
23051
  key: "w:uri",
23052
- value: "http://schemas.microsoft.com/office/word"
23052
+ value: uri
23053
23053
  },
23054
- version: {
23054
+ val: {
23055
23055
  key: "w:val",
23056
- value: version
23056
+ value: val
23057
23057
  }
23058
23058
  },
23059
23059
  name: "w:compatSetting"
@@ -23112,7 +23112,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
23112
23112
  var Compatibility = class extends XmlComponent {
23113
23113
  constructor(options) {
23114
23114
  super("w:compat");
23115
- if (options.version) this.root.push(createCompatibilitySetting(options.version));
23115
+ if (options.version) this.root.push(createCompatibilitySetting("compatibilityMode", options.version));
23116
23116
  if (options.useSingleBorderforContiguousCells) this.root.push(new OnOffElement("w:useSingleBorderforContiguousCells", options.useSingleBorderforContiguousCells));
23117
23117
  if (options.wordPerfectJustification) this.root.push(new OnOffElement("w:wpJustification", options.wordPerfectJustification));
23118
23118
  if (options.noTabStopForHangingIndent) this.root.push(new OnOffElement("w:noTabHangInd", options.noTabStopForHangingIndent));
@@ -23178,6 +23178,9 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
23178
23178
  if (options.ignoreVerticalAlignmentInTextboxes) this.root.push(new OnOffElement("w:doNotVertAlignInTxbx", options.ignoreVerticalAlignmentInTextboxes));
23179
23179
  if (options.useAnsiKerningPairs) this.root.push(new OnOffElement("w:useAnsiKerningPairs", options.useAnsiKerningPairs));
23180
23180
  if (options.cachedColumnBalance) this.root.push(new OnOffElement("w:cachedColBalance", options.cachedColumnBalance));
23181
+ if (options.overrideTableStyleFontSizeAndJustification) this.root.push(createCompatibilitySetting("overrideTableStyleFontSizeAndJustification", 1));
23182
+ if (options.enableOpenTypeFeatures) this.root.push(createCompatibilitySetting("enableOpenTypeFeatures", 1));
23183
+ if (options.doNotFlipMirrorIndents) this.root.push(createCompatibilitySetting("doNotFlipMirrorIndents", 1));
23181
23184
  }
23182
23185
  };
23183
23186
  //#endregion
@@ -23273,7 +23276,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
23273
23276
  */
23274
23277
  var Settings = class extends XmlComponent {
23275
23278
  constructor(options) {
23276
- var _options$hyphenation, _options$hyphenation2, _options$hyphenation3, _options$hyphenation4, _ref, _options$compatibilit, _options$compatibilit2;
23279
+ var _options$defaultTabSt, _options$hyphenation, _options$hyphenation2, _options$hyphenation3, _options$hyphenation4, _options$characterSpa, _ref, _options$compatibilit, _options$compatibilit2, _options$compatibilit3, _options$compatibilit4, _options$compatibilit5, _options$compatibilit6, _options$compatibilit7, _options$compatibilit8, _options$compatibilit9, _options$compatibilit10, _options$compatibilit11, _options$compatibilit12, _options$compatibilit13, _options$compatibilit14, _options$compatibilit15, _options$compatibilit16, _options$compatibilit17, _options$compatibilit18, _options$compatibilit19, _options$compatibilit20, _options$compatibilit21, _options$compatibilit22;
23277
23280
  super("w:settings");
23278
23281
  this.root.push(new SettingsAttributes({
23279
23282
  Ignorable: "w14 w15 wp14",
@@ -23294,18 +23297,28 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
23294
23297
  wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
23295
23298
  wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
23296
23299
  }));
23297
- this.root.push(new OnOffElement("w:displayBackgroundShape", true));
23298
23300
  if (options.trackRevisions !== void 0) this.root.push(new OnOffElement("w:trackRevisions", options.trackRevisions));
23299
23301
  if (options.evenAndOddHeaders !== void 0) this.root.push(new OnOffElement("w:evenAndOddHeaders", options.evenAndOddHeaders));
23300
23302
  if (options.updateFields !== void 0) this.root.push(new OnOffElement("w:updateFields", options.updateFields));
23301
- if (options.defaultTabStop !== void 0) this.root.push(new NumberValueElement("w:defaultTabStop", options.defaultTabStop));
23303
+ this.root.push(new NumberValueElement("w:defaultTabStop", (_options$defaultTabSt = options.defaultTabStop) !== null && _options$defaultTabSt !== void 0 ? _options$defaultTabSt : 420));
23302
23304
  if (((_options$hyphenation = options.hyphenation) === null || _options$hyphenation === void 0 ? void 0 : _options$hyphenation.autoHyphenation) !== void 0) this.root.push(new OnOffElement("w:autoHyphenation", options.hyphenation.autoHyphenation));
23303
23305
  if (((_options$hyphenation2 = options.hyphenation) === null || _options$hyphenation2 === void 0 ? void 0 : _options$hyphenation2.hyphenationZone) !== void 0) this.root.push(new NumberValueElement("w:hyphenationZone", options.hyphenation.hyphenationZone));
23304
23306
  if (((_options$hyphenation3 = options.hyphenation) === null || _options$hyphenation3 === void 0 ? void 0 : _options$hyphenation3.consecutiveHyphenLimit) !== void 0) this.root.push(new NumberValueElement("w:consecutiveHyphenLimit", options.hyphenation.consecutiveHyphenLimit));
23305
23307
  if (((_options$hyphenation4 = options.hyphenation) === null || _options$hyphenation4 === void 0 ? void 0 : _options$hyphenation4.doNotHyphenateCaps) !== void 0) this.root.push(new OnOffElement("w:doNotHyphenateCaps", options.hyphenation.doNotHyphenateCaps));
23308
+ this.root.push(new StringValueElement("w:characterSpacingControl", (_options$characterSpa = options.characterSpacingControl) !== null && _options$characterSpa !== void 0 ? _options$characterSpa : "compressPunctuation"));
23306
23309
  this.root.push(new Compatibility({
23307
23310
  ...options.compatibility,
23308
- version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15
23311
+ version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15,
23312
+ spaceForUnderline: (_options$compatibilit3 = (_options$compatibilit4 = options.compatibility) === null || _options$compatibilit4 === void 0 ? void 0 : _options$compatibilit4.spaceForUnderline) !== null && _options$compatibilit3 !== void 0 ? _options$compatibilit3 : true,
23313
+ balanceSingleByteDoubleByteWidth: (_options$compatibilit5 = (_options$compatibilit6 = options.compatibility) === null || _options$compatibilit6 === void 0 ? void 0 : _options$compatibilit6.balanceSingleByteDoubleByteWidth) !== null && _options$compatibilit5 !== void 0 ? _options$compatibilit5 : true,
23314
+ doNotLeaveBackslashAlone: (_options$compatibilit7 = (_options$compatibilit8 = options.compatibility) === null || _options$compatibilit8 === void 0 ? void 0 : _options$compatibilit8.doNotLeaveBackslashAlone) !== null && _options$compatibilit7 !== void 0 ? _options$compatibilit7 : true,
23315
+ underlineTrailingSpaces: (_options$compatibilit9 = (_options$compatibilit10 = options.compatibility) === null || _options$compatibilit10 === void 0 ? void 0 : _options$compatibilit10.underlineTrailingSpaces) !== null && _options$compatibilit9 !== void 0 ? _options$compatibilit9 : true,
23316
+ doNotExpandShiftReturn: (_options$compatibilit11 = (_options$compatibilit12 = options.compatibility) === null || _options$compatibilit12 === void 0 ? void 0 : _options$compatibilit12.doNotExpandShiftReturn) !== null && _options$compatibilit11 !== void 0 ? _options$compatibilit11 : true,
23317
+ adjustLineHeightInTable: (_options$compatibilit13 = (_options$compatibilit14 = options.compatibility) === null || _options$compatibilit14 === void 0 ? void 0 : _options$compatibilit14.adjustLineHeightInTable) !== null && _options$compatibilit13 !== void 0 ? _options$compatibilit13 : true,
23318
+ useFELayout: (_options$compatibilit15 = (_options$compatibilit16 = options.compatibility) === null || _options$compatibilit16 === void 0 ? void 0 : _options$compatibilit16.useFELayout) !== null && _options$compatibilit15 !== void 0 ? _options$compatibilit15 : true,
23319
+ overrideTableStyleFontSizeAndJustification: (_options$compatibilit17 = (_options$compatibilit18 = options.compatibility) === null || _options$compatibilit18 === void 0 ? void 0 : _options$compatibilit18.overrideTableStyleFontSizeAndJustification) !== null && _options$compatibilit17 !== void 0 ? _options$compatibilit17 : true,
23320
+ enableOpenTypeFeatures: (_options$compatibilit19 = (_options$compatibilit20 = options.compatibility) === null || _options$compatibilit20 === void 0 ? void 0 : _options$compatibilit20.enableOpenTypeFeatures) !== null && _options$compatibilit19 !== void 0 ? _options$compatibilit19 : true,
23321
+ doNotFlipMirrorIndents: (_options$compatibilit21 = (_options$compatibilit22 = options.compatibility) === null || _options$compatibilit22 === void 0 ? void 0 : _options$compatibilit22.doNotFlipMirrorIndents) !== null && _options$compatibilit21 !== void 0 ? _options$compatibilit21 : true
23309
23322
  }));
23310
23323
  }
23311
23324
  };
@@ -24142,11 +24155,11 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
24142
24155
  * Factory for creating default document styles.
24143
24156
  *
24144
24157
  * This factory creates a complete set of default styles for common document elements
24145
- * such as headings, hyperlinks, and footnotes with sensible default formatting.
24158
+ * such as headings, hyperlinks, and footnotes.
24146
24159
  *
24147
24160
  * @example
24148
24161
  * ```typescript
24149
- * // Create default styles with custom heading colors
24162
+ * // Create default styles with custom heading formatting
24150
24163
  * const factory = new DefaultStylesFactory();
24151
24164
  * const styles = factory.newInstance({
24152
24165
  * heading1: {
@@ -24175,42 +24188,12 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
24175
24188
  run: { size: 56 },
24176
24189
  ...options.title
24177
24190
  }),
24178
- new Heading1Style({
24179
- run: {
24180
- color: "2E74B5",
24181
- size: 32
24182
- },
24183
- ...options.heading1
24184
- }),
24185
- new Heading2Style({
24186
- run: {
24187
- color: "2E74B5",
24188
- size: 26
24189
- },
24190
- ...options.heading2
24191
- }),
24192
- new Heading3Style({
24193
- run: {
24194
- color: "1F4D78",
24195
- size: 24
24196
- },
24197
- ...options.heading3
24198
- }),
24199
- new Heading4Style({
24200
- run: {
24201
- color: "2E74B5",
24202
- italics: true
24203
- },
24204
- ...options.heading4
24205
- }),
24206
- new Heading5Style({
24207
- run: { color: "2E74B5" },
24208
- ...options.heading5
24209
- }),
24210
- new Heading6Style({
24211
- run: { color: "1F4D78" },
24212
- ...options.heading6
24213
- }),
24191
+ new Heading1Style(options.heading1 || {}),
24192
+ new Heading2Style(options.heading2 || {}),
24193
+ new Heading3Style(options.heading3 || {}),
24194
+ new Heading4Style(options.heading4 || {}),
24195
+ new Heading5Style(options.heading5 || {}),
24196
+ new Heading6Style(options.heading6 || {}),
24214
24197
  new StrongStyle({
24215
24198
  run: { bold: true },
24216
24199
  ...options.strong
@@ -24352,6 +24335,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
24352
24335
  compatibilityModeVersion: options.compatabilityModeVersion,
24353
24336
  defaultTabStop: options.defaultTabStop,
24354
24337
  evenAndOddHeaders: options.evenAndOddHeaderAndFooters ? true : false,
24338
+ characterSpacingControl: options.characterSpacingControl,
24355
24339
  hyphenation: {
24356
24340
  autoHyphenation: (_options$hyphenation = options.hyphenation) === null || _options$hyphenation === void 0 ? void 0 : _options$hyphenation.autoHyphenation,
24357
24341
  consecutiveHyphenLimit: (_options$hyphenation2 = options.hyphenation) === null || _options$hyphenation2 === void 0 ? void 0 : _options$hyphenation2.consecutiveHyphenLimit,
package/dist/index.mjs CHANGED
@@ -23013,8 +23013,8 @@ var Numbering = class extends XmlComponent {
23013
23013
  /**
23014
23014
  * Creates a compatibility setting for a WordprocessingML document.
23015
23015
  *
23016
- * Currently hard-coded to set Microsoft Word compatibility mode version.
23017
- * This controls which Word version's formatting and layout behavior the document emulates.
23016
+ * This controls which Word version's formatting and layout behavior the document emulates,
23017
+ * as well as other compatibility behaviors.
23018
23018
  *
23019
23019
  * Common version values:
23020
23020
  * - 11: Word 2003
@@ -23036,25 +23036,25 @@ var Numbering = class extends XmlComponent {
23036
23036
  * @example
23037
23037
  * ```typescript
23038
23038
  * // Set compatibility mode to Word 2013+
23039
- * createCompatibilitySetting(15);
23039
+ * createCompatibilitySetting("compatibilityMode", 15);
23040
23040
  *
23041
- * // Set compatibility mode to Word 2010
23042
- * createCompatibilitySetting(14);
23041
+ * // Enable OpenType features
23042
+ * createCompatibilitySetting("enableOpenTypeFeatures", 1);
23043
23043
  * ```
23044
23044
  */
23045
- const createCompatibilitySetting = (version) => new BuilderElement({
23045
+ const createCompatibilitySetting = (name, val, uri = "http://schemas.microsoft.com/office/word") => new BuilderElement({
23046
23046
  attributes: {
23047
23047
  name: {
23048
23048
  key: "w:name",
23049
- value: "compatibilityMode"
23049
+ value: name
23050
23050
  },
23051
23051
  uri: {
23052
23052
  key: "w:uri",
23053
- value: "http://schemas.microsoft.com/office/word"
23053
+ value: uri
23054
23054
  },
23055
- version: {
23055
+ val: {
23056
23056
  key: "w:val",
23057
- value: version
23057
+ value: val
23058
23058
  }
23059
23059
  },
23060
23060
  name: "w:compatSetting"
@@ -23113,7 +23113,7 @@ const createCompatibilitySetting = (version) => new BuilderElement({
23113
23113
  var Compatibility = class extends XmlComponent {
23114
23114
  constructor(options) {
23115
23115
  super("w:compat");
23116
- if (options.version) this.root.push(createCompatibilitySetting(options.version));
23116
+ if (options.version) this.root.push(createCompatibilitySetting("compatibilityMode", options.version));
23117
23117
  if (options.useSingleBorderforContiguousCells) this.root.push(new OnOffElement("w:useSingleBorderforContiguousCells", options.useSingleBorderforContiguousCells));
23118
23118
  if (options.wordPerfectJustification) this.root.push(new OnOffElement("w:wpJustification", options.wordPerfectJustification));
23119
23119
  if (options.noTabStopForHangingIndent) this.root.push(new OnOffElement("w:noTabHangInd", options.noTabStopForHangingIndent));
@@ -23179,6 +23179,9 @@ var Compatibility = class extends XmlComponent {
23179
23179
  if (options.ignoreVerticalAlignmentInTextboxes) this.root.push(new OnOffElement("w:doNotVertAlignInTxbx", options.ignoreVerticalAlignmentInTextboxes));
23180
23180
  if (options.useAnsiKerningPairs) this.root.push(new OnOffElement("w:useAnsiKerningPairs", options.useAnsiKerningPairs));
23181
23181
  if (options.cachedColumnBalance) this.root.push(new OnOffElement("w:cachedColBalance", options.cachedColumnBalance));
23182
+ if (options.overrideTableStyleFontSizeAndJustification) this.root.push(createCompatibilitySetting("overrideTableStyleFontSizeAndJustification", 1));
23183
+ if (options.enableOpenTypeFeatures) this.root.push(createCompatibilitySetting("enableOpenTypeFeatures", 1));
23184
+ if (options.doNotFlipMirrorIndents) this.root.push(createCompatibilitySetting("doNotFlipMirrorIndents", 1));
23182
23185
  }
23183
23186
  };
23184
23187
  //#endregion
@@ -23274,7 +23277,7 @@ var SettingsAttributes = class extends XmlAttributeComponent {
23274
23277
  */
23275
23278
  var Settings = class extends XmlComponent {
23276
23279
  constructor(options) {
23277
- var _options$hyphenation, _options$hyphenation2, _options$hyphenation3, _options$hyphenation4, _ref, _options$compatibilit, _options$compatibilit2;
23280
+ var _options$defaultTabSt, _options$hyphenation, _options$hyphenation2, _options$hyphenation3, _options$hyphenation4, _options$characterSpa, _ref, _options$compatibilit, _options$compatibilit2, _options$compatibilit3, _options$compatibilit4, _options$compatibilit5, _options$compatibilit6, _options$compatibilit7, _options$compatibilit8, _options$compatibilit9, _options$compatibilit10, _options$compatibilit11, _options$compatibilit12, _options$compatibilit13, _options$compatibilit14, _options$compatibilit15, _options$compatibilit16, _options$compatibilit17, _options$compatibilit18, _options$compatibilit19, _options$compatibilit20, _options$compatibilit21, _options$compatibilit22;
23278
23281
  super("w:settings");
23279
23282
  this.root.push(new SettingsAttributes({
23280
23283
  Ignorable: "w14 w15 wp14",
@@ -23295,18 +23298,28 @@ var Settings = class extends XmlComponent {
23295
23298
  wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
23296
23299
  wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
23297
23300
  }));
23298
- this.root.push(new OnOffElement("w:displayBackgroundShape", true));
23299
23301
  if (options.trackRevisions !== void 0) this.root.push(new OnOffElement("w:trackRevisions", options.trackRevisions));
23300
23302
  if (options.evenAndOddHeaders !== void 0) this.root.push(new OnOffElement("w:evenAndOddHeaders", options.evenAndOddHeaders));
23301
23303
  if (options.updateFields !== void 0) this.root.push(new OnOffElement("w:updateFields", options.updateFields));
23302
- if (options.defaultTabStop !== void 0) this.root.push(new NumberValueElement("w:defaultTabStop", options.defaultTabStop));
23304
+ this.root.push(new NumberValueElement("w:defaultTabStop", (_options$defaultTabSt = options.defaultTabStop) !== null && _options$defaultTabSt !== void 0 ? _options$defaultTabSt : 420));
23303
23305
  if (((_options$hyphenation = options.hyphenation) === null || _options$hyphenation === void 0 ? void 0 : _options$hyphenation.autoHyphenation) !== void 0) this.root.push(new OnOffElement("w:autoHyphenation", options.hyphenation.autoHyphenation));
23304
23306
  if (((_options$hyphenation2 = options.hyphenation) === null || _options$hyphenation2 === void 0 ? void 0 : _options$hyphenation2.hyphenationZone) !== void 0) this.root.push(new NumberValueElement("w:hyphenationZone", options.hyphenation.hyphenationZone));
23305
23307
  if (((_options$hyphenation3 = options.hyphenation) === null || _options$hyphenation3 === void 0 ? void 0 : _options$hyphenation3.consecutiveHyphenLimit) !== void 0) this.root.push(new NumberValueElement("w:consecutiveHyphenLimit", options.hyphenation.consecutiveHyphenLimit));
23306
23308
  if (((_options$hyphenation4 = options.hyphenation) === null || _options$hyphenation4 === void 0 ? void 0 : _options$hyphenation4.doNotHyphenateCaps) !== void 0) this.root.push(new OnOffElement("w:doNotHyphenateCaps", options.hyphenation.doNotHyphenateCaps));
23309
+ this.root.push(new StringValueElement("w:characterSpacingControl", (_options$characterSpa = options.characterSpacingControl) !== null && _options$characterSpa !== void 0 ? _options$characterSpa : "compressPunctuation"));
23307
23310
  this.root.push(new Compatibility({
23308
23311
  ...options.compatibility,
23309
- version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15
23312
+ version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15,
23313
+ spaceForUnderline: (_options$compatibilit3 = (_options$compatibilit4 = options.compatibility) === null || _options$compatibilit4 === void 0 ? void 0 : _options$compatibilit4.spaceForUnderline) !== null && _options$compatibilit3 !== void 0 ? _options$compatibilit3 : true,
23314
+ balanceSingleByteDoubleByteWidth: (_options$compatibilit5 = (_options$compatibilit6 = options.compatibility) === null || _options$compatibilit6 === void 0 ? void 0 : _options$compatibilit6.balanceSingleByteDoubleByteWidth) !== null && _options$compatibilit5 !== void 0 ? _options$compatibilit5 : true,
23315
+ doNotLeaveBackslashAlone: (_options$compatibilit7 = (_options$compatibilit8 = options.compatibility) === null || _options$compatibilit8 === void 0 ? void 0 : _options$compatibilit8.doNotLeaveBackslashAlone) !== null && _options$compatibilit7 !== void 0 ? _options$compatibilit7 : true,
23316
+ underlineTrailingSpaces: (_options$compatibilit9 = (_options$compatibilit10 = options.compatibility) === null || _options$compatibilit10 === void 0 ? void 0 : _options$compatibilit10.underlineTrailingSpaces) !== null && _options$compatibilit9 !== void 0 ? _options$compatibilit9 : true,
23317
+ doNotExpandShiftReturn: (_options$compatibilit11 = (_options$compatibilit12 = options.compatibility) === null || _options$compatibilit12 === void 0 ? void 0 : _options$compatibilit12.doNotExpandShiftReturn) !== null && _options$compatibilit11 !== void 0 ? _options$compatibilit11 : true,
23318
+ adjustLineHeightInTable: (_options$compatibilit13 = (_options$compatibilit14 = options.compatibility) === null || _options$compatibilit14 === void 0 ? void 0 : _options$compatibilit14.adjustLineHeightInTable) !== null && _options$compatibilit13 !== void 0 ? _options$compatibilit13 : true,
23319
+ useFELayout: (_options$compatibilit15 = (_options$compatibilit16 = options.compatibility) === null || _options$compatibilit16 === void 0 ? void 0 : _options$compatibilit16.useFELayout) !== null && _options$compatibilit15 !== void 0 ? _options$compatibilit15 : true,
23320
+ overrideTableStyleFontSizeAndJustification: (_options$compatibilit17 = (_options$compatibilit18 = options.compatibility) === null || _options$compatibilit18 === void 0 ? void 0 : _options$compatibilit18.overrideTableStyleFontSizeAndJustification) !== null && _options$compatibilit17 !== void 0 ? _options$compatibilit17 : true,
23321
+ enableOpenTypeFeatures: (_options$compatibilit19 = (_options$compatibilit20 = options.compatibility) === null || _options$compatibilit20 === void 0 ? void 0 : _options$compatibilit20.enableOpenTypeFeatures) !== null && _options$compatibilit19 !== void 0 ? _options$compatibilit19 : true,
23322
+ doNotFlipMirrorIndents: (_options$compatibilit21 = (_options$compatibilit22 = options.compatibility) === null || _options$compatibilit22 === void 0 ? void 0 : _options$compatibilit22.doNotFlipMirrorIndents) !== null && _options$compatibilit21 !== void 0 ? _options$compatibilit21 : true
23310
23323
  }));
23311
23324
  }
23312
23325
  };
@@ -24143,11 +24156,11 @@ var ExternalStylesFactory = class {
24143
24156
  * Factory for creating default document styles.
24144
24157
  *
24145
24158
  * This factory creates a complete set of default styles for common document elements
24146
- * such as headings, hyperlinks, and footnotes with sensible default formatting.
24159
+ * such as headings, hyperlinks, and footnotes.
24147
24160
  *
24148
24161
  * @example
24149
24162
  * ```typescript
24150
- * // Create default styles with custom heading colors
24163
+ * // Create default styles with custom heading formatting
24151
24164
  * const factory = new DefaultStylesFactory();
24152
24165
  * const styles = factory.newInstance({
24153
24166
  * heading1: {
@@ -24176,42 +24189,12 @@ var DefaultStylesFactory = class {
24176
24189
  run: { size: 56 },
24177
24190
  ...options.title
24178
24191
  }),
24179
- new Heading1Style({
24180
- run: {
24181
- color: "2E74B5",
24182
- size: 32
24183
- },
24184
- ...options.heading1
24185
- }),
24186
- new Heading2Style({
24187
- run: {
24188
- color: "2E74B5",
24189
- size: 26
24190
- },
24191
- ...options.heading2
24192
- }),
24193
- new Heading3Style({
24194
- run: {
24195
- color: "1F4D78",
24196
- size: 24
24197
- },
24198
- ...options.heading3
24199
- }),
24200
- new Heading4Style({
24201
- run: {
24202
- color: "2E74B5",
24203
- italics: true
24204
- },
24205
- ...options.heading4
24206
- }),
24207
- new Heading5Style({
24208
- run: { color: "2E74B5" },
24209
- ...options.heading5
24210
- }),
24211
- new Heading6Style({
24212
- run: { color: "1F4D78" },
24213
- ...options.heading6
24214
- }),
24192
+ new Heading1Style(options.heading1 || {}),
24193
+ new Heading2Style(options.heading2 || {}),
24194
+ new Heading3Style(options.heading3 || {}),
24195
+ new Heading4Style(options.heading4 || {}),
24196
+ new Heading5Style(options.heading5 || {}),
24197
+ new Heading6Style(options.heading6 || {}),
24215
24198
  new StrongStyle({
24216
24199
  run: { bold: true },
24217
24200
  ...options.strong
@@ -24353,6 +24336,7 @@ var File = class {
24353
24336
  compatibilityModeVersion: options.compatabilityModeVersion,
24354
24337
  defaultTabStop: options.defaultTabStop,
24355
24338
  evenAndOddHeaders: options.evenAndOddHeaderAndFooters ? true : false,
24339
+ characterSpacingControl: options.characterSpacingControl,
24356
24340
  hyphenation: {
24357
24341
  autoHyphenation: (_options$hyphenation = options.hyphenation) === null || _options$hyphenation === void 0 ? void 0 : _options$hyphenation.autoHyphenation,
24358
24342
  consecutiveHyphenLimit: (_options$hyphenation2 = options.hyphenation) === null || _options$hyphenation2 === void 0 ? void 0 : _options$hyphenation2.consecutiveHyphenLimit,
package/dist/index.umd.js CHANGED
@@ -23020,8 +23020,8 @@
23020
23020
  /**
23021
23021
  * Creates a compatibility setting for a WordprocessingML document.
23022
23022
  *
23023
- * Currently hard-coded to set Microsoft Word compatibility mode version.
23024
- * This controls which Word version's formatting and layout behavior the document emulates.
23023
+ * This controls which Word version's formatting and layout behavior the document emulates,
23024
+ * as well as other compatibility behaviors.
23025
23025
  *
23026
23026
  * Common version values:
23027
23027
  * - 11: Word 2003
@@ -23043,25 +23043,25 @@
23043
23043
  * @example
23044
23044
  * ```typescript
23045
23045
  * // Set compatibility mode to Word 2013+
23046
- * createCompatibilitySetting(15);
23046
+ * createCompatibilitySetting("compatibilityMode", 15);
23047
23047
  *
23048
- * // Set compatibility mode to Word 2010
23049
- * createCompatibilitySetting(14);
23048
+ * // Enable OpenType features
23049
+ * createCompatibilitySetting("enableOpenTypeFeatures", 1);
23050
23050
  * ```
23051
23051
  */
23052
- const createCompatibilitySetting = (version) => new BuilderElement({
23052
+ const createCompatibilitySetting = (name, val, uri = "http://schemas.microsoft.com/office/word") => new BuilderElement({
23053
23053
  attributes: {
23054
23054
  name: {
23055
23055
  key: "w:name",
23056
- value: "compatibilityMode"
23056
+ value: name
23057
23057
  },
23058
23058
  uri: {
23059
23059
  key: "w:uri",
23060
- value: "http://schemas.microsoft.com/office/word"
23060
+ value: uri
23061
23061
  },
23062
- version: {
23062
+ val: {
23063
23063
  key: "w:val",
23064
- value: version
23064
+ value: val
23065
23065
  }
23066
23066
  },
23067
23067
  name: "w:compatSetting"
@@ -23120,7 +23120,7 @@
23120
23120
  var Compatibility = class extends XmlComponent {
23121
23121
  constructor(options) {
23122
23122
  super("w:compat");
23123
- if (options.version) this.root.push(createCompatibilitySetting(options.version));
23123
+ if (options.version) this.root.push(createCompatibilitySetting("compatibilityMode", options.version));
23124
23124
  if (options.useSingleBorderforContiguousCells) this.root.push(new OnOffElement("w:useSingleBorderforContiguousCells", options.useSingleBorderforContiguousCells));
23125
23125
  if (options.wordPerfectJustification) this.root.push(new OnOffElement("w:wpJustification", options.wordPerfectJustification));
23126
23126
  if (options.noTabStopForHangingIndent) this.root.push(new OnOffElement("w:noTabHangInd", options.noTabStopForHangingIndent));
@@ -23186,6 +23186,9 @@
23186
23186
  if (options.ignoreVerticalAlignmentInTextboxes) this.root.push(new OnOffElement("w:doNotVertAlignInTxbx", options.ignoreVerticalAlignmentInTextboxes));
23187
23187
  if (options.useAnsiKerningPairs) this.root.push(new OnOffElement("w:useAnsiKerningPairs", options.useAnsiKerningPairs));
23188
23188
  if (options.cachedColumnBalance) this.root.push(new OnOffElement("w:cachedColBalance", options.cachedColumnBalance));
23189
+ if (options.overrideTableStyleFontSizeAndJustification) this.root.push(createCompatibilitySetting("overrideTableStyleFontSizeAndJustification", 1));
23190
+ if (options.enableOpenTypeFeatures) this.root.push(createCompatibilitySetting("enableOpenTypeFeatures", 1));
23191
+ if (options.doNotFlipMirrorIndents) this.root.push(createCompatibilitySetting("doNotFlipMirrorIndents", 1));
23189
23192
  }
23190
23193
  };
23191
23194
  //#endregion
@@ -23281,7 +23284,7 @@
23281
23284
  */
23282
23285
  var Settings = class extends XmlComponent {
23283
23286
  constructor(options) {
23284
- var _options$hyphenation, _options$hyphenation2, _options$hyphenation3, _options$hyphenation4, _ref, _options$compatibilit, _options$compatibilit2;
23287
+ var _options$defaultTabSt, _options$hyphenation, _options$hyphenation2, _options$hyphenation3, _options$hyphenation4, _options$characterSpa, _ref, _options$compatibilit, _options$compatibilit2, _options$compatibilit3, _options$compatibilit4, _options$compatibilit5, _options$compatibilit6, _options$compatibilit7, _options$compatibilit8, _options$compatibilit9, _options$compatibilit10, _options$compatibilit11, _options$compatibilit12, _options$compatibilit13, _options$compatibilit14, _options$compatibilit15, _options$compatibilit16, _options$compatibilit17, _options$compatibilit18, _options$compatibilit19, _options$compatibilit20, _options$compatibilit21, _options$compatibilit22;
23285
23288
  super("w:settings");
23286
23289
  this.root.push(new SettingsAttributes({
23287
23290
  Ignorable: "w14 w15 wp14",
@@ -23302,18 +23305,28 @@
23302
23305
  wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
23303
23306
  wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
23304
23307
  }));
23305
- this.root.push(new OnOffElement("w:displayBackgroundShape", true));
23306
23308
  if (options.trackRevisions !== void 0) this.root.push(new OnOffElement("w:trackRevisions", options.trackRevisions));
23307
23309
  if (options.evenAndOddHeaders !== void 0) this.root.push(new OnOffElement("w:evenAndOddHeaders", options.evenAndOddHeaders));
23308
23310
  if (options.updateFields !== void 0) this.root.push(new OnOffElement("w:updateFields", options.updateFields));
23309
- if (options.defaultTabStop !== void 0) this.root.push(new NumberValueElement("w:defaultTabStop", options.defaultTabStop));
23311
+ this.root.push(new NumberValueElement("w:defaultTabStop", (_options$defaultTabSt = options.defaultTabStop) !== null && _options$defaultTabSt !== void 0 ? _options$defaultTabSt : 420));
23310
23312
  if (((_options$hyphenation = options.hyphenation) === null || _options$hyphenation === void 0 ? void 0 : _options$hyphenation.autoHyphenation) !== void 0) this.root.push(new OnOffElement("w:autoHyphenation", options.hyphenation.autoHyphenation));
23311
23313
  if (((_options$hyphenation2 = options.hyphenation) === null || _options$hyphenation2 === void 0 ? void 0 : _options$hyphenation2.hyphenationZone) !== void 0) this.root.push(new NumberValueElement("w:hyphenationZone", options.hyphenation.hyphenationZone));
23312
23314
  if (((_options$hyphenation3 = options.hyphenation) === null || _options$hyphenation3 === void 0 ? void 0 : _options$hyphenation3.consecutiveHyphenLimit) !== void 0) this.root.push(new NumberValueElement("w:consecutiveHyphenLimit", options.hyphenation.consecutiveHyphenLimit));
23313
23315
  if (((_options$hyphenation4 = options.hyphenation) === null || _options$hyphenation4 === void 0 ? void 0 : _options$hyphenation4.doNotHyphenateCaps) !== void 0) this.root.push(new OnOffElement("w:doNotHyphenateCaps", options.hyphenation.doNotHyphenateCaps));
23316
+ this.root.push(new StringValueElement("w:characterSpacingControl", (_options$characterSpa = options.characterSpacingControl) !== null && _options$characterSpa !== void 0 ? _options$characterSpa : "compressPunctuation"));
23314
23317
  this.root.push(new Compatibility({
23315
23318
  ...options.compatibility,
23316
- version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15
23319
+ version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15,
23320
+ spaceForUnderline: (_options$compatibilit3 = (_options$compatibilit4 = options.compatibility) === null || _options$compatibilit4 === void 0 ? void 0 : _options$compatibilit4.spaceForUnderline) !== null && _options$compatibilit3 !== void 0 ? _options$compatibilit3 : true,
23321
+ balanceSingleByteDoubleByteWidth: (_options$compatibilit5 = (_options$compatibilit6 = options.compatibility) === null || _options$compatibilit6 === void 0 ? void 0 : _options$compatibilit6.balanceSingleByteDoubleByteWidth) !== null && _options$compatibilit5 !== void 0 ? _options$compatibilit5 : true,
23322
+ doNotLeaveBackslashAlone: (_options$compatibilit7 = (_options$compatibilit8 = options.compatibility) === null || _options$compatibilit8 === void 0 ? void 0 : _options$compatibilit8.doNotLeaveBackslashAlone) !== null && _options$compatibilit7 !== void 0 ? _options$compatibilit7 : true,
23323
+ underlineTrailingSpaces: (_options$compatibilit9 = (_options$compatibilit10 = options.compatibility) === null || _options$compatibilit10 === void 0 ? void 0 : _options$compatibilit10.underlineTrailingSpaces) !== null && _options$compatibilit9 !== void 0 ? _options$compatibilit9 : true,
23324
+ doNotExpandShiftReturn: (_options$compatibilit11 = (_options$compatibilit12 = options.compatibility) === null || _options$compatibilit12 === void 0 ? void 0 : _options$compatibilit12.doNotExpandShiftReturn) !== null && _options$compatibilit11 !== void 0 ? _options$compatibilit11 : true,
23325
+ adjustLineHeightInTable: (_options$compatibilit13 = (_options$compatibilit14 = options.compatibility) === null || _options$compatibilit14 === void 0 ? void 0 : _options$compatibilit14.adjustLineHeightInTable) !== null && _options$compatibilit13 !== void 0 ? _options$compatibilit13 : true,
23326
+ useFELayout: (_options$compatibilit15 = (_options$compatibilit16 = options.compatibility) === null || _options$compatibilit16 === void 0 ? void 0 : _options$compatibilit16.useFELayout) !== null && _options$compatibilit15 !== void 0 ? _options$compatibilit15 : true,
23327
+ overrideTableStyleFontSizeAndJustification: (_options$compatibilit17 = (_options$compatibilit18 = options.compatibility) === null || _options$compatibilit18 === void 0 ? void 0 : _options$compatibilit18.overrideTableStyleFontSizeAndJustification) !== null && _options$compatibilit17 !== void 0 ? _options$compatibilit17 : true,
23328
+ enableOpenTypeFeatures: (_options$compatibilit19 = (_options$compatibilit20 = options.compatibility) === null || _options$compatibilit20 === void 0 ? void 0 : _options$compatibilit20.enableOpenTypeFeatures) !== null && _options$compatibilit19 !== void 0 ? _options$compatibilit19 : true,
23329
+ doNotFlipMirrorIndents: (_options$compatibilit21 = (_options$compatibilit22 = options.compatibility) === null || _options$compatibilit22 === void 0 ? void 0 : _options$compatibilit22.doNotFlipMirrorIndents) !== null && _options$compatibilit21 !== void 0 ? _options$compatibilit21 : true
23317
23330
  }));
23318
23331
  }
23319
23332
  };
@@ -24150,11 +24163,11 @@
24150
24163
  * Factory for creating default document styles.
24151
24164
  *
24152
24165
  * This factory creates a complete set of default styles for common document elements
24153
- * such as headings, hyperlinks, and footnotes with sensible default formatting.
24166
+ * such as headings, hyperlinks, and footnotes.
24154
24167
  *
24155
24168
  * @example
24156
24169
  * ```typescript
24157
- * // Create default styles with custom heading colors
24170
+ * // Create default styles with custom heading formatting
24158
24171
  * const factory = new DefaultStylesFactory();
24159
24172
  * const styles = factory.newInstance({
24160
24173
  * heading1: {
@@ -24183,42 +24196,12 @@
24183
24196
  run: { size: 56 },
24184
24197
  ...options.title
24185
24198
  }),
24186
- new Heading1Style({
24187
- run: {
24188
- color: "2E74B5",
24189
- size: 32
24190
- },
24191
- ...options.heading1
24192
- }),
24193
- new Heading2Style({
24194
- run: {
24195
- color: "2E74B5",
24196
- size: 26
24197
- },
24198
- ...options.heading2
24199
- }),
24200
- new Heading3Style({
24201
- run: {
24202
- color: "1F4D78",
24203
- size: 24
24204
- },
24205
- ...options.heading3
24206
- }),
24207
- new Heading4Style({
24208
- run: {
24209
- color: "2E74B5",
24210
- italics: true
24211
- },
24212
- ...options.heading4
24213
- }),
24214
- new Heading5Style({
24215
- run: { color: "2E74B5" },
24216
- ...options.heading5
24217
- }),
24218
- new Heading6Style({
24219
- run: { color: "1F4D78" },
24220
- ...options.heading6
24221
- }),
24199
+ new Heading1Style(options.heading1 || {}),
24200
+ new Heading2Style(options.heading2 || {}),
24201
+ new Heading3Style(options.heading3 || {}),
24202
+ new Heading4Style(options.heading4 || {}),
24203
+ new Heading5Style(options.heading5 || {}),
24204
+ new Heading6Style(options.heading6 || {}),
24222
24205
  new StrongStyle({
24223
24206
  run: { bold: true },
24224
24207
  ...options.strong
@@ -24360,6 +24343,7 @@
24360
24343
  compatibilityModeVersion: options.compatabilityModeVersion,
24361
24344
  defaultTabStop: options.defaultTabStop,
24362
24345
  evenAndOddHeaders: options.evenAndOddHeaderAndFooters ? true : false,
24346
+ characterSpacingControl: options.characterSpacingControl,
24363
24347
  hyphenation: {
24364
24348
  autoHyphenation: (_options$hyphenation = options.hyphenation) === null || _options$hyphenation === void 0 ? void 0 : _options$hyphenation.autoHyphenation,
24365
24349
  consecutiveHyphenLimit: (_options$hyphenation2 = options.hyphenation) === null || _options$hyphenation2 === void 0 ? void 0 : _options$hyphenation2.consecutiveHyphenLimit,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docx-plus",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.",
5
5
  "keywords": [
6
6
  "clippy",