Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
310
Apply a background style to a row in an Excel.
posted

Hello ,

Can anyone help me to Apply a background style to a row in excel . I checked the documentation and I see only for cell using the below code.

worksheet.rows(2).cells(0).cellFormat().fill($.ig.excel.CellFill.createPatternFill("lime", "gray", $.ig.excel.FillPatternStyle.diagonalCrosshatch);

Appreciate your help.

  • 2525
    posted

    Hello,

    I suggest utilizing this method to iterate over all the cells and apply this style on every cell. This would mean surrounding this by a for loop as so:

    for(var i = 0; i < cells.length; i++){

    worksheet.rows(2).cells(i).cellFormat().fill($.ig.excel.CellFill.createPatternFill("lime", "gray", $.ig.excel.FillPatternStyle.diagonalCrosshatch);

    }

    Let me know if you have any questions.