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

Free Support Forum - aspose.com

autoFitColumns() causes intermittent crashes

The sample code attached does not throw an exception, the app just dies. It also does not crash every time, but has anywhere from a 20% to 50% failure rate.

The offending line is in ExcelExport.java, line 121.

I am using the latest Aspose.Cells version 2.3 and Java version 1.6.20 for Windows (Vista).
Both Java and Vista are 64-bit.

If I can help with any further info - please let me know.


We cannot reproduce the issue here. To isolate the cause of the issue, we have changed your Main class to execute some operations needed by autoFitColumns(). Would you please test this modified Main class (attached) to check whether it can reproduce such kind of issue?

Thank you for your help.

It fails on the call to getFontMetrics(). Same as before, it works sometimes, fails sometimes. I’m not much of an AWT/Swing guy, so I’m not sure if this is something misconfigured on my end, or something I can work around or avoid.

import java.awt.Font;
import java.awt.FontMetrics;
import javax.swing.JLabel;

public class Main
public static void main(String[] args)
JLabel label = new JLabel();
Font font = new Font(“Arial”, 0, 13);

// This fails. Sometimes.
FontMetrics fm = label.getFontMetrics(font);

It seems there are some problems with your environment. We are not sure whether it is related with the OS, 64-bit architecture or the JDK or even their compatibility. I think you can try the following JVM option first:
If the issue still persists, I am afraid you need to re-install or upgrade your JDK to test whether it can be resolved.
Thank you.