Auto column width in EPPlus

前端 未结 10 1398
心在旅途
心在旅途 2020-12-23 00:31

How to make columns to be auto width when texts in columns are long?

I use this code

 Worksheet.Column(colIndex).AutoFitColumn() \'on all columns\'
         


        
10条回答
  •  无人及你
    2020-12-23 00:53

    I have used this code with the version 3.1.3.0 of EPPlus and it is working:

    worksheet.Column(1).AutoFit();
    

    where a worksheet is the variable referencing the worksheet I have created in my code (not a class with a static method!).

    Obviously you have to call this method after you have filled the columns.

提交回复
热议问题