Auto column width in EPPlus

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

    I use this and is working well.

    Dim objExcel As New ExcelPackage
    Dim Sheet As ExcelWorksheet = objExcel.Workbook.Worksheets.Add("SheetName")
    Sheet.Cells("B1:BN").AutoFitColumns()
    

提交回复
热议问题