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

Free Support Forum - aspose.com

autofitColumns - variable results

Hello

the autofitcolumns() method seems to yield variable results. On one application server it works fine, all columns are widened to the width of the widest content. On another application server, the first generating of a spreadsheet also works fine, every call after that though produces a different result - the column width has been changed, but not correctly, the content is too large for the column by a small number of characters. Every generating of a spreadsheet after the first one is incorrect. Only a restart of the application server produces correct results again, but again, only for the first generating of a spreadsheet. I am using aspose-cells-7.0.2.jar.

Do you have any ideas why this might happen?

Thank you

Brian Mattimoe

Hi,


We fixed similar issue regarding Auto-Fit Column function in the latest version v7.0.4, please try it:
http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/entry350406.aspx

If you still find the issue, give us your sample code and Excel file to reproduce the issue on our end, we will check it soon.

Thank you.

Hi

thank you for the latest version, unfortunately it didn't solve the problem. The funny thing is that the autofitColumns works differently in these cases:

  • jboss-server A - it always works
  • jboss-server B - autofit only works the first time after starting the application, afterwards the resize is incorrect
  • webspherre server - autofit only works the first time after starting the application, afterwards the resize is incorrect

The method does actually resize the columns, as can be seen with column "E" for example, it just doesn't set the maximum size (only very nearly!)

I've attached the template and 2 results, one result where autofit works and another where it is faulty. I've also attached code where the method is called. I am quite sure that the statement "sheet.autoFitColumns();" is always called in this case.

Thank you

Brian

Hi Brian,

We need to investigate the issue. It looks strange enough that it works fine on your first server and does not work entirely fine (does work fine first time though) on your second and third servers. I have logged a ticket with an id: CELLSJAVA-40073. We will look into it soon.

Also, kindly do provide details and compare the second and third servers with first server. Give us information about your servers, especially, jboss-server B and websperre server, e.g their underlying OS, JDK version, other details/configurations etc.

Thank you.

Hi,

We have tested your file with JBoss6.1 and following code but cannot find the issue:

Workbook wb = new Workbook(“result_faulty.xls”);
wb.getWorksheets().get(0).autoFitColumns();
wb.save(“res.xls”);

We executed this code several times and the generated excel files all look same with your given “result_correct.xls”.

We think you can try this simple code to test whether your servers will give different result.

If you get the same issue, please try following ways separately:

1. Use a console java application instead of web application to execute the same code twice or more times in a loop.
2. Set font path mannually when initialize your application
3. Copy fonts from the server that can give correct result to the server that has problem, then specify the font path to refer to the same fonts.

We are seeing the same bug on our servers. We are currently using WebSphere as our application server. Is this bug going to be corrected? It makes it nearly impossible to come up with any logic to create nice consistent output.

Thanks,
Frank

Hi,

We could not reproduce this issue at our end and also you were not able to provide any sample code replicating the problem.

I have logged your comment and requested the development team to advise on this issue. Once, we have some update relating to it, we will let you know asap.

Hi,

Did you try the steps we suggested at Link to this post and what’s the result you got?

If you tried all the steps and found the same issue, please send us your console application and the font files, we will test it again to figure the issue out.