gemcap-be-common 1.4.242 → 1.4.243
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.
|
@@ -74,6 +74,9 @@ export declare const convertDataToFileWithStyle: (dataToConvert: {
|
|
|
74
74
|
showGridLines?: boolean;
|
|
75
75
|
};
|
|
76
76
|
};
|
|
77
|
+
conditionalFormatting?: {
|
|
78
|
+
[sheetName: string]: ExcelJS.ConditionalFormattingOptions[];
|
|
79
|
+
};
|
|
77
80
|
}) => Promise<Buffer>;
|
|
78
81
|
export declare const addHeaderToData: (header: {
|
|
79
82
|
[key: string]: string;
|
package/helpers/excel.helper.js
CHANGED
|
@@ -221,6 +221,12 @@ const convertDataToFileWithStyle = async (dataToConvert, options) => {
|
|
|
221
221
|
sheet.columns = Array.from(colLetters).map((colId) => ({
|
|
222
222
|
width: options?.width?.[sheetName]?.[colId] ?? defaultColumnWidth,
|
|
223
223
|
}));
|
|
224
|
+
const formatting = options?.conditionalFormatting?.[sheetName];
|
|
225
|
+
if (formatting) {
|
|
226
|
+
formatting.forEach((rule) => {
|
|
227
|
+
sheet.addConditionalFormatting(rule);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
224
230
|
}
|
|
225
231
|
const buffer = await workbook.xlsx.writeBuffer();
|
|
226
232
|
return Buffer.from(buffer);
|
package/helpers/excel.helper.ts
CHANGED
|
@@ -173,6 +173,9 @@ export const convertDataToFileWithStyle = async (
|
|
|
173
173
|
showGridLines?: boolean;
|
|
174
174
|
};
|
|
175
175
|
};
|
|
176
|
+
conditionalFormatting?: {
|
|
177
|
+
[sheetName: string]: ExcelJS.ConditionalFormattingOptions[];
|
|
178
|
+
};
|
|
176
179
|
},
|
|
177
180
|
): Promise<Buffer> => {
|
|
178
181
|
|
|
@@ -254,6 +257,14 @@ export const convertDataToFileWithStyle = async (
|
|
|
254
257
|
sheet.columns = Array.from(colLetters).map((colId) => ({
|
|
255
258
|
width: options?.width?.[sheetName]?.[colId] ?? defaultColumnWidth,
|
|
256
259
|
}));
|
|
260
|
+
|
|
261
|
+
const formatting = options?.conditionalFormatting?.[sheetName];
|
|
262
|
+
|
|
263
|
+
if (formatting) {
|
|
264
|
+
formatting.forEach((rule) => {
|
|
265
|
+
sheet.addConditionalFormatting(rule);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
257
268
|
}
|
|
258
269
|
|
|
259
270
|
const buffer = await workbook.xlsx.writeBuffer();
|