'Styling issue on an excel sheet on nodejs with excelJS
im using excelJS library to manipulate excel file, Im trying to mark one row at a certain color and its filling almost the whole table, So i tried filling only one cell and it returns the same problem and coloring almost the whole sheet. Anyone knows if its a known library bug or is it a bug with my code ?
const wb = new ExcelJS.Workbook();
const fileName = 'DevExercise.xlsx';
wb.xlsx.readFile(fileName).then(() => {
// Iterate over all sheets
wb.eachSheet(function (worksheet, sheetId) {
// Iterate over all rows that have values in a worksheet
worksheet.eachRow(function (row, rowNumber) {
worksheet.getCell('G' + rowNumber).value = sumRow(row.values[3], row.values[4], row.values[5], row.values[6])
if (row.values[2] == "Rent"){
worksheet.getCell('C1').fill = {
type: 'pattern',
pattern:'darkVertical',
fgColor:{argb:'ffff00'}
};
console.log("C" + rowNumber);
}
})
});
wb.xlsx.writeFile("copy" + fileName)
.then(function() {
// done
});
}).catch(err => {
console.log(err.message);
}); ```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
