Hello,
I am using the current Aspose.Cells version 19.1 inside a Visual Studio 2012 C# Script Task and for some reason am having trouble using the worksheet.AutoFitColumns() function. It doesn’t seem to be completely autofitting the columns, here is a screenshot, columns E, F, G, H, and J aren’t fully fitted:
2019-02-08_8-24-43.png (1.7 KB)
Do you have any suggestions on how to correct this?
Thank you!
@softwarelicense_aixgroup_com,
Thanks for the screenshot and details.
Could you provide us your template Excel file, we will check your issue soon.
Yes, I have attached the 2 template files in a zip file.
To give you the background on how I’m building the file, I use the “blank.xlsx” file as my starting template and am using Microsoft’s DocumentFormat.OpenXml to populate the data into the “SendToAspose.xlsx” file.
I then open the “SendToAspose.xlsx” file using Aspose.Cells to freeze the top rows and call the worksheet.AutoFitColumns() function.
templates.zip (11.7 KB)
@softwarelicense_aixgroup_com,
Thanks for the template file.
After an initial test, I am able to observe the issue as you mentioned by using the following sample code with your template file. I found that Worksheet.AutoFitColumns() is not fully fitting columns:
e.g
Sample code:
Workbook workbook = new Workbook("E:\\test2\\SendToAspose.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
worksheet.AutoFitColumns();
workbook.Save("e:\\test2\\out1.xlsx");
I have logged a ticket with an id “CELLSNET-46578” for your issue. We will look into it soon.
Once we have an update on it, we will let you know here.
1 Like
@softwarelicense_aixgroup_com,
This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-46578”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.
Excellent, thank you very much for taking a look and fixing it so quickly! Looking forward to the update.
@softwarelicense_aixgroup_com,
Please try our latest version/fix: Aspose.Cells for .NET v19.1.8 (attached):
Your issue should be fixed in it.
Let us know your feedback.
Aspose.Cells19.1.8 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells19.1.8 For .Net4.0.Zip (4.8 MB)
1 Like
SendToAspose2.zip (109.6 KB)
It looks great! I only noticed 1 minor issue, if you take a look at my latest attachment, column I has a sub total at the bottom and that specific column didn’t Autofit.
@softwarelicense_aixgroup_com,
Thanks for the template file.
I tested your scenario/ case a bit using your template file (I used it as input file) with the following sample code using v19.1.8, it works fine. The bottom sub-total values are also auto fitted fine. I have attached the output file for your reference:
e.g
Sample code:
Workbook workbook = new Workbook("E:\\test2\\SendToAspose2.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
worksheet.AutoFitColumns();
workbook.Save("e:\\test2\\out1.xlsx");
If you still find the issue, kindly do create a sample console demo application (runnable) and provide us here to show the issue, the project should be run seamlessly and there should not be any inter-decencies for external sources or other APIs, we will check it soon.
files1.zip (115.5 KB)
The issues you have found earlier (filed as CELLSNET-46578) have been fixed in Aspose.Cells for .NET v19.2. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi