sheetra 1.0.2 → 1.0.3

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.
@@ -9,6 +9,32 @@ export declare class ExportBuilder {
9
9
  addSection(config: SectionConfig): this;
10
10
  addSections(sections: SectionConfig[]): this;
11
11
  setColumnWidths(widths: number[]): this;
12
+ /**
13
+ * Merge cells in the current worksheet
14
+ * @param startRow Start row index (0-based)
15
+ * @param startCol Start column index (0-based)
16
+ * @param endRow End row index (0-based)
17
+ * @param endCol End column index (0-based)
18
+ */
19
+ mergeCells(startRow: number, startCol: number, endRow: number, endCol: number): this;
20
+ /**
21
+ * Set alignment for a specific cell
22
+ * @param row Row index (0-based)
23
+ * @param col Column index (0-based)
24
+ * @param horizontal Horizontal alignment
25
+ * @param vertical Vertical alignment (optional)
26
+ */
27
+ setAlignment(row: number, col: number, horizontal: 'left' | 'center' | 'right', vertical?: 'top' | 'middle' | 'bottom'): this;
28
+ /**
29
+ * Set alignment for a range of cells
30
+ * @param startRow Start row index (0-based)
31
+ * @param startCol Start column index (0-based)
32
+ * @param endRow End row index (0-based)
33
+ * @param endCol End column index (0-based)
34
+ * @param horizontal Horizontal alignment
35
+ * @param vertical Vertical alignment (optional)
36
+ */
37
+ setRangeAlignment(startRow: number, startCol: number, endRow: number, endCol: number, horizontal: 'left' | 'center' | 'right', vertical?: 'top' | 'middle' | 'bottom'): this;
12
38
  autoSizeColumns(): this;
13
39
  addStyle(style: any): this;
14
40
  private groupData;
@@ -25,6 +25,18 @@ export declare class SheetBuilder {
25
25
  * @param style Optional style for all headers
26
26
  */
27
27
  addHeaderRow(headers: string[], style?: CellStyle): this;
28
+ /**
29
+ * Set the width of a specific column
30
+ * @param colIndex Column index
31
+ * @param width Width to set
32
+ */
33
+ setColumnWidth(colIndex: number, width: number): this;
34
+ /**
35
+ * Set the height of a specific row
36
+ * @param rowIndex Row index
37
+ * @param height Height to set
38
+ */
39
+ setRowHeight(rowIndex: number, height: number): this;
28
40
  /**
29
41
  * Add a title row
30
42
  * @param title Title text
@@ -1226,6 +1226,32 @@ declare class ExportBuilder {
1226
1226
  addSection(config: SectionConfig): this;
1227
1227
  addSections(sections: SectionConfig[]): this;
1228
1228
  setColumnWidths(widths: number[]): this;
1229
+ /**
1230
+ * Merge cells in the current worksheet
1231
+ * @param startRow Start row index (0-based)
1232
+ * @param startCol Start column index (0-based)
1233
+ * @param endRow End row index (0-based)
1234
+ * @param endCol End column index (0-based)
1235
+ */
1236
+ mergeCells(startRow: number, startCol: number, endRow: number, endCol: number): this;
1237
+ /**
1238
+ * Set alignment for a specific cell
1239
+ * @param row Row index (0-based)
1240
+ * @param col Column index (0-based)
1241
+ * @param horizontal Horizontal alignment
1242
+ * @param vertical Vertical alignment (optional)
1243
+ */
1244
+ setAlignment(row: number, col: number, horizontal: 'left' | 'center' | 'right', vertical?: 'top' | 'middle' | 'bottom'): this;
1245
+ /**
1246
+ * Set alignment for a range of cells
1247
+ * @param startRow Start row index (0-based)
1248
+ * @param startCol Start column index (0-based)
1249
+ * @param endRow End row index (0-based)
1250
+ * @param endCol End column index (0-based)
1251
+ * @param horizontal Horizontal alignment
1252
+ * @param vertical Vertical alignment (optional)
1253
+ */
1254
+ setRangeAlignment(startRow: number, startCol: number, endRow: number, endCol: number, horizontal: 'left' | 'center' | 'right', vertical?: 'top' | 'middle' | 'bottom'): this;
1229
1255
  autoSizeColumns(): this;
1230
1256
  addStyle(style: any): this;
1231
1257
  private groupData;
@@ -1261,6 +1287,18 @@ declare class SheetBuilder {
1261
1287
  * @param style Optional style for all headers
1262
1288
  */
1263
1289
  addHeaderRow(headers: string[], style?: CellStyle): this;
1290
+ /**
1291
+ * Set the width of a specific column
1292
+ * @param colIndex Column index
1293
+ * @param width Width to set
1294
+ */
1295
+ setColumnWidth(colIndex: number, width: number): this;
1296
+ /**
1297
+ * Set the height of a specific row
1298
+ * @param rowIndex Row index
1299
+ * @param height Height to set
1300
+ */
1301
+ setRowHeight(rowIndex: number, height: number): this;
1264
1302
  /**
1265
1303
  * Add a title row
1266
1304
  * @param title Title text
@@ -1653,12 +1691,30 @@ declare class SectionBuilder {
1653
1691
 
1654
1692
  declare class ExcelWriter {
1655
1693
  static write(workbook: Workbook, _options: ExportOptions): Promise<Blob>;
1694
+ /**
1695
+ * Collect all unique styles from sheets
1696
+ */
1697
+ private static collectStyles;
1698
+ /**
1699
+ * Register a style and get its cellXf index
1700
+ */
1701
+ private static registerStyle;
1702
+ /**
1703
+ * Get style index for a cell style
1704
+ */
1705
+ private static getStyleIndex;
1706
+ private static serializeFont;
1707
+ private static serializeFill;
1708
+ private static serializeBorder;
1709
+ private static serializeAlignment;
1656
1710
  private static escapeXml;
1657
1711
  private static generateContentTypes;
1658
1712
  private static generateRels;
1659
1713
  private static generateWorkbook;
1660
1714
  private static generateWorkbookRels;
1661
1715
  private static generateStyles;
1716
+ private static generateBorderEdge;
1717
+ private static colorToARGB;
1662
1718
  private static generateSharedStrings;
1663
1719
  private static generateWorksheet;
1664
1720
  private static collectAllStrings;
@@ -2,12 +2,30 @@ import { Workbook } from '../core/workbook';
2
2
  import { ExportOptions } from '../types';
3
3
  export declare class ExcelWriter {
4
4
  static write(workbook: Workbook, _options: ExportOptions): Promise<Blob>;
5
+ /**
6
+ * Collect all unique styles from sheets
7
+ */
8
+ private static collectStyles;
9
+ /**
10
+ * Register a style and get its cellXf index
11
+ */
12
+ private static registerStyle;
13
+ /**
14
+ * Get style index for a cell style
15
+ */
16
+ private static getStyleIndex;
17
+ private static serializeFont;
18
+ private static serializeFill;
19
+ private static serializeBorder;
20
+ private static serializeAlignment;
5
21
  private static escapeXml;
6
22
  private static generateContentTypes;
7
23
  private static generateRels;
8
24
  private static generateWorkbook;
9
25
  private static generateWorkbookRels;
10
26
  private static generateStyles;
27
+ private static generateBorderEdge;
28
+ private static colorToARGB;
11
29
  private static generateSharedStrings;
12
30
  private static generateWorksheet;
13
31
  private static collectAllStrings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sheetra",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Powerful Excel/CSV/JSON export library with zero dependencies",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",