Auto column width in EPPlus

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

    You will need to calculate the width. There is no autosizing function in the library that will work as you intend.

    Autofitcolumn will not work with wrapped text and cells with formulas.

    Look at http://epplus.codeplex.com/discussions/218294?ProjectName=epplus for examples of how you can solve the problem.

提交回复
热议问题