Auto column width in EPPlus

前端 未结 10 1399
心在旅途
心在旅途 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:54

    Use AutoFitColumns, but you have to specify the cells, i assume the entire worksheet:

    VB.NET

    Worksheet.Cells(Worksheet.Dimension.Address).AutoFitColumns()
    

    C#

    Worksheet.Cells[Worksheet.Dimension.Address].AutoFitColumns();
    

    Please note you need to call this method after filling the worksheet.

提交回复
热议问题