@cj-tech-master/excelts 6.2.0 → 7.0.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.
Files changed (56) hide show
  1. package/README.md +45 -17
  2. package/README_zh.md +43 -15
  3. package/dist/browser/index.browser.d.ts +1 -1
  4. package/dist/browser/index.browser.js +1 -1
  5. package/dist/browser/index.d.ts +2 -2
  6. package/dist/browser/index.js +1 -1
  7. package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +0 -2
  8. package/dist/browser/modules/excel/stream/workbook-writer.d.ts +2 -2
  9. package/dist/browser/modules/excel/types.d.ts +0 -2
  10. package/dist/browser/modules/pdf/excel-bridge.d.ts +29 -0
  11. package/dist/browser/modules/pdf/excel-bridge.js +423 -0
  12. package/dist/browser/modules/pdf/index.d.ts +22 -24
  13. package/dist/browser/modules/pdf/index.js +22 -25
  14. package/dist/browser/modules/pdf/pdf.d.ts +121 -0
  15. package/dist/browser/modules/pdf/pdf.js +255 -0
  16. package/dist/browser/modules/pdf/render/layout-engine.d.ts +10 -8
  17. package/dist/browser/modules/pdf/render/layout-engine.js +115 -209
  18. package/dist/browser/modules/pdf/render/pdf-exporter.d.ts +9 -62
  19. package/dist/browser/modules/pdf/render/pdf-exporter.js +38 -78
  20. package/dist/browser/modules/pdf/render/style-converter.d.ts +20 -18
  21. package/dist/browser/modules/pdf/render/style-converter.js +24 -23
  22. package/dist/browser/modules/pdf/types.d.ts +193 -11
  23. package/dist/browser/modules/pdf/types.js +22 -1
  24. package/dist/cjs/index.js +3 -3
  25. package/dist/cjs/modules/pdf/excel-bridge.js +426 -0
  26. package/dist/cjs/modules/pdf/index.js +25 -28
  27. package/dist/cjs/modules/pdf/pdf.js +258 -0
  28. package/dist/cjs/modules/pdf/render/layout-engine.js +116 -210
  29. package/dist/cjs/modules/pdf/render/pdf-exporter.js +37 -79
  30. package/dist/cjs/modules/pdf/render/style-converter.js +24 -23
  31. package/dist/cjs/modules/pdf/types.js +23 -2
  32. package/dist/esm/index.browser.js +1 -1
  33. package/dist/esm/index.js +1 -1
  34. package/dist/esm/modules/pdf/excel-bridge.js +423 -0
  35. package/dist/esm/modules/pdf/index.js +22 -25
  36. package/dist/esm/modules/pdf/pdf.js +255 -0
  37. package/dist/esm/modules/pdf/render/layout-engine.js +115 -209
  38. package/dist/esm/modules/pdf/render/pdf-exporter.js +38 -78
  39. package/dist/esm/modules/pdf/render/style-converter.js +24 -23
  40. package/dist/esm/modules/pdf/types.js +22 -1
  41. package/dist/iife/excelts.iife.js +728 -251
  42. package/dist/iife/excelts.iife.js.map +1 -1
  43. package/dist/iife/excelts.iife.min.js +34 -34
  44. package/dist/types/index.browser.d.ts +1 -1
  45. package/dist/types/index.d.ts +2 -2
  46. package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +0 -2
  47. package/dist/types/modules/excel/stream/workbook-writer.d.ts +2 -2
  48. package/dist/types/modules/excel/types.d.ts +0 -2
  49. package/dist/types/modules/pdf/excel-bridge.d.ts +29 -0
  50. package/dist/types/modules/pdf/index.d.ts +22 -24
  51. package/dist/types/modules/pdf/pdf.d.ts +121 -0
  52. package/dist/types/modules/pdf/render/layout-engine.d.ts +10 -8
  53. package/dist/types/modules/pdf/render/pdf-exporter.d.ts +9 -62
  54. package/dist/types/modules/pdf/render/style-converter.d.ts +20 -18
  55. package/dist/types/modules/pdf/types.d.ts +193 -11
  56. package/package.json +1 -1
