Search code examples
c#epplus

Hide column in EPPlus not working


I want to hide a column in excel using EPPlus nuget package and its not working (It didn't hide the column)

this is what I have found that is supposed to do the trick. Maybe there is a bug ?

worksheet.Column(1).Hidden = true;

I am using version 4.5.2.1

Project URL https://github.com/JanKallman/EPPlus


Solution

  • I was calling

    worksheet.Cells.AutoFitColumns();
    

    after

    worksheet.Column(1).Hidden = true;
    

    AutoFitColumns was removing the hide effect.