Create Charts Using VSTO and Aspose.Slides for Java
Creating a Chart
The code examples below describe the process of adding a simple 3D clustered column chart using VSTO. You create a presentation instance, add a default chart to it. Then use Microsoft Excel workbook to access and modify chart data along with setting chart properties. Lastly, save the presentation.
VSTO Example
Using VSTO, the following steps are performed:
- Create an instance of a Microsoft PowerPoint presentation.
- Add a blank slide to the presentation.
- Add a 3D clustered column chart and access it.
- Create a new Microsoft Excel Workbook instance and load chart data.
- Access the chart data worksheet using Microsoft Excel Workbook instancefromworkbook.
- Set the chart range in the worksheet and remove series 2 and 3 from the chart.
- Modify the chart category data in the chart data worksheet.
- Modify chart series 1 data in the chart data worksheet.
- Now, access the chart title and setthefontrelatedproperties.
- Access the chart value axis and set the major unit, minor units, max value and min values.
- Access the chart depth or series axis and remove that as in this example, onlyoneserieisused.
- Now, set the chart rotation angles in X and Y direction.
- Save the presentation.
- Close the instances of Microsoft Excel and PowerPoint.
The output presentation, created with VSTO

Aspose.Slides for Java Example
Using Aspose.Slides for Java, the following steps are performed:
- Create an instance of a Microsoft PowerPoint presentation.
- Add a blank slide to the presentation.
- Add a 3D clustered column chart and access that.
- Access the chart data worksheet using a Microsoft Excel Workbook instancefromworkbook.
- Remove unused series 2 and 3.
- Access chart categories and modify the labels.
- Accesseries1 and modify the series values.
- Now, access the chart title and set the font properties.
- Access the chart value axis and set the major unit, minor units, max value and min values.
- Now, set the chart rotation angles in X and Y direction.
- Save the presentation to PPTX format.
The output presentation, created with Aspose.Slides

FAQ
Can I create other types of charts like pie, line, or bar charts with Aspose.Slides?
Yes. Aspose.Slides supports a wide range of chart types, including pie charts, line charts, bar charts, scatter plots, bubble charts, and more. You can specify the desired chart type using the ChartType class when adding a chart.
Can I apply custom styles or themes to the chart?
Yes. You can fully customize the chart’s appearance, including colors, fonts, fills, outlines, gridlines, and layout. However, applying Office themes exactly as seen in PowerPoint requires manually setting individual styles.
Can I export the chart as an image separately from the slide?
Yes, Aspose.Slides allows you to export any shape—including charts—as a separate image (e.g., PNG, JPEG) using the getImage method on the chart shape.