@cj-tech-master/excelts 9.6.0 → 9.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/browser/modules/archive/io/random-access.d.ts +1 -1
  2. package/dist/browser/modules/excel/workbook.browser.d.ts +1 -1
  3. package/dist/browser/modules/excel/xlsx/xform/comment/comment-xform.d.ts +3 -0
  4. package/dist/browser/modules/excel/xlsx/xform/comment/comment-xform.js +30 -7
  5. package/dist/browser/modules/pdf/excel-bridge.d.ts +32 -0
  6. package/dist/browser/modules/pdf/excel-bridge.js +67 -1
  7. package/dist/browser/modules/pdf/word-bridge.d.ts +20 -15
  8. package/dist/browser/modules/pdf/word-bridge.js +49 -34
  9. package/dist/browser/modules/stream/common/consumers.d.ts +2 -1
  10. package/dist/browser/modules/word/advanced/diff.js +125 -13
  11. package/dist/browser/modules/word/advanced/drawing-shapes.js +3 -0
  12. package/dist/browser/modules/word/bridge/excel-bridge.js +21 -1
  13. package/dist/browser/modules/word/builder/document-handle.d.ts +2 -0
  14. package/dist/browser/modules/word/builder/document-handle.js +14 -2
  15. package/dist/browser/modules/word/builder/paragraph-builders.js +10 -1
  16. package/dist/browser/modules/word/builder/run-builders.d.ts +19 -2
  17. package/dist/browser/modules/word/builder/run-builders.js +2 -6
  18. package/dist/browser/modules/word/convert/odt/odt.js +6 -1
  19. package/dist/browser/modules/word/layout/layout-full.d.ts +12 -0
  20. package/dist/browser/modules/word/layout/layout-full.js +74 -9
  21. package/dist/browser/modules/word/layout/layout-model.d.ts +12 -0
  22. package/dist/browser/modules/word/query/merge.js +26 -10
  23. package/dist/browser/modules/word/query/split.js +68 -2
  24. package/dist/browser/modules/word/reader/docx-reader.js +23 -0
  25. package/dist/browser/modules/word/security/cfb-reader.d.ts +14 -3
  26. package/dist/browser/modules/word/security/cfb-reader.js +271 -153
  27. package/dist/browser/modules/word/security/document-protection.js +10 -4
  28. package/dist/browser/modules/word/security/encryption.js +194 -32
  29. package/dist/browser/modules/word/types.d.ts +17 -0
  30. package/dist/browser/modules/word/units.d.ts +10 -4
  31. package/dist/browser/modules/word/units.js +10 -4
  32. package/dist/browser/modules/word/writer/document-writer.js +28 -4
  33. package/dist/browser/modules/word/writer/docx-packager.js +45 -5
  34. package/dist/browser/modules/word/writer/image-writer.d.ts +1 -1
  35. package/dist/browser/modules/word/writer/image-writer.js +2 -2
  36. package/dist/browser/modules/word/writer/render-context.d.ts +15 -0
  37. package/dist/browser/modules/word/writer/run-writer.js +8 -4
  38. package/dist/browser/modules/word/writer/section-writer.js +46 -35
  39. package/dist/browser/modules/word/writer/streaming-writer.js +4 -0
  40. package/dist/browser/modules/word/writer/styles-writer.js +11 -0
  41. package/dist/browser/modules/word/writer/table-writer.js +6 -0
  42. package/dist/cjs/modules/excel/xlsx/xform/comment/comment-xform.js +30 -7
  43. package/dist/cjs/modules/pdf/excel-bridge.js +67 -0
  44. package/dist/cjs/modules/pdf/word-bridge.js +49 -34
  45. package/dist/cjs/modules/word/advanced/diff.js +125 -13
  46. package/dist/cjs/modules/word/advanced/drawing-shapes.js +3 -0
  47. package/dist/cjs/modules/word/bridge/excel-bridge.js +21 -1
  48. package/dist/cjs/modules/word/builder/document-handle.js +14 -2
  49. package/dist/cjs/modules/word/builder/paragraph-builders.js +10 -1
  50. package/dist/cjs/modules/word/builder/run-builders.js +2 -6
  51. package/dist/cjs/modules/word/convert/odt/odt.js +6 -1
  52. package/dist/cjs/modules/word/layout/layout-full.js +74 -9
  53. package/dist/cjs/modules/word/query/merge.js +26 -10
  54. package/dist/cjs/modules/word/query/split.js +68 -2
  55. package/dist/cjs/modules/word/reader/docx-reader.js +23 -0
  56. package/dist/cjs/modules/word/security/cfb-reader.js +271 -153
  57. package/dist/cjs/modules/word/security/document-protection.js +10 -4
  58. package/dist/cjs/modules/word/security/encryption.js +193 -31
  59. package/dist/cjs/modules/word/units.js +10 -4
  60. package/dist/cjs/modules/word/writer/document-writer.js +28 -4
  61. package/dist/cjs/modules/word/writer/docx-packager.js +45 -5
  62. package/dist/cjs/modules/word/writer/image-writer.js +2 -2
  63. package/dist/cjs/modules/word/writer/run-writer.js +8 -4
  64. package/dist/cjs/modules/word/writer/section-writer.js +46 -35
  65. package/dist/cjs/modules/word/writer/streaming-writer.js +4 -0
  66. package/dist/cjs/modules/word/writer/styles-writer.js +11 -0
  67. package/dist/cjs/modules/word/writer/table-writer.js +6 -0
  68. package/dist/esm/modules/excel/xlsx/xform/comment/comment-xform.js +30 -7
  69. package/dist/esm/modules/pdf/excel-bridge.js +67 -1
  70. package/dist/esm/modules/pdf/word-bridge.js +49 -34
  71. package/dist/esm/modules/word/advanced/diff.js +125 -13
  72. package/dist/esm/modules/word/advanced/drawing-shapes.js +3 -0
  73. package/dist/esm/modules/word/bridge/excel-bridge.js +21 -1
  74. package/dist/esm/modules/word/builder/document-handle.js +14 -2
  75. package/dist/esm/modules/word/builder/paragraph-builders.js +10 -1
  76. package/dist/esm/modules/word/builder/run-builders.js +2 -6
  77. package/dist/esm/modules/word/convert/odt/odt.js +6 -1
  78. package/dist/esm/modules/word/layout/layout-full.js +74 -9
  79. package/dist/esm/modules/word/query/merge.js +26 -10
  80. package/dist/esm/modules/word/query/split.js +68 -2
  81. package/dist/esm/modules/word/reader/docx-reader.js +23 -0
  82. package/dist/esm/modules/word/security/cfb-reader.js +271 -153
  83. package/dist/esm/modules/word/security/document-protection.js +10 -4
  84. package/dist/esm/modules/word/security/encryption.js +194 -32
  85. package/dist/esm/modules/word/units.js +10 -4
  86. package/dist/esm/modules/word/writer/document-writer.js +28 -4
  87. package/dist/esm/modules/word/writer/docx-packager.js +45 -5
  88. package/dist/esm/modules/word/writer/image-writer.js +2 -2
  89. package/dist/esm/modules/word/writer/run-writer.js +8 -4
  90. package/dist/esm/modules/word/writer/section-writer.js +46 -35
  91. package/dist/esm/modules/word/writer/streaming-writer.js +4 -0
  92. package/dist/esm/modules/word/writer/styles-writer.js +11 -0
  93. package/dist/esm/modules/word/writer/table-writer.js +6 -0
  94. package/dist/iife/excelts.iife.js +20 -8
  95. package/dist/iife/excelts.iife.js.map +1 -1
  96. package/dist/iife/excelts.iife.min.js +2 -2
  97. package/dist/types/modules/archive/io/random-access.d.ts +1 -1
  98. package/dist/types/modules/excel/workbook.browser.d.ts +1 -1
  99. package/dist/types/modules/excel/xlsx/xform/comment/comment-xform.d.ts +3 -0
  100. package/dist/types/modules/pdf/excel-bridge.d.ts +32 -0
  101. package/dist/types/modules/pdf/word-bridge.d.ts +20 -15
  102. package/dist/types/modules/stream/common/consumers.d.ts +2 -1
  103. package/dist/types/modules/word/builder/document-handle.d.ts +2 -0
  104. package/dist/types/modules/word/builder/run-builders.d.ts +19 -2
  105. package/dist/types/modules/word/layout/layout-full.d.ts +12 -0
  106. package/dist/types/modules/word/layout/layout-model.d.ts +12 -0
  107. package/dist/types/modules/word/security/cfb-reader.d.ts +14 -3
  108. package/dist/types/modules/word/types.d.ts +17 -0
  109. package/dist/types/modules/word/units.d.ts +10 -4
  110. package/dist/types/modules/word/writer/image-writer.d.ts +1 -1
  111. package/dist/types/modules/word/writer/render-context.d.ts +15 -0
  112. package/package.json +2 -2
