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

Free Support Forum - aspose.com

AutoFitColumns and AutoFitRows don't seem to working

Hi, the calls to AutoFitColumns and AutoFitRows don't seem to working.
Here is my Code.
Workbook workbook = new Workbook(pathOfExampleFile);
Worksheet sheet = workbook.Worksheets["example"];
sheet.AutoFitRows();
sheet.AutoFitColumns();
workbook.Save(pathfile + @"\result.xlsx");
The attachment is the file I’m trying to format
The width of the columns changes , if they are too large, but they become too small as you can see in first column.

Thanks

Hi Nicoletta,

Thank you for using Aspose products.

I have evaluated your presented scenario while using the latest version of Aspose.Cells for .NET 7.7.0, and I am unable to detect any problem in the resultant spreadsheet (attached). I would request you to give a try to the latest build on your end. In case you have any ambiguity, please feel free to write back.

Hi,


thanks for the reply.

I updated the dll (before I was using version 7.5) but the result is the same.
I attached the three steps. (Note the left border of the column B in example after elab).

Thanks

1 - example original
2 - example after elab
3 - example what I expect to get

Hi Nicoletta,

Thank you for the elaboration, and for providing a snapshot of your desired results.

I am able to observe the presented issue while using the latest version of Aspose.Cells for .NET 7.7.0. A ticket (CELLSNET-42245) has been logged in our bug tracking system to probe further into this matter, and to provide a fix at earliest. Please spare us little time to properly analyze the problem cause on our end. In the meanwhile, we will keep you posted with updates in this regard.

For future reference, I have found two issues with AutoFitColumn method that have been logged for further analysis,

  1. Resultant spreadsheet seems to ignore the left border for column B.
  2. AutoFitColumn method is making the column width too tight for the text in cells. In some portions of the spreadsheet such as G12, the text seems to be touching the right cells border.
Hi, have you some news about the problem of "autofit"? I've tried with new versions of DLL but nothing changed.
Thanks. Bye

Hi there,

We are sorry for the inconvenience cause.

Unfortunately, we haven’t yet received any news in reference to the ticket logged earlier as CELLSNET-42245. A note has been recorded for the concerned development member to share the updates regarding the ticket status and ETA (if possible). As soon we have any updates, we will post here for your kind reference.

Hi,

Thanks for using Aspose.Cells

Aspose.Cells works fine if the zoom is 100%. We could not find how MS Excel autofits columns if the zoom is not 100%.