Auto column width in EPPlus

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

    It's working just fine for me.

    Try:

    ExcelWorksheet wsSheet1 = ExcelPkg.Workbook.Worksheets.Add("Sheet1");
    wsSheet1.Cells[wsSheet1.Dimension.Address].AutoFitColumns();
    ExcelPkg.SaveAs();
    

提交回复
热议问题