@@ -87,6 +87,16 @@ function renderPageBorders(xml, borders) {
87
87
  /** Render w:sectPr element. */
88
88
  export function renderSectionProperties(xml, sect, insidePropertyChange = false) {
89
89
  xml.openNode("w:sectPr");
90
+ // NOTE: Child element ordering below is dictated by the OOXML schema
91
+ // (ISO/IEC 29500 — CT_SectPr / EG_SectPrContents). Microsoft Word rejects
92
+ // (or silently "repairs") documents whose sectPr children are out of order,
93
+ // so the sequence here MUST stay:
94
+ // headerReference*, footerReference*, footnotePr, endnotePr, type, pgSz,
95
+ // pgMar, paperSrc, pgBorders, lnNumType, pgNumType, cols, formProt,
96
+ // vAlign, noEndnote, titlePg, textDirection, bidi, rtlGutter, docGrid,
97
+ // printerSettings
98
+ // (headerReference/footerReference come from EG_HdrFtrReferences, which the
99
+ // schema places ahead of EG_SectPrContents.)
90
100
  // Header references
91
101
  if (sect.headers) {
92
102
  for (const ref of sect.headers) {
@@ -99,6 +109,14 @@ export function renderSectionProperties(xml, sect, insidePropertyChange = false)
99
109
  renderHeaderFooterRef(xml, "w:footerReference", ref);
100
110
  }
101
111
  }
112
+ // Footnote properties
113
+ if (sect.footnoteProperties) {
114
+ renderNoteProperties(xml, "w:footnotePr", sect.footnoteProperties);
115
+ }
116
+ // Endnote properties
117
+ if (sect.endnoteProperties) {
118
+ renderNoteProperties(xml, "w:endnotePr", sect.endnoteProperties);
119
+ }
102
120
  // Section break type
103
121
  if (sect.breakType) {
104
122
  xml.leafNode("w:type", { "w:val": sect.breakType });
@@ -131,29 +149,7 @@ export function renderSectionProperties(xml, sect, insidePropertyChange = false)
131
149
  if (sect.pageBorders) {
132
150
  renderPageBorders(xml, sect.pageBorders);
133
151
  }
134
- // Columns
135
- if (sect.columns) {
136
- renderColumns(xml, sect.columns);
137
- }
138
- else {
139
- xml.leafNode("w:cols", { "w:space": String(DEFAULT_COLUMN_SPACE) });
140
- }
141
- // Title page (different first page header/footer)
142
- if (sect.titlePage) {
143
- xml.leafNode("w:titlePg");
144
- }
145
- // Page numbering
146
- if (sect.pageNumbering) {
147
- const attrs = {};
148
- if (sect.pageNumbering.start !== undefined) {
149
- attrs["w:start"] = String(sect.pageNumbering.start);
150
- }
151
- if (sect.pageNumbering.format) {
152
- attrs["w:fmt"] = sect.pageNumbering.format;
153
- }
154
- xml.leafNode("w:pgNumType", attrs);
155
- }
156
- // Line numbers
152
+ // Line numbers (must precede pgNumType per schema)
157
153
  if (sect.lineNumbers) {
158
154
  const attrs = {};
159
155
  if (sect.lineNumbers.countBy !== undefined) {
@@ -170,10 +166,37 @@ export function renderSectionProperties(xml, sect, insidePropertyChange = false)
170
166
  }
171
167
  xml.leafNode("w:lnNumType", attrs);
172
168
  }
169
+ // Page numbering
170
+ if (sect.pageNumbering) {
171
+ const attrs = {};
172
+ if (sect.pageNumbering.start !== undefined) {
173
+ attrs["w:start"] = String(sect.pageNumbering.start);
174
+ }
175
+ if (sect.pageNumbering.format) {
176
+ attrs["w:fmt"] = sect.pageNumbering.format;
177
+ }
178
+ xml.leafNode("w:pgNumType", attrs);
179
+ }
180
+ // Columns
181
+ if (sect.columns) {
182
+ renderColumns(xml, sect.columns);
183
+ }
184
+ else {
185
+ xml.leafNode("w:cols", { "w:space": String(DEFAULT_COLUMN_SPACE) });
186
+ }
187
+ // Form protection
188
+ if (sect.formProtection) {
189
+ xml.leafNode("w:formProt", { "w:val": "1" });
190
+ }
173
191
  // Vertical alignment
174
192
  if (sect.verticalAlign) {
175
193
  xml.leafNode("w:vAlign", { "w:val": sect.verticalAlign });
176
194
  }
195
+ // Title page (different first page header/footer) — schema places this
196
+ // after vAlign/noEndnote and before textDirection.
197
+ if (sect.titlePage) {
198
+ xml.leafNode("w:titlePg");
199
+ }
177
200
  // Text direction
178
201
  if (sect.textDirection) {
179
202
  xml.leafNode("w:textDirection", { "w:val": sect.textDirection });
@@ -186,18 +209,6 @@ export function renderSectionProperties(xml, sect, insidePropertyChange = false)
186
209
  if (sect.rtlGutter) {
187
210
  xml.leafNode("w:rtlGutter");
188
211
  }
189
- // Form protection
190
- if (sect.formProtection) {
191
- xml.leafNode("w:formProt", { "w:val": "1" });
192
- }
193
- // Footnote properties
194
- if (sect.footnoteProperties) {
195
- renderNoteProperties(xml, "w:footnotePr", sect.footnoteProperties);
196
- }
197
- // Endnote properties
198
- if (sect.endnoteProperties) {
199
- renderNoteProperties(xml, "w:endnotePr", sect.endnoteProperties);
200
- }
201
212
  // Document grid
202
213
  if (sect.docGrid) {
203
214
  const gridAttrs = {
@@ -900,6 +900,7 @@ export class StreamingDocxWriter {
900
900
  addXmlFile(PartPath.Comments, xml => renderComments(xml, this._options.comments, {
901
901
  imageRemap: this._renderCtx.imageRIdRemap,
902
902
  hyperlinkRIds: this._renderCtx.hyperlinkRIds,
903
+ nextDocPrId: this._renderCtx.ids.nextDocPrId,
903
904
  rawXmlPolicy: this._renderCtx.rawXmlPolicy
904
905
  }));
905
906
  // Also write commentsExtended if any have done/parentId
@@ -973,6 +974,7 @@ export class StreamingDocxWriter {
973
974
  addXmlFile(headerPath, xml => renderHeader(xml, headerDef.content, {
974
975
  imageRemap: this._renderCtx.imageRIdRemap,
975
976
  hyperlinkRIds: this._renderCtx.hyperlinkRIds,
977
+ nextDocPrId: this._renderCtx.ids.nextDocPrId,
976
978
  rawXmlPolicy: this._renderCtx.rawXmlPolicy
977
979
  }));
978
980
  if (getRelationshipCount(hRels) > 0) {
@@ -1043,6 +1045,7 @@ export class StreamingDocxWriter {
1043
1045
  addXmlFile(footerPath, xml => renderFooter(xml, footerDef.content, {
1044
1046
  imageRemap: this._renderCtx.imageRIdRemap,
1045
1047
  hyperlinkRIds: this._renderCtx.hyperlinkRIds,
1048
+ nextDocPrId: this._renderCtx.ids.nextDocPrId,
1046
1049
  rawXmlPolicy: this._renderCtx.rawXmlPolicy
1047
1050
  }));
1048
1051
  if (getRelationshipCount(fRels) > 0) {
@@ -1221,6 +1224,7 @@ export class StreamingDocxWriter {
1221
1224
  notesHelpers: {
1222
1225
  imageRemap: this._renderCtx.imageRIdRemap,
1223
1226
  hyperlinkRIds: this._renderCtx.hyperlinkRIds,
1227
+ nextDocPrId: this._renderCtx.ids.nextDocPrId,
1224
1228
  rawXmlPolicy: this._renderCtx.rawXmlPolicy
1225
1229
  }
1226
1230
  });
@@ -170,6 +170,17 @@ function renderStyle(xml, style) {
170
170
  // For table styles
171
171
  if (style.tableProperties) {
172
172
  xml.openNode("w:tblPr");
173
+ // Per CT_TblPrBase order, band sizes precede w:tblW.
174
+ if (style.tableProperties.rowBandSize !== undefined) {
175
+ xml.leafNode("w:tblStyleRowBandSize", {
176
+ "w:val": String(style.tableProperties.rowBandSize)
177
+ });
178
+ }
179
+ if (style.tableProperties.colBandSize !== undefined) {
180
+ xml.leafNode("w:tblStyleColBandSize", {
181
+ "w:val": String(style.tableProperties.colBandSize)
182
+ });
183
+ }
173
184
  if (style.tableProperties.width) {
174
185
  xml.leafNode("w:tblW", {
175
186
  "w:w": String(style.tableProperties.width.value),
@@ -168,6 +168,12 @@ function renderTableProperties(xml, tPr, insidePropertyChange = false) {
168
168
  xml.leafNode("w:tblOverlap", { "w:val": tPr.float.overlap });
169
169
  }
170
170
  }
171
+ if (tPr.rowBandSize !== undefined) {
172
+ xml.leafNode("w:tblStyleRowBandSize", { "w:val": String(tPr.rowBandSize) });
173
+ }
174
+ if (tPr.colBandSize !== undefined) {
175
+ xml.leafNode("w:tblStyleColBandSize", { "w:val": String(tPr.colBandSize) });
176
+ }
171
177
  if (tPr.width) {
172
178
  renderTableWidth(xml, "w:tblW", tPr.width);
173
179
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @cj-tech-master/excelts v9.6.0
2
+ * @cj-tech-master/excelts v9.6.1
3
3
  * Zero-dependency TypeScript toolkit — Excel (XLSX), PDF, CSV, Markdown, XML, ZIP/TAR, and streaming.
4
4
  * (c) 2026 cjnoname
5
5
  * Released under the MIT License
@@ -26189,6 +26189,7 @@ self.onmessage = async function(event) {
26189
26189
  var WRITE_AFTER_END_ERROR, AsyncStreamCodec, BufferedCodec;
26190
26190
  var init_streaming_compress_browser = __esmMin((() => {
26191
26191
  init_compress_base();
26192
+ init_compress_browser();
26192
26193
  init_deflate_fallback();
26193
26194
  init_index_browser();
26194
26195
  init_defaults();
@@ -27779,6 +27780,7 @@ self.onmessage = async function(event) {
27779
27780
  var init_comment_xform = __esmMin((() => {
27780
27781
  init_base_xform();
27781
27782
  init_rich_text_xform();
27783
+ init_text_xform();
27782
27784
  CommentXform = class extends BaseXform {
27783
27785
  constructor(model) {
27784
27786
  super();
@@ -27795,6 +27797,10 @@ self.onmessage = async function(event) {
27795
27797
  if (!this._richTextXform) this._richTextXform = new RichTextXform();
27796
27798
  return this._richTextXform;
27797
27799
  }
27800
+ get textXform() {
27801
+ if (!this._textXform) this._textXform = new TextXform();
27802
+ return this._textXform;
27803
+ }
27798
27804
  render(xmlStream, model) {
27799
27805
  const renderModel = model || this.model;
27800
27806
  xmlStream.openNode("comment", {
@@ -27826,6 +27832,10 @@ self.onmessage = async function(event) {
27826
27832
  this.parser = this.richTextXform;
27827
27833
  this.parser.parseOpen(node);
27828
27834
  return true;
27835
+ case "t":
27836
+ this.parser = this.textXform;
27837
+ this.parser.parseOpen(node);
27838
+ return true;
27829
27839
  default: return false;
27830
27840
  }
27831
27841
  }
@@ -27833,15 +27843,17 @@ self.onmessage = async function(event) {
27833
27843
  if (this.parser) this.parser.parseText(text);
27834
27844
  }
27835
27845
  parseClose(name) {
27846
+ if (this.parser) {
27847
+ if (!this.parser.parseClose(name)) {
27848
+ if (this.parser === this._richTextXform) this.model.note.texts.push(this.parser.model);
27849
+ else this.model.note.texts.push({ text: this.parser.model });
27850
+ this.parser = void 0;
27851
+ }
27852
+ return true;
27853
+ }
27836
27854
  switch (name) {
27837
27855
  case "comment": return false;
27838
- case "r":
27839
- this.model.note.texts.push(this.parser.model);
27840
- this.parser = void 0;
27841
- return true;
27842
- default:
27843
- if (this.parser) this.parser.parseClose(name);
27844
- return true;
27856
+ default: return true;
27845
27857
  }
27846
27858
  }
27847
27859
  };