Skip to content Skip to sidebar Skip to footer

Exceljs : Iterate Each Cell Of Each Row And Column

I want to put thick border in all my cells. this is an angular project, I am using typescript. I can do this for 1 cell, worksheet.getCell('A1').border = { top: { style: 'thick'

Solution 1:

Worksheet gives you a columns property on which you can iterate and use it like :-

worksheet.columns.forEach(column=> {
      column.border= {
        top: { style:"thick" },
        left: { style:"thick" },
        bottom: { style:"thick" },
        right: { style:"thick" }
      };
    });

Solution 2:

To put border in all cells :- exceljs version 1.12.0

worksheet.columns.forEach((col)=> {
        col.style.font= { name:'Comic Sans MS' };col.style.border= { top: { style:'thin' }, left: { style:'thin' }, bottom: { style:'thin' }, right: { style:'thin' } };
    })

Post a Comment for "Exceljs : Iterate Each Cell Of Each Row And Column"