Hello,
I’ve noticed that the AutoFitColumns() method does not get columns as narrow as Excel’s auto-fitting. I’d just like to know what the reason(s) for this is/are as of the current version (7.1.1.)
Thanks,
- Matt
Thanks for the reply Amjad. I’m not seeing any issue with the way the auto-fitting is currently working; I’m just getting questions from users asking why things aren’t packed in as tightly as possible horizontally.
If it is the case that a little padding is being put in when auto-fitting column(s) to try appease the two camps you mentioned (those who want auto-fit to get things as narrow as possible and those who want auto-fit to leave a little extra room), then would it be possible for Aspose to provide an overload of AutoFitColumns and/or AutoFitColumn in a future release that would allow a developer to specify how much (if any) extra padding they’d like as a parameter?
Hi,
Thanks for your posting.
Padding actually depends on the type and size of fonts.
Ms-Excel uses Win32 native APIs for graphics, while Aspose.Cells uses .NET framework APIs so minor issues in autofitting will remain.
Being a managed component, Aspose.Cells cannot use Win32 native APIs for graphical metrics, rendering etc.
Anyway, please provide us your sample files, screenshots and sample project replicating the problems, we will look into them and update you asap.
Hi,
Aspose.Cells.Workbook w = new Aspose.Cells.Workbook(@“c:\temp\book1.xlsx”);
w.Worksheets[0].Cells[“A1”].Value = 80456362.16 ;
w.Worksheets[0].Cells[“A2”].Value = 13489467.16 ;
w.Worksheets[0].Cells[“B1”].Value = DateTime.Now;
w.Worksheets[0].Cells[“C1”].Value = 80456362.16;
w.Worksheets[0].Cells[“C2”].Value = 13489467.16;
w.Worksheets[0].Cells[“D1”].Value = 80456362.16;
w.Worksheets[0].Cells[“D2”].Value = 13489467.16;
w.Worksheets[0].AutoFitColumns();
w.Save(@“c:\temp\output.xlsx”, Aspose.Cells.SaveFormat.Xlsx);
Hi Laurent,
Thank you.
Good to know that your issue is sorted out.
We updated a project to 7.4.3.0 from 4.8.2.0 - because the hyperlink sorting item we thought was solved in 7.4.3.0, this is another question later. For now we noticed that the AutoFitColumns does not work like it did in 4.8.2.0. I ran the sample listed above by the user and sure enough it does not appear to be working as it did before. Can you check on this?
I just confirmed that the issue appears to be corrected in 8.1.0, we will go ahead and move up to that for this particular application.
Hi Mark Warner,
I understand that using the latest is typically the best it can also introduce issues that is not easy to resolve.
Hi Mark Warner,
Thanks for your posting and using Aspose.Cells.
Hopefully, you will not encounter any newer issue while upgrading to latest version. In case, you encounter any issue, we will be quick to resolve it. Please feel free to post here if you face any issue or have any other question.