@cj-tech-master/excelts 10.1.0 → 10.2.0

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.
@@ -179,7 +179,7 @@ function prepareLayout(sheet, options, fontManager) {
179
179
  const headerHeight = options.showSheetNames ? 20 : 0;
180
180
  const footerHeight = options.showPageNumbers ? 20 : 0;
181
181
  const availableHeight = contentHeight - headerHeight - footerHeight;
182
- const printRange = getPrintRange(sheet);
182
+ const printRange = getPrintRange(sheet, options);
183
183
  // --- Step 1: Visible columns and widths ---
184
184
  const { columnWidths, visibleCols } = computeColumnWidths(sheet, printRange);
185
185
  if (visibleCols.length === 0) {
@@ -386,9 +386,12 @@ function parseRangeRef(range) {
386
386
  }
387
387
  /**
388
388
  * Get the print area range from the sheet's pageSetup.
389
- * Returns null if no print area is set.
389
+ * Returns null if no print area is set, or if `ignorePrintArea` is enabled.
390
390
  */
391
- function getPrintRange(sheet) {
391
+ function getPrintRange(sheet, options) {
392
+ if (options.ignorePrintArea) {
393
+ return null;
394
+ }
392
395
  const printArea = sheet.pageSetup?.printArea;
393
396
  if (!printArea || typeof printArea !== "string") {
394
397
  return null;
@@ -448,6 +448,7 @@ function resolveOptions(options, sheet) {
448
448
  pageSize,
449
449
  orientation,
450
450
  margins,
451
+ ignorePrintArea: options?.ignorePrintArea ?? false,
451
452
  fitToPage: options?.fitToPage !== undefined ? options.fitToPage : true,
452
453
  scale: Math.max(0.1, Math.min(3.0, options?.scale ??
453
454
  // When fitToPage is active (default), ignore sheet's pageSetup.scale
@@ -411,6 +411,14 @@ export interface PdfExportOptions {
411
411
  * If omitted, all visible sheets are included.
412
412
  */
413
413
  sheets?: (string | number)[];
414
+ /**
415
+ * Whether to ignore each worksheet's print area when exporting.
416
+ * When true, the entire used range of every sheet is exported, regardless
417
+ * of any `pageSetup.printArea` defined on the worksheet. The workbook itself
418
+ * is left unmodified.
419
+ * @default false
420
+ */
421
+ ignorePrintArea?: boolean;
414
422
  /**
415
423
  * Whether to auto-fit column widths to page width.
416
424
  * When true, columns are scaled proportionally to fit the page.
@@ -770,6 +778,7 @@ export interface ResolvedPdfOptions {
770
778
  pageSize: PdfPageSize;
771
779
  orientation: PdfOrientation;
772
780
  margins: PdfMargins;
781
+ ignorePrintArea: boolean;
773
782
  fitToPage: boolean;
774
783
  scale: number;
775
784
  showGridLines: boolean;
@@ -186,7 +186,7 @@ function prepareLayout(sheet, options, fontManager) {
186
186
  const headerHeight = options.showSheetNames ? 20 : 0;
187
187
  const footerHeight = options.showPageNumbers ? 20 : 0;
188
188
  const availableHeight = contentHeight - headerHeight - footerHeight;
189
- const printRange = getPrintRange(sheet);
189
+ const printRange = getPrintRange(sheet, options);
190
190
  // --- Step 1: Visible columns and widths ---
191
191
  const { columnWidths, visibleCols } = computeColumnWidths(sheet, printRange);
192
192
  if (visibleCols.length === 0) {
@@ -393,9 +393,12 @@ function parseRangeRef(range) {
393
393
  }
394
394
  /**
395
395
  * Get the print area range from the sheet's pageSetup.
396
- * Returns null if no print area is set.
396
+ * Returns null if no print area is set, or if `ignorePrintArea` is enabled.
397
397
  */
398
- function getPrintRange(sheet) {
398
+ function getPrintRange(sheet, options) {
399
+ if (options.ignorePrintArea) {
400
+ return null;
401
+ }
399
402
  const printArea = sheet.pageSetup?.printArea;
400
403
  if (!printArea || typeof printArea !== "string") {
401
404
  return null;
@@ -451,6 +451,7 @@ function resolveOptions(options, sheet) {
451
451
  pageSize,
452
452
  orientation,
453
453
  margins,
454
+ ignorePrintArea: options?.ignorePrintArea ?? false,
454
455
  fitToPage: options?.fitToPage !== undefined ? options.fitToPage : true,
455
456
  scale: Math.max(0.1, Math.min(3.0, options?.scale ??
456
457
  // When fitToPage is active (default), ignore sheet's pageSetup.scale
@@ -179,7 +179,7 @@ function prepareLayout(sheet, options, fontManager) {
179
179
  const headerHeight = options.showSheetNames ? 20 : 0;
180
180
  const footerHeight = options.showPageNumbers ? 20 : 0;
181
181
  const availableHeight = contentHeight - headerHeight - footerHeight;
182
- const printRange = getPrintRange(sheet);
182
+ const printRange = getPrintRange(sheet, options);
183
183
  // --- Step 1: Visible columns and widths ---
184
184
  const { columnWidths, visibleCols } = computeColumnWidths(sheet, printRange);
185
185
  if (visibleCols.length === 0) {
@@ -386,9 +386,12 @@ function parseRangeRef(range) {
386
386
  }
387
387
  /**
388
388
  * Get the print area range from the sheet's pageSetup.
389
- * Returns null if no print area is set.
389
+ * Returns null if no print area is set, or if `ignorePrintArea` is enabled.
390
390
  */
391
- function getPrintRange(sheet) {
391
+ function getPrintRange(sheet, options) {
392
+ if (options.ignorePrintArea) {
393
+ return null;
394
+ }
392
395
  const printArea = sheet.pageSetup?.printArea;
393
396
  if (!printArea || typeof printArea !== "string") {
394
397
  return null;
@@ -448,6 +448,7 @@ function resolveOptions(options, sheet) {
448
448
  pageSize,
449
449
  orientation,
450
450
  margins,
451
+ ignorePrintArea: options?.ignorePrintArea ?? false,
451
452
  fitToPage: options?.fitToPage !== undefined ? options.fitToPage : true,
452
453
  scale: Math.max(0.1, Math.min(3.0, options?.scale ??
453
454
  // When fitToPage is active (default), ignore sheet's pageSetup.scale
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @cj-tech-master/excelts v10.1.0
2
+ * @cj-tech-master/excelts v10.2.0
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
@@ -90242,7 +90242,7 @@ self.onmessage = async function(event) {
90242
90242
  const headerHeight = options.showSheetNames ? 20 : 0;
90243
90243
  const footerHeight = options.showPageNumbers ? 20 : 0;
90244
90244
  const availableHeight = contentHeight - headerHeight - footerHeight;
90245
- const printRange = getPrintRange(sheet);
90245
+ const printRange = getPrintRange(sheet, options);
90246
90246
  const { columnWidths, visibleCols } = computeColumnWidths(sheet, printRange);
90247
90247
  if (visibleCols.length === 0) return null;
90248
90248
  const totalTableWidth = columnWidths.reduce((sum, w) => sum + w, 0);
@@ -90411,9 +90411,10 @@ self.onmessage = async function(event) {
90411
90411
  }
90412
90412
  /**
90413
90413
  * Get the print area range from the sheet's pageSetup.
90414
- * Returns null if no print area is set.
90414
+ * Returns null if no print area is set, or if `ignorePrintArea` is enabled.
90415
90415
  */
90416
- function getPrintRange(sheet) {
90416
+ function getPrintRange(sheet, options) {
90417
+ if (options.ignorePrintArea) return null;
90417
90418
  const printArea = sheet.pageSetup?.printArea;
90418
90419
  if (!printArea || typeof printArea !== "string") return null;
90419
90420
  const firstRange = printArea.split("&&")[0].trim();
@@ -91442,6 +91443,7 @@ self.onmessage = async function(event) {
91442
91443
  pageSize,
91443
91444
  orientation,
91444
91445
  margins,
91446
+ ignorePrintArea: options?.ignorePrintArea ?? false,
91445
91447
  fitToPage: options?.fitToPage !== void 0 ? options.fitToPage : true,
91446
91448
  scale: Math.max(.1, Math.min(3, options?.scale ?? ((options?.fitToPage !== void 0 ? options.fitToPage : true) ? 1 : ps?.scale ? ps.scale / 100 : 1))),
91447
91449
  showGridLines: options?.showGridLines ?? ps?.showGridLines ?? false,