Export Presentation Charts in Java
Overview
Aspose.Slides allows you to export a chart from a presentation as an image. This article shows how to get an image from a chart and save it, which is useful when you need to reuse chart visuals outside a PowerPoint presentation.
In addition to the basic image export workflow, the article also addresses common export-related questions, including saving chart content to SVG, controlling output size through rendering options, loading fonts to preserve label and legend appearance, and keeping the original presentation formatting such as themes, styles, fills, and effects during rendering.
Get a Chart Image
Aspose.Slides for Java provides support for extracting image of specific chart. Below sample example is given.
Presentation pres = new Presentation();
try {
IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 600, 400);
IImage slideImage = chart.getImage();
try {
slideImage.save("image.jpg", ImageFormat.Jpeg);
} finally {
if (slideImage != null) slideImage.dispose();
}
} finally {
if (pres != null) pres.dispose();
}
FAQ
Can I export a chart as a vector (SVG) instead of a raster image?
Yes. A chart is a shape, and its contents can be saved to SVG using the shape-to-SVG saving method.
How can I set the exact size of the exported chart in pixels?
Use the image-rendering overloads that let you specify size or scale—the library supports rendering objects with given dimensions/scale.
What should I do if fonts in labels and the legend look wrong after export?
Load the required fonts via FontsLoader so the chart rendering preserves metrics and text appearance.
Does export honor the PowerPoint theme, styles, and effects?
Yes. Aspose.Slides’ renderer follows the presentation’s formatting (themes, styles, fills, effects), so the chart’s appearance is preserved.
Where can I find available rendering/export capabilities beyond chart images?
See the API/documentation for output targets (PDF, SVG, XPS, HTML, etc.) and related rendering options.