We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to auto adjust column width?

Dear All,

How to auto adjust column width ?

please help

Thanks & Regards


Thank you for contacting Aspose support.

You may use Worksheet.AutoFitColumns method for your need. Please check the below provided code snippet for your reference.


var book = new Workbook(myDir + “sample.xlsx”);
var sheet = book.Worksheets[0];

Please let us know if you need further assistance.

hi… it does not work

Worksheet sheet = workbook.Worksheets[0];
sheet.Name = REPORTNAME;

Hi Winanjaya,

I have tested it with Aspose.Cells for .NET 8.0.0, and found no issue as the above statements are producing desirable results on my end. Please give the latest version a try on your end. In case the problem persists, please provide your sample file for our review because the presented scenario could also be template specific.


I am using Aspose Cell .NET 8.0.0,
please see generated xls file as enclosed

Hi… it works …


I put AutoFitColumns before save


Good to know that you have figured it out now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.