Chart's toImage() works in 2.2.1.10 but fails in 2.4.1

I need to update to the newest jar version, but creating a chart image is failing. The following code works in version 2.2.1.10, but fails in 2.4.1.

Thanks,
Frank

java.lang.NullPointerException
at sun.font.GlyphLayout.layout(GlyphLayout.java:359)
at sun.font.ExtendedTextSourceLabel.createGV(ExtendedTextSourceLabel.java:308)
at sun.font.ExtendedTextSourceLabel.getGV(ExtendedTextSourceLabel.java:294)
at sun.font.ExtendedTextSourceLabel.createLogicalBounds(ExtendedTextSourceLabel.java:208)
at sun.font.ExtendedTextSourceLabel.getAdvance(ExtendedTextSourceLabel.java:117)
at java.awt.font.TextLine.init(TextLine.java:264)
at java.awt.font.TextLine.(TextLine.java:110)
at java.awt.font.TextLine.fastCreateTextLine(TextLine.java:952)
at java.awt.font.TextLayout.fastInit(TextLayout.java:585)
at java.awt.font.TextLayout.(TextLayout.java:374)
at sun.font.FontDesignMetrics.stringWidth(FontDesignMetrics.java:466)
at com.aspose.cells.b.E.b(Unknown Source)
at com.aspose.cells.b.b.a(Unknown Source)
at com.aspose.cells.b.b.a(Unknown Source)
at com.aspose.cells.b.k.a(Unknown Source)
at com.aspose.cells.b.k.g(Unknown Source)
at com.aspose.cells.b.k.a(Unknown Source)
at com.aspose.cells.b.k.j(Unknown Source)
at com.aspose.cells.b.k.a(Unknown Source)
at com.aspose.cells.b.b.a.a(Unknown Source)
at com.aspose.cells.Chart.toImage(Unknown Source)

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import com.aspose.cells.Chart;
import com.aspose.cells.ChartType;
import com.aspose.cells.FileFormatType;
import com.aspose.cells.ImageFormat;
import com.aspose.cells.ImageOptions;
import com.aspose.cells.License;
import com.aspose.cells.NSeries;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;
import com.nielsen.powerpoint.Test;

public class Aspose
{

static
{
InputStream stream = null;
try {
stream=Test.class.getResourceAsStream(“Aspose.Cells.lic”);
final License licenseCells=new com.aspose.cells.License();
licenseCells.setLicense(stream);
if(stream != null) stream.close();
} catch(Exception e) {
System.out.println(e.toString());
}
}

public void chart() throws IOException
{
final Workbook wb = new Workbook();
final Worksheet ws = wb.getWorksheets().getActiveSheet();
final Chart chart = ws.getCharts().addChart(ChartType.BAR_CLUSTERED, 0, 0, 5, 5);
final NSeries ns = chart.getNSeries();
final ImageOptions imgOpts = new ImageOptions();
final FileOutputStream fos = new FileOutputStream(“c:\Aspose.Chart.png”);

ns.add(“A9:B12”, true);
wb.save(“c:\Aspose.Chart.xls”, FileFormatType.EXCEL97);
imgOpts.setImageFormat(ImageFormat.PNG);
imgOpts.setFashion(FileFormatType.EXCEL97);
chart.toImage(fos, imgOpts);
}

public static void main(String args[]) {
try {
Aspose aspose = new Aspose();
aspose.chart();
} catch (Exception e) {
e.printStackTrace();
}
}
}

Hi,

I have tested your code with the attached latest version/fix v2.4.1.9, it works fine.
Kindly try it and let us know if it works fine now.
Thank you.

Thanks for the quick reply. It seems to be working in v2.4.1.9.