@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
@@ -37,6 +37,6 @@ export { xmlEncode, xmlDecode } from "./utils/utils.base.js";
37
37
  export { DateParser, DateFormatter, getSupportedFormats, type DateFormat } from "./utils/datetime.js";
38
38
  export { BaseError, type BaseErrorOptions, toError, errorToJSON, getErrorChain, getRootCause } from "./utils/errors.js";
39
39
  export { concatUint8Arrays, toUint8Array, stringToUint8Array, uint8ArrayToString } from "./utils/binary.js";
40
- export { PdfExporter, exportPdf, PageSizes, PdfError, PdfRenderError, PdfFontError, PdfStructureError, isPdfError } from "./modules/pdf/index.js";
40
+ export { pdf, excelToPdf, PageSizes, PdfError, PdfRenderError, PdfFontError, PdfStructureError, isPdfError } from "./modules/pdf/index.js";
41
41
  export type { PdfExportOptions, PdfPageSize, PdfOrientation, PdfMargins, PageSizeName, PdfColor } from "./modules/pdf/index.js";
42
42
  export { ExcelError, isExcelError, ExcelFileError, ExcelDownloadError, ExcelNotSupportedError, ExcelStreamStateError, InvalidAddressError, ColumnOutOfBoundsError, RowOutOfBoundsError, MergeConflictError, InvalidValueTypeError, XmlParseError, WorksheetNameError, PivotTableError, TableError, ImageError, MaxItemsExceededError } from "./modules/excel/errors.js";
@@ -19,7 +19,7 @@ export type { PivotTable, PivotTableModel, PivotTableValue, PivotTableSource, Ca
19
19
  export type { FormCheckboxModel, FormCheckboxOptions, FormControlRange, FormControlAnchor } from "./modules/excel/form-control.js";
20
20
  export type { WorkbookReaderOptions, ParseEvent, SharedStringEvent, WorksheetReadyEvent, HyperlinksEvent } from "./modules/excel/stream/workbook-reader.js";
21
21
  export type { WorksheetReaderOptions, WorksheetEvent, RowEvent, HyperlinkEvent, WorksheetHyperlink } from "./modules/excel/stream/worksheet-reader.js";
22
- export type { WorkbookWriterOptions, WorkbookZipOptions, ZipOptions, ZlibOptions } from "./modules/excel/stream/workbook-writer.js";
22
+ export type { WorkbookWriterOptions, WorkbookZipOptions, ZlibOptions } from "./modules/excel/stream/workbook-writer.js";
23
23
  export type { CsvOptions, CsvInput } from "./modules/excel/workbook.js";
24
24
  export { CsvParserStream, CsvFormatterStream, createCsvParserStream, createCsvFormatterStream } from "./modules/csv/stream/index.js";
25
25
  export { DefinedNames, type DefinedNameModel } from "./modules/excel/defined-names.js";
@@ -37,6 +37,6 @@ export { xmlEncode, xmlDecode } from "./utils/utils.base.js";
37
37
  export { DateParser, DateFormatter, getSupportedFormats, type DateFormat } from "./utils/datetime.js";
38
38
  export { BaseError, type BaseErrorOptions, toError, errorToJSON, getErrorChain, getRootCause } from "./utils/errors.js";
39
39
  export { concatUint8Arrays, toUint8Array, stringToUint8Array, uint8ArrayToString } from "./utils/binary.js";
40
- export { PdfExporter, exportPdf, PageSizes, PdfError, PdfRenderError, PdfFontError, PdfStructureError, isPdfError } from "./modules/pdf/index.js";
40
+ export { pdf, excelToPdf, PageSizes, PdfError, PdfRenderError, PdfFontError, PdfStructureError, isPdfError } from "./modules/pdf/index.js";
41
41
  export type { PdfExportOptions, PdfPageSize, PdfOrientation, PdfMargins, PageSizeName, PdfColor } from "./modules/pdf/index.js";
42
42
  export { ExcelError, isExcelError, ExcelFileError, ExcelDownloadError, ExcelNotSupportedError, ExcelStreamStateError, InvalidAddressError, ColumnOutOfBoundsError, RowOutOfBoundsError, MergeConflictError, InvalidValueTypeError, XmlParseError, WorksheetNameError, PivotTableError, TableError, ImageError, MaxItemsExceededError } from "./modules/excel/errors.js";
@@ -42,8 +42,6 @@ export interface WorkbookZipOptions {
42
42
  level?: number;
43
43
  };
44
44
  }
