aspose-free-consulting / projects

The starting point for Aspose free consulting projects
5 stars 5 forks source link

I want to autofitcolumns using Aspsoe.CellsI on the formatted columns. #412

Open larryfan2023 opened 1 month ago

larryfan2023 commented 1 month ago

AutoFitIssue.xlsx

I have a columns formatted as currency, see attached file. I tried to use the code below to auto fit the columns width, but it didn't adjust the columns width. Please advise.

AutoFitterOptions options = new AutoFitterOptions(); options.FormatStrategy = CellValueFormatStrategy.DisplayString;

.....

//auto fit width foreach (Worksheet w in workbook.Worksheets) {

w.AutoFitColumns(options);

}

amjad-sahi commented 1 month ago

@larryfan2023,

We tested your scenario/case using your template XLSX file and sample code snippet. Please try installing "Courier" font which looks like missing on your end. After installing it, we got the following result: 24.5.5 (2).zip

And please check the document about configuring fonts and follow the instruction for configurations. https://docs.aspose.com/cells/net/configuring-fonts-for-rendering-spreadsheets/

And, if there is still any issue after installing "Courier" font, please share your "Courier" font file here, we will check it soon.

larryfan2023 commented 1 month ago

I modified font that is available in my machine and tested it worked. Thank you so much for resolving this issue.

amjad-sahi commented 1 month ago

@larryfan2023,

It is nice to know that after changing to the installed font on your machine, your issue is sorted out. Please feel free to contact us any time if you have further queries or comments. You may also post your queries in the dedicated forums.