@@ -1,26 +1,18 @@
1
1
  /**
2
- * PDF Exporter - Main orchestrator for Excel-to-PDF conversion.
2
+ * PDF Exporter - Main orchestrator for PDF document generation.
3
3
  *
4
4
  * Coordinates the layout engine, page renderer, font manager, and PDF writer
5
- * to produce a complete PDF document from an Excel workbook.
5
+ * to produce a complete PDF document from a PdfWorkbook data structure.
6
6
  *
7
- * @example
8
- * ```typescript
9
- * import { Workbook, PdfExporter } from "excelts";
10
- *
11
- * const workbook = new Workbook();
12
- * // ... populate workbook ...
13
- *
14
- * const exporter = new PdfExporter(workbook);
15
- * const pdfBuffer = exporter.export({ fitToPage: true });
16
- * ```
7
+ * This module is fully independent of the Excel module.
8
+ * It is used internally by the public `pdf()` and `excelToPdf()` APIs.
17
9
  */
18
10
  import { PdfWriter } from "../core/pdf-writer.js";
19
11
  import { PdfDict, pdfRef, pdfNumber, pdfString as pdfStr } from "../core/pdf-object.js";
20
12
  import { FontManager, resolvePdfFontName } from "../font/font-manager.js";
21
13
  import { parseTtf } from "../font/ttf-parser.js";
22
14
  import { initEncryption } from "../core/encryption.js";
23
- import { layoutWorksheet } from "./layout-engine.js";
15
+ import { layoutSheet } from "./layout-engine.js";
24
16
  import { renderPage, alphaGsName } from "./page-renderer.js";
25
17
  import { decodePng } from "./png-decoder.js";
26
18
  import { PdfError, PdfRenderError } from "../errors.js";
@@ -30,22 +22,17 @@ import { argbToPdfColor } from "./style-converter.js";
30
22
  // Public API
31
23
  // =============================================================================
32
24
  /**
33
- * Export a workbook to PDF format.
25
+ * Export a PdfWorkbook to PDF format.
34
26
  *
35
- * @param workbook - The workbook to export
27
+ * @param workbook - The workbook data to export
36
28
  * @param options - Export options controlling layout, pagination, and appearance
37
29
  * @returns PDF file as a Uint8Array
38
- * @throws {PdfError} If the workbook has no worksheets or export fails
39
- *
40
- * @example
41
- * ```typescript
42
- * const pdf = exportPdf(workbook, { fitToPage: true, showGridLines: true });
43
- * ```
30
+ * @throws {PdfError} If the workbook has no sheets or export fails
44
31
  */
45
32
  export function exportPdf(workbook, options) {
46
- const worksheets = selectWorksheets(workbook, options?.sheets);
47
- if (worksheets.length === 0) {
48
- throw new PdfError("No worksheets to export. The workbook is empty or no sheets matched.");
33
+ const sheets = selectSheets(workbook, options?.sheets);
34
+ if (sheets.length === 0) {
35
+ throw new PdfError("No sheets to export. The workbook is empty or no sheets matched.");
49
36
  }
50
37
  const fontManager = new FontManager();
51
38
  const writer = new PdfWriter();
@@ -59,19 +46,19 @@ export function exportPdf(workbook, options) {
59
46
  throw new PdfRenderError("Failed to parse TrueType font", { cause: err });
60
47
  }
61
48
  }
62
- // --- Step 1: Layout all worksheets ---
49
+ // --- Step 1: Layout all sheets ---
63
50
  const allPages = [];
64
- for (const worksheet of worksheets) {
51
+ for (const sheet of sheets) {
65
52
  try {
66
- const resolved = resolveOptions(options, worksheet);
67
- const pages = layoutWorksheet(worksheet, resolved, fontManager);
53
+ const resolved = resolveOptions(options, sheet);
54
+ const pages = layoutSheet(sheet, resolved, fontManager);
68
55
  allPages.push(...pages);
69
56
  }
70
57
  catch (err) {
71
- throw new PdfRenderError(`Failed to layout worksheet "${worksheet.name}"`, { cause: err });
58
+ throw new PdfRenderError(`Failed to layout sheet "${sheet.name}"`, { cause: err });
72
59
  }
73
60
  }
74
- const documentOptions = resolveOptions(options, worksheets[0]);
61
+ const documentOptions = resolveOptions(options, sheets[0]);
75
62
  if (allPages.length === 0) {
76
63
  // Create at least one empty page
77
64
  allPages.push({
@@ -80,17 +67,17 @@ export function exportPdf(workbook, options) {
80
67
  cells: [],
81
68
  width: documentOptions.pageSize.width,
82
69
  height: documentOptions.pageSize.height,
83
- sheetName: worksheets[0]?.name ?? "Sheet1",
84
- worksheetCols: [],
70
+ sheetName: sheets[0]?.name ?? "Sheet1",
71
+ sheetCols: [],
85
72
  columnOffsets: [],
86
73
  columnWidths: [],
87
- worksheetRows: [],
74
+ sheetRows: [],
88
75
  rowYPositions: [],
89
76
  rowHeights: [],
90
77
  images: []
91
78
  });
92
79
  }
93
- // Fix page numbers (they may be off after combining multiple worksheets)
80
+ // Fix page numbers (they may be off after combining multiple sheets)
94
81
  for (let i = 0; i < allPages.length; i++) {
95
82
  allPages[i].pageNumber = i + 1;
96
83
  }
@@ -222,7 +209,7 @@ export function exportPdf(workbook, options) {
222
209
  }
223
210
  // --- Step 6: Build catalog ---
224
211
  writer.addCatalog(pagesTreeObjNum, outlinesRef);
225
- // --- Step 6: Add document info ---
212
+ // --- Step 7: Add document info ---
226
213
  writer.addInfoDict({
227
214
  title: documentOptions.title || workbook.title || undefined,
228
215
  author: documentOptions.author || workbook.creator || undefined,
@@ -237,40 +224,16 @@ export function exportPdf(workbook, options) {
237
224
  // --- Step 9: Build the PDF ---
238
225
  return writer.build();
239
226
  }
240
- /**
241
- * Class-based API for PDF export (wraps {@link exportPdf}).
242
- *
243
- * @example
244
- * ```typescript
245
- * const exporter = new PdfExporter(workbook);
246
- * const pdfBuffer = exporter.export({ fitToPage: true });
247
- * ```
248
- */
249
- export class PdfExporter {
250
- constructor(workbook) {
251
- this.workbook = workbook;
252
- }
253
- /**
254
- * Export the workbook as a PDF document.
255
- *
256
- * @param options - Export options controlling layout, pagination, and appearance
257
- * @returns PDF file as a Uint8Array
258
- * @throws {PdfError} If the workbook has no worksheets or export fails
259
- */
260
- export(options) {
261
- return exportPdf(this.workbook, options);
262
- }
263
- }
264
227
  // =============================================================================
265
- // Worksheet Selection
228
+ // Sheet Selection
266
229
  // =============================================================================
267
230
  /**
268
- * Select which worksheets to export based on the options.
231
+ * Select which sheets to export based on the options.
269
232
  */
270
- function selectWorksheets(workbook, sheets) {
271
- const allSheets = workbook.worksheets;
233
+ function selectSheets(workbook, sheets) {
234
+ const allSheets = workbook.sheets;
272
235
  if (!sheets || sheets.length === 0) {
273
- // Export all visible worksheets
236
+ // Export all visible sheets
274
237
  return allSheets.filter(ws => ws.state !== "hidden" && ws.state !== "veryHidden");
275
238
  }
276
239
  const result = [];
@@ -282,7 +245,7 @@ function selectWorksheets(workbook, sheets) {
282
245
  }
283
246
  }
284
247
  else if (typeof selector === "number") {
285
- // 1-based position in the worksheets array
248
+ // 1-based position in the sheets array
286
249
  const ws = allSheets[selector - 1];
287
250
  if (ws) {
288
251
  result.push(ws);
@@ -297,9 +260,9 @@ function selectWorksheets(workbook, sheets) {
297
260
  /**
298
261
  * Resolve user options with defaults.
299
262
  */
300
- function resolveOptions(options, worksheet) {
301
- // Use worksheet's pageSetup as fallback for unspecified options
302
- const ps = worksheet?.pageSetup;
263
+ function resolveOptions(options, sheet) {
264
+ // Use sheet's pageSetup as fallback for unspecified options
265
+ const ps = sheet?.pageSetup;
303
266
  const pageSize = resolvePageSize(options?.pageSize, ps?.paperSize);
304
267
  const orientation = options?.orientation ?? (ps?.orientation === "landscape" ? "landscape" : "portrait");
305
268
  const margins = resolveMargins(options?.margins, ps?.margins);
@@ -309,7 +272,7 @@ function resolveOptions(options, worksheet) {
309
272
  g: 0.816,
310
273
  b: 0.816
311
274
  };
312
- // Use worksheet's printTitlesRow as fallback for repeatRows
275
+ // Use sheet's printTitlesRow as fallback for repeatRows
313
276
  let repeatRows = options?.repeatRows ?? false;
314
277
  if (repeatRows === false && ps?.printTitlesRow) {
315
278
  // printTitlesRow format: "1:3" (repeat rows 1-3) or "1" (repeat row 1)
@@ -337,10 +300,7 @@ function resolveOptions(options, worksheet) {
337
300
  creator: options?.creator ?? "excelts"
338
301
  };
339
302
  }
340
- /**
341
- * Resolve the page size from options.
342
- */
343
- /** Map Excel PaperSize enum values to PDF page sizes. */
303
+ /** Map PaperSize enum values to PDF page sizes. */
344
304
  const PAPER_SIZE_MAP = {
345
305
  1: PageSizes.LETTER,
346
306
  5: PageSizes.LEGAL,
@@ -356,19 +316,19 @@ function resolvePageSize(size, paperSize) {
356
316
  }
357
317
  return size;
358
318
  }
359
- // Fallback to worksheet paperSize
319
+ // Fallback to sheet paperSize
360
320
  if (paperSize !== undefined) {
361
321
  return PAPER_SIZE_MAP[paperSize] ?? PageSizes.A4;
362
322
  }
363
323
  return PageSizes.A4;
364
324
  }
365
325
  /**
366
- * Resolve margins with defaults. Worksheet margins are in inches, convert to points (×72).
367
- * When partial PDF margins are specified, unset sides fall back to worksheet margins,
326
+ * Resolve margins with defaults. Sheet margins are in inches, convert to points (×72).
327
+ * When partial PDF margins are specified, unset sides fall back to sheet margins,
368
328
  * then to the default 72pt (1 inch).
369
329
  */
370
330
  function resolveMargins(margins, wsMargins) {
371
- // Build a base from worksheet pageSetup margins (inches → points), or default 72pt
331
+ // Build a base from sheet pageSetup margins (inches → points), or default 72pt
372
332
  const base = wsMargins
373
333
  ? {
374
334
  top: wsMargins.top * 72,
@@ -392,7 +352,7 @@ function resolveMargins(margins, wsMargins) {
392
352
  // =============================================================================
393
353
  /**
394
354
  * Build a PDF outlines tree for sheet-level navigation.
395
- * Creates one bookmark entry per worksheet, pointing to the first page.
355
+ * Creates one bookmark entry per sheet, pointing to the first page.
396
356
  */
397
357
  function buildOutlines(writer, sheetFirstPage, pageObjNums) {
398
358
  const outlinesObjNum = writer.allocObject();
@@ -1,22 +1,24 @@
1
1
  /**
2
- * Converts Excel styles to PDF rendering parameters.
2
+ * Converts input styles to PDF rendering parameters.
3
3
  *
4
- * Maps Excel font, color, border, fill, and alignment properties
4
+ * Maps font, color, border, fill, and alignment properties
5
5
  * to their PDF equivalents for the layout engine and page renderer.
6
+ *
7
+ * This module is fully independent of the Excel module — it works with
8
+ * the PDF module's own style interfaces (PdfFontStyle, PdfFillData, etc.).
6
9
  */
7
- import type { PdfColor, LayoutBorders } from "../types.js";
8
- import type { Font, Color, Fill, Borders, Alignment } from "../../excel/types.js";
10
+ import type { PdfColor, LayoutBorders, PdfColorData, PdfFontStyle, PdfFillData, PdfBordersData, PdfAlignmentData } from "../types.js";
9
11
  /**
10
- * Convert an Excel ARGB color string to PDF RGB color.
11
- * Excel uses "AARRGGBB" format (e.g., "FF000000" for black).
12
+ * Convert an ARGB color string to PDF RGB color.
13
+ * Handles "AARRGGBB" (8-char) and "RRGGBB" (6-char) formats.
12
14
  * PDF uses 0-1 floats for each component.
13
15
  */
14
16
  export declare function argbToPdfColor(argb: string | undefined): PdfColor | null;
15
17
  /**
16
- * Convert an Excel Color object to PDF color.
18
+ * Convert a color data object to PDF color.
17
19
  * Handles both ARGB and theme-based colors.
18
20
  */
19
- export declare function excelColorToPdf(color: Partial<Color> | undefined): PdfColor | null;
21
+ export declare function excelColorToPdf(color: Partial<PdfColorData> | undefined): PdfColor | null;
20
22
  /**
21
23
  * Apply a tint value to a color.
22
24
  * Tint range: -1.0 (fully dark) to +1.0 (fully light).
@@ -34,9 +36,9 @@ export declare const DEFAULT_COLORS: {
34
36
  gridLine: PdfColor;
35
37
  };
36
38
  /**
37
- * Extract font properties from an Excel font for PDF rendering.
39
+ * Extract font properties for PDF rendering.
38
40
  */
39
- export declare function extractFontProperties(font: Partial<Font> | undefined, defaultFamily: string, defaultSize: number): {
41
+ export declare function extractFontProperties(font: Partial<PdfFontStyle> | undefined, defaultFamily: string, defaultSize: number): {
40
42
  fontFamily: string;
41
43
  fontSize: number;
42
44
  bold: boolean;
@@ -46,20 +48,20 @@ export declare function extractFontProperties(font: Partial<Font> | undefined, d
46
48
  textColor: PdfColor;
47
49
  };
48
50
  /**
49
- * Convert an Excel fill to a PDF background color.
51
+ * Convert a fill to a PDF background color.
50
52
  * Only pattern fills with "solid" pattern are supported as PDF backgrounds.
51
53
  * Other patterns are approximated or ignored.
52
54
  */
53
- export declare function excelFillToPdfColor(fill: Fill | undefined): PdfColor | null;
55
+ export declare function excelFillToPdfColor(fill: PdfFillData | undefined): PdfColor | null;
54
56
  /**
55
- * Convert Excel Borders to PDF LayoutBorders.
57
+ * Convert border data to PDF LayoutBorders.
56
58
  */
57
- export declare function excelBordersToPdf(borders: Partial<Borders> | undefined): LayoutBorders;
59
+ export declare function excelBordersToPdf(borders: Partial<PdfBordersData> | undefined): LayoutBorders;
58
60
  /**
59
- * Convert Excel horizontal alignment to PDF alignment.
61
+ * Convert horizontal alignment to PDF alignment.
60
62
  */
61
- export declare function excelHAlignToPdf(alignment: Partial<Alignment> | undefined): "left" | "center" | "right";
63
+ export declare function excelHAlignToPdf(alignment: Partial<PdfAlignmentData> | undefined): "left" | "center" | "right";
62
64
  /**
63
- * Convert Excel vertical alignment to PDF alignment.
65
+ * Convert vertical alignment to PDF alignment.
64
66
  */
65
- export declare function excelVAlignToPdf(alignment: Partial<Alignment> | undefined): "top" | "middle" | "bottom";
67
+ export declare function excelVAlignToPdf(alignment: Partial<PdfAlignmentData> | undefined): "top" | "middle" | "bottom";
@@ -1,15 +1,18 @@
1
1
  /**
2
- * Converts Excel styles to PDF rendering parameters.
2
+ * Converts input styles to PDF rendering parameters.
3
3
  *
4
- * Maps Excel font, color, border, fill, and alignment properties
4
+ * Maps font, color, border, fill, and alignment properties
5
5
  * to their PDF equivalents for the layout engine and page renderer.
6
+ *
7
+ * This module is fully independent of the Excel module — it works with
8
+ * the PDF module's own style interfaces (PdfFontStyle, PdfFillData, etc.).
6
9
  */
7
10
  // =============================================================================
8
11
  // Color Conversion
9
12
  // =============================================================================
10
13
  /**
11
- * Convert an Excel ARGB color string to PDF RGB color.
12
- * Excel uses "AARRGGBB" format (e.g., "FF000000" for black).
14
+ * Convert an ARGB color string to PDF RGB color.
15
+ * Handles "AARRGGBB" (8-char) and "RRGGBB" (6-char) formats.
13
16
  * PDF uses 0-1 floats for each component.
14
17
  */
15
18
  export function argbToPdfColor(argb) {
@@ -46,7 +49,7 @@ export function argbToPdfColor(argb) {
46
49
  };
47
50
  }
48
51
  /**
49
- * Convert an Excel Color object to PDF color.
52
+ * Convert a color data object to PDF color.
50
53
  * Handles both ARGB and theme-based colors.
51
54
  */
52
55
  export function excelColorToPdf(color) {
@@ -63,7 +66,6 @@ export function excelColorToPdf(color) {
63
66
  if (!base) {
64
67
  return null;
65
68
  }
66
- // Apply tint if present (tint field exists at runtime from XLSX layer)
67
69
  const tint = color.tint;
68
70
  if (tint !== undefined && tint !== 0) {
69
71
  return applyTint(base, tint);
@@ -73,7 +75,7 @@ export function excelColorToPdf(color) {
73
75
  return null;
74
76
  }
75
77
  /**
76
- * Map Excel theme color indices to PDF colors.
78
+ * Map theme color indices to PDF colors.
77
79
  * These are the default Office theme colors.
78
80
  */
79
81
  function themeColorToPdf(themeIndex) {
@@ -127,7 +129,7 @@ export const DEFAULT_COLORS = {
127
129
  // Font Conversion
128
130
  // =============================================================================
129
131
  /**
130
- * Extract font properties from an Excel font for PDF rendering.
132
+ * Extract font properties for PDF rendering.
131
133
  */
132
134
  export function extractFontProperties(font, defaultFamily, defaultSize) {
133
135
  const fontFamily = font?.name ?? defaultFamily;
@@ -143,7 +145,7 @@ export function extractFontProperties(font, defaultFamily, defaultSize) {
143
145
  // Fill Conversion
144
146
  // =============================================================================
145
147
  /**
146
- * Convert an Excel fill to a PDF background color.
148
+ * Convert a fill to a PDF background color.
147
149
  * Only pattern fills with "solid" pattern are supported as PDF backgrounds.
148
150
  * Other patterns are approximated or ignored.
149
151
  */
@@ -152,21 +154,20 @@ export function excelFillToPdfColor(fill) {
152
154
  return null;
153
155
  }
154
156
  if (fill.type === "pattern") {
155
- const patternFill = fill;
156
- if (patternFill.pattern === "solid" && patternFill.fgColor) {
157
- return excelColorToPdf(patternFill.fgColor);
157
+ if (fill.pattern === "solid" && fill.fgColor) {
158
+ return excelColorToPdf(fill.fgColor);
158
159
  }
159
- if (patternFill.pattern === "none") {
160
+ if (fill.pattern === "none") {
160
161
  return null;
161
162
  }
162
163
  // For other patterns, use fgColor as approximation
163
- if (patternFill.fgColor) {
164
- return excelColorToPdf(patternFill.fgColor);
164
+ if (fill.fgColor) {
165
+ return excelColorToPdf(fill.fgColor);
165
166
  }
166
167
  }
167
168
  if (fill.type === "gradient") {
168
169
  // For gradient fills, use the first stop color as approximation
169
- if ("stops" in fill && fill.stops.length > 0) {
170
+ if (fill.stops && fill.stops.length > 0) {
170
171
  return excelColorToPdf(fill.stops[0].color);
171
172
  }
172
173
  }
@@ -176,7 +177,7 @@ export function excelFillToPdfColor(fill) {
176
177
  // Border Conversion
177
178
  // =============================================================================
178
179
  /**
179
- * Map Excel border styles to PDF line widths and dash patterns.
180
+ * Map border styles to PDF line widths.
180
181
  */
181
182
  function borderStyleToLineWidth(style) {
182
183
  switch (style) {
@@ -211,7 +212,7 @@ function borderStyleToLineWidth(style) {
211
212
  }
212
213
  }
213
214
  /**
214
- * Map Excel border styles to PDF dash patterns.
215
+ * Map border styles to PDF dash patterns.
215
216
  * An empty array means a solid line.
216
217
  */
217
218
  function borderStyleToDashPattern(style) {
@@ -236,7 +237,7 @@ function borderStyleToDashPattern(style) {
236
237
  }
237
238
  }
238
239
  /**
239
- * Convert a single Excel border to a PDF LayoutBorder.
240
+ * Convert a single border side to a PDF LayoutBorder.
240
241
  */
241
242
  function convertBorder(border) {
242
243
  if (!border || !border.style) {
@@ -249,7 +250,7 @@ function convertBorder(border) {
249
250
  };
250
251
  }
251
252
  /**
252
- * Convert Excel Borders to PDF LayoutBorders.
253
+ * Convert border data to PDF LayoutBorders.
253
254
  */
254
255
  export function excelBordersToPdf(borders) {
255
256
  if (!borders) {
@@ -266,7 +267,7 @@ export function excelBordersToPdf(borders) {
266
267
  // Alignment Conversion
267
268
  // =============================================================================
268
269
  /**
269
- * Convert Excel horizontal alignment to PDF alignment.
270
+ * Convert horizontal alignment to PDF alignment.
270
271
  */
271
272
  export function excelHAlignToPdf(alignment) {
272
273
  if (!alignment?.horizontal) {
@@ -287,11 +288,11 @@ export function excelHAlignToPdf(alignment) {
287
288
  }
288
289
  }
289
290
  /**
290
- * Convert Excel vertical alignment to PDF alignment.
291
+ * Convert vertical alignment to PDF alignment.
291
292
  */
292
293
  export function excelVAlignToPdf(alignment) {
293
294
  if (!alignment?.vertical) {
294
- return "bottom"; // Excel default is bottom
295
+ return "bottom"; // Default is bottom
295
296
  }
296
297
  switch (alignment.vertical) {
297
298
  case "top":