I am using exceljs 3.8.2
.
In documentation
there is an method addConditionalFormatting
for conditional formatting. But after installation this method is not found.
I am using below code.
import { Workbook, Worksheet, Cell, Fill, Row } from 'exceljs';
worksheet.addConditionalFormatting({
ref: 'A1:E7',
rules: [
{
type: 'expression',
formulae: ['MOD(ROW()+COLUMN(),2)=0'],
style: {fill: {type: 'pattern', pattern: 'solid', bgColor: {argb: 'FF00FF00'}}},
}
]
})