@niicojs/excel 0.2.0 → 0.2.2
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.
- package/dist/index.cjs +39 -10
- package/dist/index.d.cts +27 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -10
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types.ts +13 -0
- package/src/workbook.ts +39 -11
package/dist/index.d.ts
CHANGED
|
@@ -156,6 +156,18 @@ interface ColumnConfig<T = Record<string, unknown>> {
|
|
|
156
156
|
/** Cell style for data cells in this column */
|
|
157
157
|
style?: CellStyle;
|
|
158
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Rich cell value with optional formula and style.
|
|
161
|
+
* Use this when you need to set value, formula, or style for individual cells.
|
|
162
|
+
*/
|
|
163
|
+
interface RichCellValue {
|
|
164
|
+
/** Cell value */
|
|
165
|
+
value?: CellValue;
|
|
166
|
+
/** Formula (without leading '=') */
|
|
167
|
+
formula?: string;
|
|
168
|
+
/** Cell style */
|
|
169
|
+
style?: CellStyle;
|
|
170
|
+
}
|
|
159
171
|
|
|
160
172
|
/**
|
|
161
173
|
* Represents a single cell in a worksheet
|
|
@@ -723,9 +735,23 @@ declare class Workbook {
|
|
|
723
735
|
* { key: 'age', header: 'Age (years)' },
|
|
724
736
|
* ],
|
|
725
737
|
* });
|
|
738
|
+
*
|
|
739
|
+
* // With rich cell values (value, formula, style)
|
|
740
|
+
* const dataWithFormulas = [
|
|
741
|
+
* { product: 'Widget', price: 10, qty: 5, total: { formula: 'B2*C2', style: { bold: true } } },
|
|
742
|
+
* { product: 'Gadget', price: 20, qty: 3, total: { formula: 'B3*C3', style: { bold: true } } },
|
|
743
|
+
* ];
|
|
744
|
+
* const sheet3 = wb.addSheetFromData({
|
|
745
|
+
* name: 'With Formulas',
|
|
746
|
+
* data: dataWithFormulas,
|
|
747
|
+
* });
|
|
726
748
|
* ```
|
|
727
749
|
*/
|
|
728
750
|
addSheetFromData<T extends object>(config: SheetFromDataConfig<T>): Worksheet;
|
|
751
|
+
/**
|
|
752
|
+
* Check if a value is a rich cell value object with value, formula, or style fields
|
|
753
|
+
*/
|
|
754
|
+
private _isRichCellValue;
|
|
729
755
|
/**
|
|
730
756
|
* Infer column configuration from the first data object
|
|
731
757
|
*/
|
|
@@ -810,5 +836,5 @@ declare const parseRange: (range: string) => RangeAddress;
|
|
|
810
836
|
declare const toRange: (range: RangeAddress) => string;
|
|
811
837
|
|
|
812
838
|
export { Cell, PivotCache, PivotTable, Range, SharedStrings, Styles, Workbook, Worksheet, parseAddress, parseRange, toAddress, toRange };
|
|
813
|
-
export type { AggregationType, Alignment, BorderStyle, BorderType, CellAddress, CellError, CellStyle, CellType, CellValue, ColumnConfig, ErrorType, PivotFieldAxis, PivotTableConfig, PivotValueConfig, RangeAddress, SheetFromDataConfig };
|
|
839
|
+
export type { AggregationType, Alignment, BorderStyle, BorderType, CellAddress, CellError, CellStyle, CellType, CellValue, ColumnConfig, ErrorType, PivotFieldAxis, PivotTableConfig, PivotValueConfig, RangeAddress, RichCellValue, SheetFromDataConfig };
|
|
814
840
|
//# sourceMappingURL=index.d.ts.map
|