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

Free Support Forum - aspose.com

AutoFitColumn not wokring

My Aspose version is, The attachment is the test excel, When I am trying to do autofitcolumn for the first three columns of the test excel, it seems not working. Below is my code.

public void TestAutoFitColumn(string InputPath, string OutputPath)
// Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream(InputPath, FileMode.Open);

        // Opening the Excel file through the file stream
        Workbook workbook = new Workbook(fstream);

        // Accessing the first worksheet in the Excel file
        Worksheet worksheet = workbook.Worksheets[0];

        // Auto-fitting the Column of the worksheet

        // Saving the modified Excel file

        // Closing the file stream to free all resources

test.zip (98.5 KB)

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-48353 - AutoFitColumn is not wokring

AutoFitColumn can not work fine if Worksheet.Zoom is not 100.We are working on this issue for a long time. But there is no obvious progress.

OK, thanks for you reply

You are welcome.

Hi @ahsaniqbalsidiqui,

I am also facing the same issue, even after I added below

worksheet.Zoom = 100;

Kindly advice.


Pls note: Cell lock has been applied on all columns and this seems working in local system, but when deployed to app service in azure, it doesn’t work.

Aspose.Cells version : 21.9.0


Please try our latest version/fix: Aspose.Cells v21.12.x. If you still find the issue, kindly do share your sample code (runnable) and sample files(if any) to reproduce the issue on our end. We will check it soon.

PS. please zip the file prior attaching here.