How to set the style for an entire column in EPPlus?

后端 未结 2 1658
故里飘歌
故里飘歌 2021-01-17 12:40

Is it possible to set the style for an entire column in EPPlus? I would expect that I could just use the Column method, but when I do I get strange results:

2条回答
  •  孤城傲影
    2021-01-17 13:05

    Try using ranges; I was having a problem with using numbers as well.

    //Get the final row for the column in the worksheet
    int finalrows = worksheet.dimension.End.Row;
    
    //Convert into a string for the range.
    string ColumnString = "A1:A" + finalrows.ToString();
    
    //Convert the range to the color Red
    worksheet.Cells[ColumnString].Style.Font.Color.SetColor(Color.Red);
    

    Hopefully this works,but I didn't try it out.

提交回复
热议问题