Free Support Forum - aspose.com

Aspose.cells.Worksheet.AutoFitRows() reults in error for Japanese characters

Hi,

I am trying to export data from my application to Excel sheet. I have used the Worksheet.AutoFitRows() method to Auto fit the rows in excel sheet. But as soon as this method is executed, it gives error for some Japanese records. The error received is "Index and Length must refer to a location within the string. Parameter name :length."

The above mentioned error is usually thrown by .Net when you are trying to access an Index not in a collection or if you are trying to get a substring out of a string where length of the substring is more than the string. In my case, there is nothing like that. Neither I am trying to get a substring nor an Index. The error is received on execution of Worksheet.AutoFitRows() method, and that too for Japanese characters only(working fine for other languages).

I am not sure if this is a bug with Aspose.cells(version 7.0.2.0). If yes, please let me know if this is fixed with the latest version or else please suggest a Solution/Workaround.

Thanks

Praveen Tayal

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please download and use the latest version: Aspose.Cells
for .NET v7.3.4.3
and see if it makes any difference.

Please also provide us your source xls/xlsx file which you is throwing this exception so that we could look into this issue at our end.

We will investigate it and help you asap.

Thanks for the reply. I have attached the xls file.
Also, My application requires the License file as well. The link you provided contains only Aspose.cells.dll.
Currently, I have Aspose.cells.dll(version 7.0.2.0) and its license file.
I would not be able to test with version 7.3.4.3 without the license file. It would be great if you can provide the license file as well.
Thanks for your help.

Thanks
Praveen Tayal

praveen.tayal:

Currently, I have Aspose.cells.dll(version 7.0.2.0) and its license file.
I would not be able to test with version 7.3.4.3 without the license file. It would be great if you can provide the license file as well.
Thanks for your help.

Thanks
Praveen Tayal

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We will soon check your issue. Besides, you must test the given latest version without license file. Just comment your licensing code and you are good to try it.

Also, if your old license is still valid, you can also use your old license with it. In case, your license has expired and you want to use this version, then you will have to upgrade your license subscription.
praveen.tayal:

Thanks for the reply. I have attached the xls file.

I would not be able to test with version 7.3.4.3 without the license file. It would be great if you can provide the license file as well.
Thanks for your help.

Thanks
Praveen Tayal

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We have tested your source file with the latest version: Aspose.Cells for .NET v7.3.4.3 and it worked fine and AutoFitRows() did not generate any error.

Please see the following test code. I have attached the output file for your reference.

Please download and try the latest version at your end and let us know your feedback

C#
string filePath = @"F:\Shak-Data-RW\Downloads\SearchResult2.xls";

Workbook workbook = new Workbook(filePath);

Worksheet worksheet = workbook.Worksheets[0];
worksheet.AutoFitRows();

workbook.Save(filePath + ".out.xls", SaveFormat.Excel97To2003);