45
- /** @deprecated Use {@link WorkbookZipOptions} instead */
46
- export type ZipOptions = WorkbookZipOptions;
47
45
  export interface WorkbookWriterOptions {
48
46
  created?: Date;
49
47
  modified?: Date;
@@ -4,8 +4,8 @@
4
4
  * Extends base with file path support and file system image loading.
5
5
  */
6
6
  import { WorksheetWriter } from "./worksheet-writer.js";
7
- import { WorkbookWriterBase, type WorkbookWriterOptions as BaseOptions, type WorkbookZipOptions, type ZipOptions, type ZlibOptions } from "./workbook-writer.browser.js";
8
- export type { WorkbookZipOptions, ZipOptions, ZlibOptions };
7
+ import { WorkbookWriterBase, type WorkbookWriterOptions as BaseOptions, type WorkbookZipOptions, type ZlibOptions } from "./workbook-writer.browser.js";
8
+ export type { WorkbookZipOptions, ZlibOptions };
9
9
  export interface WorkbookWriterOptions extends BaseOptions {
10
10
  /** If stream not specified, this field specifies the path to a file to write the XLSX workbook to */
11
11
  filename?: string;
@@ -326,8 +326,6 @@ export interface ImageData {
326
326
  filename?: string;
327
327
  buffer?: Buffer;
328
328
  }
329
- /** @deprecated Use {@link ImageData} instead */
330
- export type Image = ImageData;
331
329
  export interface ImagePosition {
332
330
  tl: {
333
331
  col: number;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Excel-to-PDF Bridge
3
+ *
4
+ * Converts Excel Workbook data into the PDF module's independent data model.
5
+ * This is the ONLY file in the PDF module that imports from @excel.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { Workbook } from "excelts";
10
+ * import { excelToPdf } from "excelts/pdf";
11
+ *
12
+ * const workbook = new Workbook();
13
+ * // ... build workbook ...
14
+ * const pdf = excelToPdf(workbook);
15
+ * ```
16
+ */
17
+ import type { Workbook } from "../excel/workbook.js";
18
+ import { type PdfExportOptions } from "./types.js";
19
+ /**
20
+ * Export an Excel Workbook directly to PDF.
21
+ *
22
+ * This is a convenience function that converts the Workbook to the PDF module's
23
+ * data model and then generates the PDF.
24
+ *
25
+ * @param workbook - An Excel Workbook instance
26
+ * @param options - PDF export options
27
+ * @returns PDF file as a Uint8Array
28
+ */
29
+ export declare function excelToPdf(workbook: Workbook, options?: PdfExportOptions): Uint8Array;
@@ -1,39 +1,37 @@
1
1
  /**
2
2
  * PDF module for excelts.
3
3
  *
4
- * Provides Excel-to-PDF conversion with zero external dependencies.
5
- * Supports cell values, fonts, colors, borders, fills, alignment,
6
- * merged cells, pagination, and customizable page layout.
4
+ * A full-featured, zero-dependency PDF engine.
7
5
  *
8
- * @example
6
+ * @example Standalone:
9
7
  * ```typescript
10
- * import { Workbook, PdfExporter } from "excelts";
8
+ * import { pdf } from "excelts/pdf";
11
9
  *
12
- * const workbook = new Workbook();
13
- * const sheet = workbook.addWorksheet("Sales");
14
- * sheet.columns = [
15
- * { header: "Product", key: "product", width: 20 },
16
- * { header: "Revenue", key: "revenue", width: 15 }
17
- * ];
18
- * sheet.addRow({ product: "Widget", revenue: 1000 });
10
+ * const bytes = pdf([
11
+ * ["Product", "Revenue"],
12
+ * ["Widget", 1000],
13
+ * ["Gadget", 2500]
14
+ * ]);
15
+ * ```
19
16
  *
20
- * const exporter = new PdfExporter(workbook);
21
- * const pdfBuffer = exporter.export({
22
- * pageSize: "A4",
23
- * orientation: "portrait",
24
- * fitToPage: true,
25
- * showGridLines: true,
26
- * showPageNumbers: true
27
- * });
17
+ * @example From Excel Workbook:
18
+ * ```typescript
19
+ * import { Workbook } from "excelts";
20
+ * import { excelToPdf } from "excelts/pdf";
28
21
  *
29
- * // Write to file (Node.js)
30
- * import { writeFileSync } from "fs";
31
- * writeFileSync("output.pdf", pdfBuffer);
22
+ * const workbook = new Workbook();
23
+ * const sheet = workbook.addWorksheet("Sales");
24
+ * sheet.addRow(["Product", "Revenue"]);
25
+ * const bytes = excelToPdf(workbook);
32
26
  * ```
33
27
  *
34
28
  * @module pdf
35
29
  */
36
- export { PdfExporter, exportPdf } from "./render/pdf-exporter.js";
30
+ /** Standalone PDF generation — accepts plain arrays, sheet objects, or workbooks. */
31
+ export { pdf } from "./pdf.js";
32
+ /** Excel-to-PDF conversion — accepts an Excel Workbook instance. */
33
+ export { excelToPdf } from "./excel-bridge.js";
34
+ export type { PdfCell, PdfRow, PdfColumn, PdfSheet, PdfBook, PdfImage } from "./pdf.js";
37
35
  export type { PdfExportOptions, PdfOrientation, PdfPageSize, PdfMargins, PdfColor, PageSizeName } from "./types.js";
38
36
  export { PageSizes } from "./types.js";
39
37
  export { PdfError, PdfRenderError, PdfFontError, PdfStructureError, isPdfError } from "./errors.js";
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Simplified PDF generation API.
3
+ *
4
+ * Provides a concise way to create PDFs from plain data — no need to manually
5
+ * construct Map objects, compute bounds, or specify cell types.
6
+ *
7
+ * @example Simplest — pass a 2D array:
8
+ * ```typescript
9
+ * import { pdf } from "@cj-tech-master/excelts/pdf";
10
+ *
11
+ * const bytes = pdf([
12
+ * ["Product", "Revenue"],
13
+ * ["Widget", 1000],
14
+ * ["Gadget", 2500]
15
+ * ]);
16
+ * ```
17
+ *
18
+ * @example With options:
19
+ * ```typescript
20
+ * const bytes = pdf([
21
+ * ["Name", "Score"],
22
+ * ["Alice", 95],
23
+ * ["Bob", 87]
24
+ * ], { showGridLines: true, title: "Scores" });
25
+ * ```
26
+ *
27
+ * @example Multiple sheets:
28
+ * ```typescript
29
+ * const bytes = pdf({
30
+ * sheets: [
31
+ * { name: "Sales", data: [["Product", "Revenue"], ["Widget", 1000]] },
32
+ * { name: "Costs", data: [["Item", "Amount"], ["Rent", 500]] }
33
+ * ]
34
+ * });
35
+ * ```
36
+ *
37
+ * @example With column widths and styles:
38
+ * ```typescript
39
+ * const bytes = pdf({
40
+ * name: "Report",
41
+ * columns: [{ width: 25 }, { width: 15 }],
42
+ * data: [
43
+ * ["Product", "Revenue"],
44
+ * ["Widget", "$1,000"]
45
+ * ]
46
+ * });
47
+ * ```
48
+ */
49
+ import { type PdfExportOptions } from "./types.js";
50
+ /** A cell value: string, number, boolean, Date, null, or a styled cell object. */
51
+ export type PdfCellValue = string | number | boolean | Date | null | undefined | PdfCell;
52
+ /** A cell with an explicit value and optional style overrides. */
53
+ export interface PdfCell {
54
+ value: string | number | boolean | Date | null | undefined;
55
+ bold?: boolean;
56
+ italic?: boolean;
57
+ fontSize?: number;
58
+ fontColor?: string;
59
+ fillColor?: string;
60
+ align?: "left" | "center" | "right";
61
+ }
62
+ /** A row is an array of cell values. */
63
+ export type PdfRow = PdfCellValue[];
64
+ /** Column configuration. */
65
+ export interface PdfColumn {
66
+ width?: number;
67
+ header?: string;
68
+ }
69
+ /** An image to embed in a sheet. */
70
+ export interface PdfImage {
71
+ /** Raw image bytes (JPEG or PNG). */
72
+ data: Uint8Array;
73
+ /** Image format. */
74
+ format: "jpeg" | "png";
75
+ /**
76
+ * Top-left column position (0-indexed).
77
+ * This is relative to the final sheet grid — if column headers are used,
78
+ * they occupy the first row, so data starts at row 1.
79
+ */
80
+ col: number;
81
+ /**
82
+ * Top-left row position (0-indexed).
83
+ * This is relative to the final sheet grid — if column headers are used,
84
+ * row 0 is the header row, and data rows start at row 1.
85
+ */
86
+ row: number;
87
+ /** Image width in pixels. */
88
+ width: number;
89
+ /** Image height in pixels. */
90
+ height: number;
91
+ }
92
+ /** A single sheet definition. */
93
+ export interface PdfSheet {
94
+ name?: string;
95
+ columns?: (PdfColumn | number)[];
96
+ data: PdfRow[];
97
+ images?: PdfImage[];
98
+ }
99
+ /** A multi-sheet document definition. */
100
+ export interface PdfBook {
101
+ title?: string;
102
+ author?: string;
103
+ sheets: PdfSheet[];
104
+ }
105
+ /**
106
+ * The input to {@link pdf} — can be:
107
+ * - A 2D array (single sheet)
108
+ * - A sheet object `{ name?, columns?, data, images? }`
109
+ * - A workbook object `{ sheets: [...] }`
110
+ */
111
+ export type PdfInput = PdfRow[] | PdfSheet | PdfBook;
112
+ /**
113
+ * Generate a PDF.
114
+ *
115
+ * Accepts anything from a plain 2D array to a multi-sheet workbook.
116
+ *
117
+ * @param input - 2D array, sheet object, or workbook object
118
+ * @param options - PDF export options (page size, margins, etc.)
119
+ * @returns PDF file as Uint8Array
120
+ */
121
+ export declare function pdf(input: PdfInput, options?: PdfExportOptions): Uint8Array;
@@ -1,23 +1,25 @@
1
1
  /**
2
- * Layout engine for Excel-to-PDF conversion.
2
+ * Layout engine for PDF generation.
3
3
  *
4
- * Takes a worksheet and produces LayoutPage objects that describe exactly
4
+ * Takes a PdfSheetData and produces LayoutPage objects that describe exactly
5
5
  * where each cell, border, and piece of text should be drawn on each PDF page.
6
6
  *
7
+ * This module is fully independent of the Excel module — it works with
8
+ * the PDF module's own data model (PdfSheetData, PdfCellData, etc.).
9
+ *
7
10
  * Key responsibilities:
8
- * - Convert Excel column widths (character units) to PDF points
9
- * - Convert Excel row heights (points already, but may need scaling)
11
+ * - Convert column widths (character units) to PDF points
12
+ * - Convert row heights (points already, but may need scaling)
10
13
  * - Handle merged cells spanning multiple rows/columns
11
14
  * - Paginate content across multiple pages
12
15
  * - Handle fitToPage scaling
13
16
  * - Handle repeated header rows
14
17
  * - Skip hidden rows and columns
15
18
  */
16
- import type { Worksheet } from "../../excel/worksheet.js";
17
- import type { ResolvedPdfOptions, LayoutPage } from "../types.js";
19
+ import type { PdfSheetData, ResolvedPdfOptions, LayoutPage } from "../types.js";
18
20
  import type { FontManager } from "../font/font-manager.js";
19
21
  /**
20
- * Compute the layout for a worksheet across one or more PDF pages.
22
+ * Compute the layout for a sheet across one or more PDF pages.
21
23
  */
22
- export declare function layoutWorksheet(worksheet: Worksheet, options: ResolvedPdfOptions, fontManager: FontManager): LayoutPage[];
24
+ export declare function layoutSheet(sheet: PdfSheetData, options: ResolvedPdfOptions, fontManager: FontManager): LayoutPage[];
23
25
  export declare function paginateRows(rowHeights: number[], availableHeight: number, repeatRowCount: number, rowBreaks: Set<number>): number[][];
@@ -1,72 +1,19 @@
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
- * ```
17
- */
18
- import type { Worksheet } from "../../excel/worksheet.js";
19
- import type { WorksheetState } from "../../excel/types.js";
20
- import { type PdfExportOptions } from "../types.js";
21
- /**
22
- * Minimal interface for a workbook to avoid tight coupling.
23
- * The actual Workbook class satisfies this interface.
24
- */
25
- interface WorkbookLike {
26
- worksheets: WorksheetLike[];
27
- title: string;
28
- creator?: string;
29
- subject: string;
30
- }
31
- /**
32
- * Minimal interface for a worksheet within the WorkbookLike.
7
+ * This module is fully independent of the Excel module.
8
+ * It is used internally by the public `pdf()` and `excelToPdf()` APIs.
33
9
  */
34
- type WorksheetLike = Worksheet & {
35
- state: WorksheetState;
36
- };
10
+ import { type PdfWorkbook, type PdfExportOptions } from "../types.js";
37
11
  /**
38
- * Export a workbook to PDF format.
12
+ * Export a PdfWorkbook to PDF format.
39
13
  *
40
- * @param workbook - The workbook to export
14
+ * @param workbook - The workbook data to export
41
15
  * @param options - Export options controlling layout, pagination, and appearance
42
16
  * @returns PDF file as a Uint8Array
43
- * @throws {PdfError} If the workbook has no worksheets or export fails
44
- *
45
- * @example
46
- * ```typescript
47
- * const pdf = exportPdf(workbook, { fitToPage: true, showGridLines: true });
48
- * ```
49
- */
50
- export declare function exportPdf(workbook: WorkbookLike, options?: PdfExportOptions): Uint8Array;
51
- /**
52
- * Class-based API for PDF export (wraps {@link exportPdf}).
53
- *
54
- * @example
55
- * ```typescript
56
- * const exporter = new PdfExporter(workbook);
57
- * const pdfBuffer = exporter.export({ fitToPage: true });
58
- * ```
17
+ * @throws {PdfError} If the workbook has no sheets or export fails
59
18
  */
60
- export declare class PdfExporter {
61
- private workbook;
62
- constructor(workbook: WorkbookLike);
63
- /**
64
- * Export the workbook as a PDF document.
65
- *
66
- * @param options - Export options controlling layout, pagination, and appearance
67
- * @returns PDF file as a Uint8Array
68
- * @throws {PdfError} If the workbook has no worksheets or export fails
69
- */
70
- export(options?: PdfExportOptions): Uint8Array;
71
- }
72
- export {};
19
+ export declare function exportPdf(workbook: PdfWorkbook, options?: PdfExportOptions): Uint8Array;
@@ -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";