# Aspose.Slides for Android via Java > Complete English documentation. Each page retains its canonical source URL. # Aspose.Slides for Android via Java > Start here: add Aspose.Slides for Android via Java to your app, create a first presentation, and find the guides for common tasks, the API reference and support. Source: https://docs.aspose.com/slides/androidjava/ Updated: 2026-10-27 Aspose.Slides for Android via Java Aspose.Slides for Android via Java is a class library for creating, reading, editing and converting PowerPoint and OpenDocument presentations in Android applications, without Microsoft PowerPoint. It loads and saves PPT, PPTX, PPS, POT and ODP, including macro-enabled and template variants, and exports to PDF, XPS, HTML, SVG, TIFF, Markdown and images.

Explore features and support — browse the library features and open their guides.

------

Get Started


GETTING STARTED

EVALUATE

Build with Slides


COMMON TASKS

SLIDES WORKFLOWS

EXAMPLES

Reference & Support


REFERENCE

SUPPORT

------ ## **Your first presentation** The library comes from Aspose's Maven repository. New Android Studio projects already have a `dependencyResolutionManagement` block in *settings.gradle.kts*. Add the `maven` line shown below to the `repositories` block inside it, rather than pasting a second block: ```kotlin dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() maven { url = uri("https://releases.aspose.com/java/repo/") } } } ``` Then add the library to *app/build.gradle.kts* and sync the project: ```kotlin dependencies { implementation("com.aspose:aspose-slides:26.9:android.via.java") } ``` [Installation](https://docs.aspose.com/slides/androidjava/install-aspose-slides-for-android-via-java/) covers Groovy build scripts, the manual JAR file, and how to choose a version. The code for your first presentation is on [Create Presentations](https://docs.aspose.com/slides/androidjava/create-presentation/): it adds a text box to a slide and saves the presentation to your app's storage. That sample has been compiled and built into an APK; it has not been run on a device. Without a license, saved presentations carry an evaluation watermark — see [Licensing](https://docs.aspose.com/slides/androidjava/licensing/). ## Related articles - [Resources](https://docs.aspose.com/slides/androidjava/resources/) - [API Reference](https://docs.aspose.com/slides/androidjava/api-reference/) # Customize 3D Charts in Presentations on Android > Create 3D charts in PowerPoint presentations with Aspose.Slides for Android via Java. Adjust rotation, height proportions, chart depth, and spacing between series with Java examples. Source: https://docs.aspose.com/slides/androidjava/3d-chart/ Updated: 2026-11-09 ## **Overview** Aspose.Slides for Android via Java lets you customize the view of a 3D chart through the [IChart.getRotation3D](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#getRotation3D--) method. This article demonstrates how to adjust rotation, height proportions, depth, right-angle axes, and spacing between series, then save the presentation in PPTX format. ## **Set the Rotation and Depth of a 3D Chart** The example below creates a [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) and uses [IShapeCollection.addChart](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishapecollection/#addChart-int-float-float-float-float-) to add a stacked 3D column chart to its first slide. It replaces the default series and categories with two series containing three values each. Worksheet index `0` identifies the chart's first data worksheet; row `0` holds series names, and column `0` holds category labels. The [setRotationX](https://reference.aspose.com/slides/androidjava/com.aspose.slides/irotation3d/#setRotationX-byte-) and [setRotationY](https://reference.aspose.com/slides/androidjava/com.aspose.slides/irotation3d/#setRotationY-int-) methods set the chart's rotation to 40 and 270 degrees, respectively. [setDepthPercents](https://reference.aspose.com/slides/androidjava/com.aspose.slides/irotation3d/#setDepthPercents-int-) sets its depth to 150% of its width, while [setRightAngleAxes](https://reference.aspose.com/slides/androidjava/com.aspose.slides/irotation3d/#setRightAngleAxes-boolean-) enables right-angle axes instead of perspective. The resulting presentation contains the populated chart with these 3D view settings. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.StackedColumn3D, 0, 0, 500, 500); chart.getChartData().getSeries().clear(); chart.getChartData().getCategories().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); int worksheetIndex = 0; double[][] values = { { 20, 50, 30 }, { 30, 10, 60 } }; for (int categoryIndex = 0; categoryIndex < 3; categoryIndex++) { IChartDataCell categoryCell = workbook.getCell(worksheetIndex, categoryIndex + 1, 0, "Category " + (categoryIndex + 1)); chart.getChartData().getCategories().add(categoryCell); } for (int seriesIndex = 0; seriesIndex < 2; seriesIndex++) { IChartDataCell seriesCell = workbook.getCell(worksheetIndex, 0, seriesIndex + 1, "Series " + (seriesIndex + 1)); IChartSeries series = chart.getChartData().getSeries().add(seriesCell, chart.getType()); for (int categoryIndex = 0; categoryIndex < 3; categoryIndex++) { IChartDataCell valueCell = workbook.getCell(worksheetIndex, categoryIndex + 1, seriesIndex + 1, values[seriesIndex][categoryIndex]); series.getDataPoints().addDataPointForBarSeries(valueCell); } } chart.getRotation3D().setRightAngleAxes(true); chart.getRotation3D().setRotationX((byte) 40); chart.getRotation3D().setRotationY(270); chart.getRotation3D().setDepthPercents(150); presentation.save("Rotation3D_out.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Adjust the Height Proportions of a 3D Chart** Use [IRotation3D.setHeightPercents](https://reference.aspose.com/slides/androidjava/com.aspose.slides/irotation3d/#setHeightPercents-int-) to set the height of a 3D chart as a percentage of its width. This changes the proportions of the 3D scene without resizing the chart object on the slide. The following example creates a [Column3D](https://reference.aspose.com/slides/androidjava/com.aspose.slides/charttype/) chart with the default data: three series and four categories. It saves three presentations with height proportions of 50%, 100%, and 200%. The chart's position, width, and height remain fixed. The data, rotation, depth, series spacing, and formatting are identical in all three files; only the height percentage changes. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Column3D, 40, 30, 620, 460); chart.getRotation3D().setRotationX((byte) 20); chart.getRotation3D().setRotationY(30); chart.getRotation3D().setRightAngleAxes(true); chart.getRotation3D().setDepthPercents(100); chart.getChartData().getSeries().get_Item(0).getParentSeriesGroup().setGapDepth(150); for (int heightPercent : new int[] { 50, 100, 200 }) { chart.getRotation3D().setHeightPercents(heightPercent); presentation.save("chart_height_" + heightPercent + ".pptx", SaveFormat.Pptx); } } finally { presentation.dispose(); } ``` The following images illustrate the same height settings in the equivalent .NET example and were exported using Microsoft PowerPoint. A smaller percentage produces a flatter scene, while a larger percentage produces a taller scene within the same chart object. PowerPoint may also adjust axis tick intervals and label placement to fit the scene. | Height: 50% | Height: 100% | Height: 200% | | --- | --- | --- | | ![3D column chart with height set to 50 percent of its width](https://docs.aspose.com/slides/androidjava/3d-chart/height_percent_50.png) | ![3D column chart with height set to 100 percent of its width](https://docs.aspose.com/slides/androidjava/3d-chart/height_percent_100.png) | ![3D column chart with height set to 200 percent of its width](https://docs.aspose.com/slides/androidjava/3d-chart/height_percent_200.png) | These methods control different aspects of the chart: | Method | Effect | | --- | --- | | [IRotation3D.setHeightPercents](https://reference.aspose.com/slides/androidjava/com.aspose.slides/irotation3d/#setHeightPercents-int-) | Height of the 3D scene as a percentage of its width. | | [IChart.setHeight](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishape/#setHeight-float-) | Height of the chart object on the slide, in points. | | [IRotation3D.setDepthPercents](https://reference.aspose.com/slides/androidjava/com.aspose.slides/irotation3d/#setDepthPercents-int-) | Depth of the 3D scene as a percentage of its width. | | [IChartSeriesGroup.setGapDepth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseriesgroup/#setGapDepth-int-) | Spacing between series along the depth axis, as a percentage of the marker width. | The height setting affects 3D column and bar charts, including cylinder, cone, and pyramid variants, as well as 3D line, area, pie, and surface charts. The comparison above uses the verified `Column3D` type. The setting does not change the appearance of a 2D `ClusteredColumn` chart or a `BubbleWith3D` chart; these names are members of the [ChartType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/charttype/) class. For other chart appearance settings, see [Chart Formatting](https://docs.aspose.com/slides/androidjava/chart-formatting/). ## **Adjust the Gap Between Series** Use [IChartSeriesGroup.setGapDepth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseriesgroup/#setGapDepth-int-) to control the distance between data series along the depth axis of a 3D chart, expressed as a percentage of the marker width. Use values from **0 to 500**, inclusive: `0` removes the gap, while larger values increase the spacing. With a fixed chart depth, increasing the gap makes the markers thinner along the depth axis. Access the group through [IChartSeries.getParentSeriesGroup](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getParentSeriesGroup--). The setting applies to every series in that group, not just the series used to access it. [IChartSeries.getGapDepth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getGapDepth--) returns the depth gap and reflects the parent group's setting. This setting affects 3D column and bar charts, including their cylinder, cone, and pyramid variants, as well as 3D line and area charts. The appearance depends on whether the series are arranged in depth, clustered, or stacked. For a clear comparison of gaps between separate series, use `ChartType.Column3D` from the [ChartType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/charttype/) class. These methods control different aspects of the chart: | Method | Effect | | --- | --- | | [IChartSeriesGroup.setGapDepth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseriesgroup/#setGapDepth-int-) | Spacing between series along the depth axis, as a percentage of the marker width. | | [IChartSeriesGroup.setGapWidth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseriesgroup/#setGapWidth-int-) | Spacing between adjacent bar or column clusters, as a percentage of the bar or column width. | | [setDepthPercents](https://reference.aspose.com/slides/androidjava/com.aspose.slides/irotation3d/#setDepthPercents-int-) | Overall chart depth, as a percentage of the chart width. | The following self-contained example uses the default chart data, which contains three series and four categories. It saves two presentations with identical data, rotation, gap width, and chart depth; only the gap depth changes. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Column3D, 40, 30, 620, 230); chart.getRotation3D().setRotationX((byte) 20); chart.getRotation3D().setRotationY(30); chart.getRotation3D().setDepthPercents(100); IChartSeries series = chart.getChartData().getSeries().get_Item(0); IChartSeriesGroup group = series.getParentSeriesGroup(); group.setGapWidth(150); for (int gapDepth : new int[] { 0, 500 }) { group.setGapDepth(gapDepth); String fileName = "series_gap_depth_" + gapDepth + ".pptx"; presentation.save(fileName, SaveFormat.Pptx); } } finally { presentation.dispose(); } ``` The following images illustrate the same gap depth settings in the equivalent .NET example and were exported using Microsoft PowerPoint. | Gap depth: 0% | Gap depth: 500% | | --- | --- | | ![3D column chart with no gap between series along the depth axis](https://docs.aspose.com/slides/androidjava/3d-chart/gap_depth_0.png) | ![3D column chart with a 500 percent gap between series along the depth axis](https://docs.aspose.com/slides/androidjava/3d-chart/gap_depth_500.png) | ## **FAQ** **Which chart types support 3D mode in Aspose.Slides?** Aspose.Slides supports 3D variants of column charts, including Column 3D, Clustered Column 3D, Stacked Column 3D, and 100% Stacked Column 3D, along with related 3D types exposed through the [ChartType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/charttype/) class. For an exact, up-to-date list, check the [ChartType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/charttype/) members in the API reference of your installed version. **Can I get a raster image of a 3D chart for a report or the web?** Yes. You can export a chart to an image with [Shape.getImage](https://reference.aspose.com/slides/androidjava/com.aspose.slides/shape/#getImage--) or [render the entire slide](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-png/) to formats like PNG or JPEG. This is useful when you need a raster preview or want to embed the chart into documents, dashboards, or web pages without requiring PowerPoint. **How performant is building and rendering large 3D charts?** Performance depends on data volume and visual complexity. For best results, keep 3D effects minimal, avoid heavy textures on walls and plot areas, limit the number of data points per series when possible, and render to an appropriately sized output (resolution and dimensions) to match the target display or print needs. # Create 3D Effects in Presentations on Android > Apply and render 3D effects for PowerPoint shapes and text on Android with Aspose.Slides. Configure camera, lighting, material, extrusion, fills, and 3D text. Source: https://docs.aspose.com/slides/androidjava/3d-presentation/ Updated: 2026-09-25 ## **Overview** Aspose.Slides for Android via Java can create, edit, preserve, and render PowerPoint-style 3D formatting for shapes and text. This article covers 3D effects such as rotation, extrusion, bevels, lighting, material, gradient or picture fills, and 3D text. This article is about 3D formatting effects on PowerPoint shapes and text. It is not about inserting or editing standalone 3D model files. When you export a slide to an image, PDF, or HTML, Aspose.Slides renders those 3D effects into the exported 2D output. ## **3D Formatting Concepts** Use the [IShape.getThreeDFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishape/#getThreeDFormat--) method to apply 3D formatting to a shape. The method returns [IThreeDFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/), which controls the 3D scene for that shape. For text, use the [ITextFrameFormat.getThreeDFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/itextframeformat/#getThreeDFormat--) method. This applies 3D formatting to the text frame instead of the shape body. The most important API members are: | API member | What it controls | When to use it | |---|---|---| | [getCamera](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getCamera--) | Viewpoint, preset camera type, rotation, zoom, and perspective. | Rotate the object in 3D space or match a PowerPoint 3D rotation preset. | | [getLightRig](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getLightRig--) | Light preset, direction, and light rotation. | Change how highlights and shadows appear on the 3D surface. | | [getMaterial](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getMaterial--) and [setMaterial](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#setMaterial-int-) | Surface material, such as flat, matte, plastic, or metal. | Make the same geometry look flatter, softer, glossy, or metallic. | | [getExtrusionHeight](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getExtrusionHeight--) and [setExtrusionHeight](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#setExtrusionHeight-double-) | How far the shape extends backward from its front face. | Turn a flat shape into a visibly thick 3D object. | | [getExtrusionColor](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getExtrusionColor--) | Color of the extruded sides. | Make depth visible or coordinate the side color with the front fill. | | [getDepth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getDepth--) and [setDepth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#setDepth-double-) | Additional 3D depth used by PowerPoint 3D formatting. | Fine-tune depth for shapes or text, especially together with bevel and material settings. | | [getBevelTop](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getBevelTop--) and [getBevelBottom](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getBevelBottom--) | Raised or rounded edges on the front and back faces. | Add a softened or molded edge instead of a sharp flat face. | | [getContourColor](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getContourColor--) and [getContourWidth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getContourWidth--) and [setContourWidth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#setContourWidth-double-) | Outline around the 3D object. | Emphasize the object boundary in rendered output. | ## **Create a 3D Shape** A shape usually needs four kinds of settings before it looks convincingly 3D: - Camera settings, because the default front view may hide the extrusion. - Light settings, because lighting makes the faces and sides readable. - Material settings, because the surface affects how light is rendered. - Extrusion or depth settings, because a flat shape needs thickness. The following example creates a rectangle, adds text to its front face, and applies 3D formatting. The camera rotation values are in degrees, and the extrusion height is 100 points. The example renders the slide to a PNG image at twice its default dimensions and saves the presentation as PPTX. ```java import com.aspose.slides.*; import android.graphics.Color; final float imageScale = 2; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 200, 150, 200, 200); shape.getTextFrame().setText("3D"); shape.getTextFrame().getParagraphs().get_Item(0).getParagraphFormat().getDefaultPortionFormat().setFontHeight(64); shape.getFillFormat().setFillType(FillType.Solid); shape.getFillFormat().getSolidFillColor().setColor(Color.rgb(100, 149, 237)); shape.getThreeDFormat().getCamera().setCameraType(CameraPresetType.OrthographicFront); shape.getThreeDFormat().getCamera().setRotation(20, 30, 40); shape.getThreeDFormat().getLightRig().setLightType(LightRigPresetType.Flat); shape.getThreeDFormat().getLightRig().setDirection(LightingDirection.Top); shape.getThreeDFormat().setMaterial(MaterialPresetType.Flat); shape.getThreeDFormat().setExtrusionHeight(100); shape.getThreeDFormat().getExtrusionColor().setColor(Color.BLUE); IImage thumbnail = slide.getImage(imageScale, imageScale); try { thumbnail.save("shape_3d.png", ImageFormat.Png); } finally { thumbnail.dispose(); } presentation.save("shape_3d.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The rendered slide image shows the rectangle as a thick 3D block: ![Rendered blue 3D rectangle with white 3D text on the front face](https://docs.aspose.com/slides/androidjava/3d-presentation/img_01_01.png) ## **Rotate a Shape with the Camera** In PowerPoint, 3D rotation is configured from the 3-D Rotation pane. The X, Y, and Z rotation values correspond to the rotation you set through the camera API. ![PowerPoint 3-D Rotation pane with X, Y, and Z rotation values highlighted](https://docs.aspose.com/slides/androidjava/3d-presentation/img_02_01.png) In Aspose.Slides, access the camera through [IThreeDFormat.getCamera](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getCamera--). This example creates a rectangle, selects an orthographic front view, and sets its X, Y, and Z rotations to 20, 30, and 40 degrees, respectively. It configures the shape in memory without saving a file: ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 200, 150, 200, 200); shape.getThreeDFormat().getCamera().setCameraType(CameraPresetType.OrthographicFront); shape.getThreeDFormat().getCamera().setRotation(20, 30, 40); } finally { presentation.dispose(); } ``` Use the camera when you need to change how the viewer sees the object. It does not change the 2D shape geometry on the slide. It changes the 3D viewpoint used by PowerPoint and by Aspose.Slides when rendering. ## **Add Extrusion and Depth** Extrusion makes a shape look thick by extending it behind the front face. In PowerPoint, the depth control sets this visible thickness, and the color control sets the color of the side faces. ![PowerPoint depth controls mapped to extrusion color and extrusion height properties](https://docs.aspose.com/slides/androidjava/3d-presentation/img_02_02.png) Use [IThreeDFormat.setExtrusionHeight](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#setExtrusionHeight-double-) to set the thickness and [IThreeDFormat.getExtrusionColor](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#getExtrusionColor--) to access the side color. This example gives a rectangle a 100-point extrusion with purple sides and rotates the camera to reveal its thickness. It configures the shape in memory without saving a file: ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 200, 150, 200, 200); int extrusionColor = Color.rgb(128, 0, 128); shape.getThreeDFormat().getCamera().setCameraType(CameraPresetType.OrthographicFront); shape.getThreeDFormat().getCamera().setRotation(20, 30, 40); shape.getThreeDFormat().getLightRig().setLightType(LightRigPresetType.Flat); shape.getThreeDFormat().getLightRig().setDirection(LightingDirection.Top); shape.getThreeDFormat().setMaterial(MaterialPresetType.Flat); shape.getThreeDFormat().setExtrusionHeight(100); shape.getThreeDFormat().getExtrusionColor().setColor(extrusionColor); } finally { presentation.dispose(); } ``` The [IThreeDFormat.setDepth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#setDepth-double-) method sets the depth of a 3D shape. The [setExtrusionHeight](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ithreedformat/#setExtrusionHeight-double-) method controls the height of the extrusion effect, as shown in this example. ## **Use Gradient or Picture Fills with 3D Effects** 3D formatting is independent of the shape fill. You can apply a solid color, gradient, pattern, or picture fill to the front face and still use the same camera, light, material, and extrusion settings. This example applies a blue-to-orange gradient to the front face and a dark orange color to the 150-point extrusion. The gradient stops at 0 and 100 mark the start and end of the gradient. The camera rotation values are in degrees. The slide is rendered to a PNG image at twice its default dimensions: ```java import com.aspose.slides.*; import android.graphics.Color; final float imageScale = 2; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 200, 150, 250, 250); shape.getTextFrame().setText("3D Gradient"); shape.getTextFrame().getParagraphs().get_Item(0).getParagraphFormat().getDefaultPortionFormat().setFontHeight(64); shape.getFillFormat().setFillType(FillType.Gradient); shape.getFillFormat().getGradientFormat().getGradientStops().add(0, Color.BLUE); shape.getFillFormat().getGradientFormat().getGradientStops().add(100, Color.rgb(255, 165, 0)); shape.getThreeDFormat().getCamera().setCameraType(CameraPresetType.OrthographicFront); shape.getThreeDFormat().getCamera().setRotation(10, 20, 30); shape.getThreeDFormat().getLightRig().setLightType(LightRigPresetType.Flat); shape.getThreeDFormat().getLightRig().setDirection(LightingDirection.Top); shape.getThreeDFormat().setMaterial(MaterialPresetType.Flat); int extrusionColor = Color.rgb(255, 140, 0); shape.getThreeDFormat().setExtrusionHeight(150); shape.getThreeDFormat().getExtrusionColor().setColor(extrusionColor); IImage thumbnail = slide.getImage(imageScale, imageScale); try { thumbnail.save("gradient_3d.png", ImageFormat.Png); } finally { thumbnail.dispose(); } } finally { presentation.dispose(); } ``` The rendered output keeps the gradient on the front face and renders the extrusion separately: ![Rendered 3D rectangle with a blue-to-orange gradient fill and orange extrusion](https://docs.aspose.com/slides/androidjava/3d-presentation/img_02_03.png) To use a picture fill instead, add the image to the presentation and assign it to the shape fill. This example requires an existing file named "image.jpg" in the working directory. It stretches the picture to fill the rectangle, applies a 150-point extrusion, and sets the camera rotation in degrees. It configures the shape in memory without saving or rendering a file: ```java import com.aspose.slides.*; import android.graphics.Color; import java.io.FileInputStream; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 200, 150, 250, 250); IPPImage image; try (FileInputStream imageStream = new FileInputStream("image.jpg")) { image = presentation.getImages().addImage(imageStream); } shape.getFillFormat().setFillType(FillType.Picture); shape.getFillFormat().getPictureFillFormat().getPicture().setImage(image); shape.getFillFormat().getPictureFillFormat().setPictureFillMode(PictureFillMode.Stretch); int extrusionColor = Color.rgb(255, 140, 0); shape.getThreeDFormat().getCamera().setCameraType(CameraPresetType.OrthographicFront); shape.getThreeDFormat().getCamera().setRotation(10, 20, 30); shape.getThreeDFormat().getLightRig().setLightType(LightRigPresetType.Flat); shape.getThreeDFormat().getLightRig().setDirection(LightingDirection.Top); shape.getThreeDFormat().setMaterial(MaterialPresetType.Flat); shape.getThreeDFormat().setExtrusionHeight(150); shape.getThreeDFormat().getExtrusionColor().setColor(extrusionColor); } finally { presentation.dispose(); } ``` The picture is rendered on the front face, while the extrusion is rendered as the 3D side surface: ![Rendered 3D rectangle with a photo fill on the front face and orange extrusion](https://docs.aspose.com/slides/androidjava/3d-presentation/img_02_04.png) ## **Apply 3D Formatting to Text** Shape 3D formatting affects the shape body. Text 3D formatting affects the text frame. This is useful for WordArt-like effects where the letters themselves need extrusion, material, lighting, and camera settings. The following example creates text with an orange-and-white grid pattern, applies an upward arch, and configures 3D settings through [ITextFrameFormat.getThreeDFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/itextframeformat/#getThreeDFormat--). The extrusion height and depth are in points, and the light rotation is in degrees. The shape fill and outline are hidden so that only the text is visible. The example renders a PNG image at twice the default slide dimensions and saves the presentation as PPTX: ```java import com.aspose.slides.*; import android.graphics.Color; final float imageScale = 2; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 200, 150, 250, 250); shape.getFillFormat().setFillType(FillType.NoFill); shape.getLineFormat().getFillFormat().setFillType(FillType.NoFill); shape.getTextFrame().setText("3D Text"); IPortion portion = shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0); portion.getPortionFormat().getFillFormat().setFillType(FillType.Pattern); int patternColor = Color.rgb(255, 140, 0); portion.getPortionFormat().getFillFormat().getPatternFormat().getForeColor().setColor(patternColor); portion.getPortionFormat().getFillFormat().getPatternFormat().getBackColor().setColor(Color.WHITE); portion.getPortionFormat().getFillFormat().getPatternFormat().setPatternStyle(PatternStyle.LargeGrid); shape.getTextFrame().getParagraphs().get_Item(0).getParagraphFormat().getDefaultPortionFormat().setFontHeight(128); ITextFrameFormat textFrameFormat = shape.getTextFrame().getTextFrameFormat(); textFrameFormat.setTransform(TextShapeType.ArchUp); textFrameFormat.getThreeDFormat().setExtrusionHeight(3.5f); textFrameFormat.getThreeDFormat().setDepth(3); textFrameFormat.getThreeDFormat().setMaterial(MaterialPresetType.Plastic); textFrameFormat.getThreeDFormat().getLightRig().setDirection(LightingDirection.Top); textFrameFormat.getThreeDFormat().getLightRig().setLightType(LightRigPresetType.Balanced); textFrameFormat.getThreeDFormat().getLightRig().setRotation(0, 0, 40); textFrameFormat.getThreeDFormat().getCamera().setCameraType(CameraPresetType.PerspectiveContrastingRightFacing); IImage thumbnail = slide.getImage(imageScale, imageScale); try { thumbnail.save("text_3d.png", ImageFormat.Png); } finally { thumbnail.dispose(); } presentation.save("text_3d.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The text is rendered as curved, extruded 3D lettering: ![Rendered 3D text with an arched WordArt transform, orange pattern fill, and dark extrusion](https://docs.aspose.com/slides/androidjava/3d-presentation/img_02_05.png) ## **Keep Text Flat on a 3D Shape** To keep text readable while preserving a shape's 3D appearance, call [ITextFrameFormat.setKeepTextFlat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/itextframeformat/#setKeepTextFlat-boolean-) through [ITextFrame.getTextFrameFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/itextframe/#getTextFrameFormat--). When the value is `true`, the text stays out of the 3D scene. When it is `false`, the text participates in the scene and follows its 3D orientation. This setting does not remove the shape's 3D formatting: its camera, lighting, material, and extrusion remain configured through [IShape.getThreeDFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishape/#getThreeDFormat--). It is also different from ordinary rotation. [IShape.setRotation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishape/#setRotation-float-) rotates the shape in the slide plane, while [ITextFrameFormat.setRotationAngle](https://reference.aspose.com/slides/androidjava/com.aspose.slides/itextframeformat/#setRotationAngle-float-) controls the text's custom rotation within its bounding box. Keeping text out of the 3D scene does not reset either of those angles. The following self-contained example creates a blue rectangle with text and clones it beside the original. Both shapes have the same 3D formatting; only the text setting differs: `false` on the left and `true` on the right. The camera angles are in degrees, and the extrusion height is 40 points. The example saves the presentation as PPTX and renders the comparison slide to PNG at twice its default dimensions. ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 70, 160, 240, 140); shape.getTextFrame().setText("Readable text"); shape.getTextFrame().getParagraphs().get_Item(0).getParagraphFormat().getDefaultPortionFormat().setFontHeight(28); shape.getTextFrame().getParagraphs().get_Item(0).getParagraphFormat().setAlignment(TextAlignment.Center); shape.getTextFrame().getTextFrameFormat().setAnchoringType(TextAnchorType.Center); shape.getFillFormat().setFillType(FillType.Solid); shape.getFillFormat().getSolidFillColor().setColor(Color.rgb(100, 149, 237)); shape.getThreeDFormat().getCamera().setCameraType(CameraPresetType.OrthographicFront); shape.getThreeDFormat().getCamera().setRotation(30, 30, 0); shape.getThreeDFormat().getLightRig().setLightType(LightRigPresetType.Flat); shape.getThreeDFormat().getLightRig().setDirection(LightingDirection.Top); shape.getThreeDFormat().setMaterial(MaterialPresetType.Flat); shape.getThreeDFormat().setExtrusionHeight(40); shape.getThreeDFormat().getExtrusionColor().setColor(Color.rgb(65, 105, 225)); shape.getTextFrame().getTextFrameFormat().setKeepTextFlat(false); IAutoShape flatTextShape = (IAutoShape) slide.getShapes().addClone(shape, 400, 160); flatTextShape.getTextFrame().getTextFrameFormat().setKeepTextFlat(true); presentation.save("keep_text_flat.pptx", SaveFormat.Pptx); IImage image = slide.getImage(2, 2); try { image.save("keep_text_flat.png", ImageFormat.Png); } finally { image.dispose(); } } finally { presentation.dispose(); } ``` On the left, the text follows the 3D orientation. On the right, it stays flat and easier to read. Both rectangles retain the same visible extrusion and 3D orientation. ![Side-by-side 3D rectangles: text follows the 3D orientation on the left and stays flat on the right](https://docs.aspose.com/slides/androidjava/3d-presentation/keep_text_flat.png) ## **Export and Rendering Behavior** Aspose.Slides preserves 3D formatting when saving to PowerPoint formats such as PPTX. When rendering or exporting to fixed-layout formats, the 3D scene is rasterized or drawn into the output as a 2D result. This applies when you render slides to [PNG](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-png/), export to [PDF](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-pdf/), export to [HTML](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-html/), or generate frames for [video conversion](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-video/). Keep these points in mind: - Exported images and PDFs are not interactive. The object cannot be rotated by the viewer after export. - The final appearance depends on the combination of camera, light rig, material, extrusion, fill, and slide scaling. - If you need to inspect inherited or theme-based formatting values, read the [effective shape properties](https://docs.aspose.com/slides/androidjava/shape-effective-properties/). - Some output formats cannot store editable PowerPoint 3D formatting. In those formats, the visual result is rendered rather than preserved as editable 3D settings. ## **FAQ** **Can Aspose.Slides create interactive 3D presentations?** Aspose.Slides creates and renders PowerPoint 3D effects for shapes and text. It does not make exported images, PDFs, or HTML pages interactive 3D scenes that a viewer can rotate. In PPTX, the 3D formatting remains editable in PowerPoint where the format supports it. **What is the difference between a 3D model and a 3D effect?** A 3D model is a separate 3D object inserted into a presentation. A 3D effect is formatting applied to a regular PowerPoint shape or text, such as rotation, extrusion, bevel, lighting, and material. This article covers 3D effects. **Which settings are required for a visible 3D shape?** At minimum, set a camera rotation and either extrusion or depth. In practice, also set a light rig and material so the rendered faces have clear highlights and shadows. **Can I apply 3D effects to both shapes and text?** Yes. Use [IShape.getThreeDFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishape/#getThreeDFormat--) for the shape body and [ITextFrameFormat.getThreeDFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/itextframeformat/#getThreeDFormat--) for text. **Will 3D effects appear when exporting to images, PDF, HTML, or video frames?** Yes. Aspose.Slides renders 3D effects when producing slide images, PDF output, HTML output, and frames used for video conversion. The exported output contains the rendered appearance, not an editable 3D object. **Can I read the final 3D values after inheritance and theme settings are applied?** Yes. Use the effective formatting APIs described in [Shape Effective Properties](https://docs.aspose.com/slides/androidjava/shape-effective-properties/) to read final camera, light rig, bevel, and related 3D values. # Access Presentation Slides on Android > Learn how to access and manage slides in PowerPoint and OpenDocument presentations with Aspose.Slides for Android. Boost productivity with Java code examples. Source: https://docs.aspose.com/slides/androidjava/access-slide-in-presentation/ Updated: 2026-08-05 ## **Overview** This article explains how to access and manage slides in a presentation using Aspose.Slides. It shows how to retrieve slides by their zero-based index from the slides collection and how to access a slide by its unique ID using the `getSlideById` method. You will also learn how to change a slide’s position by using the `setSlideNumber` method and how to define the starting slide number for a presentation with the `setFirstSlideNumber` method. The examples demonstrate loading a presentation, getting slide references, updating slide order or numbering, and saving the modified presentation. ## **Access a Slide by Index** All slides in a presentation are arranged numerically based on the slide position starting from 0. The first slide is accessible through index 0; the second slide is accessed through index 1; etc. The Presentation class, representing a presentation file, exposes all slides as an [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/islidecollection/) collection (collection of [ISlide](https://reference.aspose.com/slides/androidjava/com.aspose.slides/islide/) objects). This Java code shows you how to access a slide through its index: ```java import com.aspose.slides.*; // Instantiates a Presentation object that represents a presentation file Presentation pres = new Presentation("demo.pptx"); try { // Accesses a slide using its slide index ISlide slide = pres.getSlides().get_Item(0); } finally { pres.dispose(); } ``` ## **Access a Slide by ID** Each slide in a presentation has a unique ID associated with it. You can use the [getSlideById](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/#getSlideById-long-) method (exposed by the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) class) to target that ID. This Java code shows you how to provide a valid slide ID and access that slide through the [getSlideById](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/#getSlideById-long-) method: ```java import com.aspose.slides.*; // Instantiates a Presentation object that represents a presentation file Presentation pres = new Presentation("demo.pptx"); try { // Gets a slide ID int id = (int) pres.getSlides().get_Item(0).getSlideId(); // Accesses the slide through its ID IBaseSlide slide = pres.getSlideById(id); } finally { pres.dispose(); } ``` ## **Change the Slide Position** Aspose.Slides allow you to change a slide position. For example, you can specify that the first slide should become the second slide. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) class. 1. Get the slide's reference (whose position you want to change) through its index 1. Set a new position for the slide through the [setSlideNumber](https://reference.aspose.com/slides/androidjava/com.aspose.slides/islide/#setSlideNumber-int-) property. 1. Save the modified presentation. This Java code demonstrates an operation in which the slide in position 1 is moved to position 2: ```java import com.aspose.slides.*; // Instantiates a Presentation object that represents a presentation file Presentation pres = new Presentation("Presentation.pptx"); try { // Gets the slide whose position will be changed ISlide sld = pres.getSlides().get_Item(0); // Sets the new position for the slide sld.setSlideNumber(2); // Saves the modified presentation pres.save("helloworld_Pos.pptx", SaveFormat.Pptx); } finally { pres.dispose(); } ``` The first slide became the second; the second slide became the first. When you change a slide's position, other slides are automatically adjusted. ## **Set the Slide Number** Using the [setFirstSlideNumber](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/#setFirstSlideNumber-int-) property (exposed by the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) class), you can specify a new number for the first slide in a presentation. This operation causes other slide numbers to be recalculated. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) class. 1. Get the slide number. 1. Set the slide number. 1. Save the modified presentation. This Java code demonstrates an operation where the first slide number is set to 10: ```java import com.aspose.slides.*; // Instantiates a Presentation object that represents a presentation file Presentation pres = new Presentation("HelloWorld.pptx"); try { // Gets the slide number int firstSlideNumber = pres.getFirstSlideNumber(); // Sets the slide number pres.setFirstSlideNumber(10); // Saves the modified presentation pres.save("Set_Slide_Number_out.pptx", SaveFormat.Pptx); } finally { pres.dispose(); } ``` If you prefer to skip the first slide, you can start the numbering from the second slide (and hide the numbering for the first slide) this way: ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ILayoutSlide layoutSlide = presentation.getLayoutSlides().getByType(SlideLayoutType.Blank); presentation.getSlides().addEmptySlide(layoutSlide); presentation.getSlides().addEmptySlide(layoutSlide); presentation.getSlides().addEmptySlide(layoutSlide); // Sets the number for the first presentation slide presentation.setFirstSlideNumber(0); // Shows slide numbers for all slides presentation.getHeaderFooterManager().setAllSlideNumbersVisibility(true); // Hides the slide number for the first slide presentation.getSlides().get_Item(0).getHeaderFooterManager().setSlideNumberVisibility(false); // Saves the modified presentation presentation.save("output.pptx", SaveFormat.Pptx); } finally { if (presentation != null) presentation.dispose(); } ``` ## **FAQ** ### Does the slide number a user sees match the collection’s zero-based index? The number shown on a slide can start from an arbitrary value (e.g., 10) and does not have to match the index; the relationship is controlled by the presentation’s [first slide number](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/#setFirstSlideNumber-int-) setting. ### Do hidden slides affect indexing? Yes. A hidden slide remains in the collection and is counted in indexing; "hidden" refers to display, not its position in the collection. ### Does a slide’s index change when other slides are added or removed? Yes. Indexes always reflect the current order in slides and are recalculated upon insert, delete, and move operations. # Manage ActiveX Controls in Presentations on Android > Learn how Aspose.Slides for Android via Java leverages ActiveX to automate and enhance PowerPoint presentations, giving developers powerful control over slides. Source: https://docs.aspose.com/slides/androidjava/activex/ Updated: 2026-08-13 ## **Introduction** ActiveX controls are used in presentations. Aspose.Slides for Android via Java allows you to add and manage ActiveX controls, but they are a bit trickier to manage when compared to normal presentation shapes. We implemented support for adding Media Player Active control in Aspose.Slides. Note that ActiveX controls are not shapes; they are not part of the presentation's [IShapeCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishapecollection/). They are part of the separate [IControlCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/icontrolcollection/) instead. In this topic, we will show you how to work with them. ## **Add a Media Player ActiveX Control to a Slide** To add an ActiveX Media Player control, do this: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation) class and generate an empty presentation instance. 1. Access the target slide in [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation). 1. Add the Media Player ActiveX control using the [addControl](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IControlCollection#addControl-int-float-float-float-float-) method exposed by [IControlCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/icontrolcollection/). 1. Access the Media Player ActiveX control and set the video path by using its properties. 1. Save the presentation as a PPTX file. This sample code, based on the steps above, shows to how to add Media Player ActiveX Control to a slide: ```java import com.aspose.slides.*; // Create empty presentation instance Presentation pres = new Presentation(); try { // Adding the Media Player ActiveX control pres.getSlides().get_Item(0).getControls().addControl(ControlType.WindowsMediaPlayer, 100, 100, 400, 400); // Access the Media Player ActiveX control and set the video path pres.getSlides().get_Item(0).getControls().get_Item(0).getProperties().set_Item("URL", "Wildlife.wmv"); // Save the Presentation pres.save("Output.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` ## **Modify an ActiveX Control** Aspose.Slides for Android via Java 7.1.0 and newer versions are equipped with components for managing ActiveX controls. You can access the already added ActiveX control in your presentation and modify or delete it through its properties. To manage a simple ActiveX control like a text box and simple command button on a slide, do this: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation) class and load the presentation with ActiveX controls in it. 1. Obtain a slide reference by its index. 1. Access the ActiveX controls in the slide by accessing the [IControlCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/icontrolcollection/). 1. Access the TextBox1 ActiveX control using the [IControl](https://reference.aspose.com/slides/androidjava/com.aspose.slides/icontrol/) object. 1. Change the properties of the TextBox1 ActiveX control that include text, font, font height, and frame position. 1. Access the second access control called CommandButton1. 1. Change the button caption, font, and position. 1. Shift the position of the ActiveX controls frames. 1. Write the modified presentation to a PPTX file. This sample code, based on the steps above, shows how to manage a simple ActiveX control: ```java import com.aspose.slides.*; import java.awt.FontMetrics; import java.awt.SystemColor; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import javax.imageio.ImageIO; // Accessing the presentation with ActiveX controls Presentation pres = new Presentation("ActiveX.pptm"); try { // Accessing the first slide in presentation ISlide slide = pres.getSlides().get_Item(0); // changing TextBox text IControl control = slide.getControls().get_Item(0); if (control.getName().equalsIgnoreCase("TextBox1") && control.getProperties() != null) { String newText = "Changed text"; control.getProperties().set_Item("Value", newText); // Changing substitute image. PowerPoint will replace this image during activeX activation, // so sometime it's OK to leave image unchanged. BufferedImage image = new BufferedImage((int) control.getFrame().getWidth(), (int) control.getFrame().getHeight(), BufferedImage.TYPE_INT_ARGB); java.awt.Graphics graphics = image.getGraphics(); graphics.setColor(SystemColor.window); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); java.awt.Font font = new java.awt.Font(control.getProperties().get_Item("FontName"), java.awt.Font.PLAIN, 16); graphics.setColor(SystemColor.windowText); graphics.setFont(font); graphics.drawString(newText, 10, 20); graphics.setColor(SystemColor.controlShadow); graphics.drawLine(0, image.getHeight() - 1, 0, 0); graphics.drawLine(0, 0, image.getWidth() - 1, 0); graphics.setColor(SystemColor.controlDkShadow); graphics.drawLine(1, image.getHeight() - 2, 1, 1); graphics.drawLine(1, 1, image.getWidth() - 2, 1); graphics.setColor(SystemColor.controlHighlight); graphics.drawLine(1, image.getHeight() - 1, image.getWidth() - 1, image.getHeight() - 1); graphics.drawLine(image.getWidth() - 1, image.getHeight() - 1, image.getWidth() - 1, 1); graphics.setColor(SystemColor.controlLtHighlight); graphics.drawLine(0, image.getHeight(), image.getWidth(), image.getHeight()); graphics.drawLine(image.getWidth(), image.getHeight(), image.getWidth(), 0); graphics.dispose(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(image, "PNG", baos); control.getSubstitutePictureFormat().getPicture().setImage(pres.getImages().addImage(baos.toByteArray())); } // Changing Button caption control = pres.getSlides().get_Item(0).getControls().get_Item(1); if (control.getName().equalsIgnoreCase("CommandButton1") && control.getProperties() != null) { String newCaption = "Show MessageBox"; control.getProperties().set_Item("Caption", newCaption); // Changing substitute BufferedImage image = new BufferedImage((int) control.getFrame().getWidth(), (int) control.getFrame().getHeight(), BufferedImage.TYPE_INT_ARGB); java.awt.Graphics graphics = image.getGraphics(); graphics.setColor(SystemColor.control); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); java.awt.Font font = new java.awt.Font(control.getProperties().get_Item("FontName"), java.awt.Font.PLAIN, 16); graphics.setColor(SystemColor.windowText); graphics.setFont(font); FontMetrics metrics = graphics.getFontMetrics(font); graphics.drawString(newCaption, (image.getWidth() - metrics.stringWidth(newCaption)) / 2, 20); graphics.setColor(SystemColor.controlLtHighlight); graphics.drawLine(0, image.getHeight() - 1, 0, 0); graphics.drawLine(0, 0, image.getWidth() - 1, 0); graphics.setColor(SystemColor.controlHighlight); graphics.drawLine(1, image.getHeight() - 2, 1, 1); graphics.drawLine(1, 1, image.getWidth() - 2, 1); graphics.setColor(SystemColor.controlShadow); graphics.drawLine(1, image.getHeight() - 1, image.getWidth() - 1, image.getHeight() - 1); graphics.drawLine(image.getWidth() - 1, image.getHeight() - 1, image.getWidth() - 1, 1); graphics.setColor(SystemColor.controlDkShadow); graphics.drawLine(0, image.getHeight(), image.getWidth(), image.getHeight()); graphics.drawLine(image.getWidth(), image.getHeight(), image.getWidth(), 0); graphics.dispose(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(image, "PNG", baos); control.getSubstitutePictureFormat().getPicture().setImage(pres.getImages().addImage(baos.toByteArray())); } // moving 100 points down for (IControl ctl : pres.getSlides().get_Item(0).getControls()) { IShapeFrame frame = ctl.getFrame(); ctl.setFrame(new ShapeFrame(frame.getX(), frame.getY() + 100, frame.getWidth(), frame.getHeight(), frame.getFlipH(), frame.getFlipV(), frame.getRotation())); } pres.save("withActiveX-edited_java.pptm", SaveFormat.Pptm); // removing controls pres.getSlides().get_Item(0).getControls().clear(); pres.save("withActiveX-cleared_java.pptm", SaveFormat.Pptm); } catch (IOException e) { } finally { if (pres != null) pres.dispose(); } ``` ## **FAQ** ### Does Aspose.Slides preserve ActiveX controls when reading and re-saving if they cannot be executed in the Java runtime? Yes. Aspose.Slides treats them as part of the presentation and can read/modify their properties and frames; executing the controls themselves is not required to preserve them. ### How do ActiveX controls differ from OLE objects in a presentation? ActiveX controls are interactive managed controls (buttons, text boxes, media player), whereas [OLE](https://docs.aspose.com/slides/androidjava/manage-ole/) refers to embedded application objects (for example, an Excel worksheet). They are stored and handled differently and have different property models. ### Do ActiveX events and VBA macros work if the file has been modified by Aspose.Slides? Aspose.Slides preserves the existing markup and metadata; however, events and macros run only inside PowerPoint on Windows when security allows it. The library does not execute VBA. ## Related articles - [ActiveX](https://docs.aspose.com/slides/androidjava/examples/elements/activex/) # Add Slides to Presentations on Android > Easily add slides to your PowerPoint and OpenDocument presentations using Aspose.Slides for Android via Java—seamless, efficient slide insertion in seconds. Source: https://docs.aspose.com/slides/androidjava/add-slide-to-presentation/ Updated: 2026-08-05 ## **Overview** Aspose.Slides allows you to add slides to PowerPoint presentations programmatically. A presentation contains master/layout slides and normal slides, and normal slides are arranged by a zero-based index. Each slide has a unique ID, and presentation files without slides are not supported. This article explains how to create a `Presentation` object, access its slide collection, add an empty slide, work with the newly added slide, and save the updated presentation. It also covers related points such as inserting slides at a specific position, using layouts, and understanding the blank slide that exists in a newly created presentation. ## **Add a Slide to a Presentation** Before talking about adding slides to the presentation files, let us discuss some facts about the slides. Each PowerPoint presentation file contains **Master / Layout** slide and other **Normal** slides. It means that a presentation file contains at least one or more slides. It is important to know that presentation files without slides are not supported by Aspose.Slides for Android via Java. Each slide has a unique Id and all the Normal Slides are arranged in an order specified by the zero-based index. Aspose.Slides for Android via Java allows developers to add empty slides to their presentation. To add an empty slide in the presentation, please follow the steps below: - Create an instance of [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation) class. - Instantiate [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection) class by setting a reference to the [Slides](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#getSlides--) (collection of content Slide objects) property exposed by the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation) object. - Add an empty slide to the presentation at the end of the content slides collection by calling the [**addEmptySlide**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addEmptySlide-com.aspose.slides.ILayoutSlide-) methods exposed by [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection) object. - Do some work with the newly added empty slide. - Finally, write the presentation file using the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation) object. ```java import com.aspose.slides.*; // Instantiate Presentation class that represents the presentation file Presentation pres = new Presentation(); try { // Instantiate SlideCollection calss ISlideCollection slds = pres.getSlides(); for (int i = 0; i < pres.getLayoutSlides().size(); i++) { // Add an empty slide to the Slides collection slds.addEmptySlide(pres.getLayoutSlides().get_Item(i)); } // Do some work on the newly added slide // Save the PPTX file to the Disk pres.save("EmptySlide.pptx", SaveFormat.Pptx); } finally { pres.dispose(); } ``` ## **FAQ** ### Can I insert a new slide at a specific position, not just at the end? Yes. The library supports slide collections and [insert](https://reference.aspose.com/slides/androidjava/com.aspose.slides/slidecollection/#insertEmptySlide-int-com.aspose.slides.ILayoutSlide-)/[clone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/slidecollection/#insertClone-int-com.aspose.slides.ISlide-com.aspose.slides.ILayoutSlide-) operations, so you can add a slide at the required index rather than only at the end. ### Are the theme/styles preserved when adding a slide based on a layout? Yes. A layout inherits formatting from its master, and the new slide inherits from the selected layout and its associated master. ### Which slide is present in a new "empty" presentation before adding slides? A newly created presentation already contains one blank slide with index zero. This is important to consider when calculating insertion indices. ### How do I choose the "right" layout for a new slide if the master has many options? Generally choose the [LayoutSlide](https://reference.aspose.com/slides/androidjava/com.aspose.slides/layoutslide/) that matches the required structure ([Title and Content, Two Content, etc.](https://reference.aspose.com/slides/androidjava/com.aspose.slides/slidelayouttype/)). If such a layout is missing, you can [add it to the master](https://docs.aspose.com/slides/androidjava/slide-layout/) and then use it. # AI Features in Aspose.Slides > Explore AI features in Aspose.Slides for Android via Java to generate, analyze, and enhance presentations in Java, with guides for PowerPoint and OpenDocument formats. Source: https://docs.aspose.com/slides/androidjava/ai/ Updated: 2025-09-15 --- lastmod: 2025-09-15T09:30:49+06:00 title: AI Features in Aspose.Slides linktitle: AI type: docs weight: 40 url: /androidjava/ai/ keywords: - AI features - AI presentation translator - AI presentation generator - AI slide translator - AI slide generator - multilingual presentation - multilingual slide - PowerPoint - OpenDocument - presentation - Android - Java - Aspose.Slides description: "Explore AI features in Aspose.Slides for Android via Java to generate, analyze, and enhance presentations in Java, with guides for PowerPoint and OpenDocument formats." --- ## Related articles - [Customize Presentation Charts on Android](https://docs.aspose.com/slides/androidjava/chart-types/) # AI-Powered Presentation Translator > Translate PowerPoint slides with AI using Aspose.Slides for Android via Java. Localize PPT, PPTX and ODP while preserving layout—fast and developer-friendly. Try it. Source: https://docs.aspose.com/slides/androidjava/ai/translator/ Updated: 2026-09-15 ## **Introduction** Aspose.Slides is a powerful API for programmatically managing PowerPoint presentations. In addition to creating, editing, and converting slides, it offers AI-driven features - such as the Presentation Translation API for multilingual slide content. ## **How It Works** Aspose.Slides does not include built-in AI capabilities but integrates with external AI models over the internet. This functionality is exposed via the [SlidesAIAgent](https://reference.aspose.com/slides/androidjava/com.aspose.slides/slidesaiagent/) class, which uses an implementation of the [IAIWebClient](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaiwebclient/) interface to communicate with AI services. You can use the built-in [OpenAIWebClient](https://reference.aspose.com/slides/androidjava/com.aspose.slides/openaiwebclient/) to connect to OpenAI’s API or implement your own [IAIWebClient](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaiwebclient/) to use a different AI provider or language model. Aspose.Slides handles the communication, parses the AI responses, and intelligently inserts translated content while preserving the original slide layout and formatting. Note that the OpenAI API is a paid service, so you will need to create an account and supply your API key when using the built-in [OpenAIWebClient](https://reference.aspose.com/slides/androidjava/com.aspose.slides/openaiwebclient/). ## **Example** In this example, we translate a PowerPoint presentation into Japanese using the built-in [OpenAIWebClient](https://reference.aspose.com/slides/androidjava/com.aspose.slides/openaiwebclient/) with a specified OpenAI [model](https://platform.openai.com/docs/models). ```java import com.aspose.slides.*; // Load a presentation to translate. Presentation presentation = new Presentation("sample.pptx"); // Create an AI client with OpenAIWebClient, specifying your model and API key. OpenAIWebClient aiWebClient = new OpenAIWebClient("gpt-4o-mini", "apiKey", null); try { // Initialize SlidesAIAgent with the AI client. SlidesAIAgent aiAgent = new SlidesAIAgent(aiWebClient); // Translate the presentation to Japanese. aiAgent.translate(presentation, "japanese"); // Save the translated presentation as a PDF. presentation.save("sample_jp.pdf", SaveFormat.Pdf); } finally { aiWebClient.close(); presentation.dispose(); } ``` By default, the built-in [OpenAIWebClient](https://reference.aspose.com/slides/androidjava/com.aspose.slides/openaiwebclient/) creates and manages its own internal [HttpURLConnection](https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html) instance, handling its lifecycle automatically. However, if you prefer to manage the [HttpURLConnection](https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html) yourself — primarily to configure essential settings like a proxy, or to use a [URLStreamHandlerFactory](https://docs.oracle.com/javase/8/docs/api/java/net/URLStreamHandlerFactory.html) or a different [HttpClient](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html) for better resource management and performance — you can provide your own `HttpURLConnection` instance when constructing the [OpenAIWebClient](https://reference.aspose.com/slides/androidjava/com.aspose.slides/openaiwebclient/). ```java import com.aspose.slides.*; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URI; try { // Configure an HttpURLConnection instance yourself (e.g., with custom timeouts, proxy settings, etc.). HttpURLConnection urlConnection = (HttpURLConnection) URI.create("https://api.openai.com/v1/chat/completions").toURL().openConnection(); urlConnection.setConnectTimeout(10000); urlConnection.setReadTimeout(60000); // Pass the connection to the OpenAIWebClient constructor. OpenAIWebClient aiWebClient = new OpenAIWebClient("gpt-4o-mini", "apiKey", null, urlConnection); } catch (IOException e) { e.printStackTrace(); } ``` ### **Azure OpenAI Example** You can configure the translator to use your Azure OpenAI deployment with the [OpenAICompatibleWebClient](https://reference.aspose.com/slides/androidjava/com.aspose.slides/openaicompatiblewebclient/). ```java import com.aspose.slides.*; String model = "your-azure-deployment-name"; String apiKey = "your-azure-api-key"; String baseUrl = "https://your-resource.openai.azure.com/openai/v1/"; OpenAICompatibleWebClient aiWebClient = new OpenAICompatibleWebClient(model, apiKey, baseUrl); try { SlidesAIAgent aiAgent = new SlidesAIAgent(aiWebClient); Presentation presentation = new Presentation("Presentation.pptx"); try { aiAgent.translate(presentation, "spanish"); presentation.save("Translated.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } } finally { aiWebClient.dispose(); } ``` This snippet demonstrates translating a presentation using your Azure OpenAI endpoint. Replace the placeholder values with your deployment name, API key, and endpoint URL. ## **Key Benefits** The Aspose.Slides Presentation Translation API offers an AI-powered solution for delivering multilingual PowerPoint presentations. By automating translation while preserving layout and design, it saves time and minimizes errors compared to manual workflows. Whether you're a developer, educator, or business professional, this API enables you to create engaging, localized presentations for global audiences - expanding your reach and improving communication. # Animate PowerPoint Charts on Android > Create stunning animated charts in Java with Aspose.Slides for Android. Boost presentations with dynamic visuals in PPT and PPTX files—get started now. Source: https://docs.aspose.com/slides/androidjava/animated-charts/ Updated: 2026-11-08 ## **Introduction** Aspose.Slides for Android via Java supports animating the chart elements. **Series**, **Categories**, **Series Elements**, **Categories Elements** can be animated with [ISequence.addEffect](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISequence#addEffect-com.aspose.slides.IChart-int-int-int-int-int-) method and two enums [EffectChartMajorGroupingType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/EffectChartMajorGroupingType) and [EffectChartMinorGroupingType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/EffectChartMinorGroupingType). [![Two-series, two-category grids compare grouping by series, category, element within series, and element within category.](https://docs.aspose.com/slides/androidjava/animated-charts/visual-chart-animation-grouping-51704783a7c6.svg)](https://docs.aspose.com/slides/androidjava/animated-charts/visual-chart-animation-grouping-51704783a7c6.svg) *Schematic comparison using two series and two categories. Numbers identify illustrative reveal steps, not data values: grouping selects which marks animate together. Actual order and triggers depend on the effects added to the sequence.* ## **Chart Series Animation** If you want to animate a chart series, write the code according to the steps listed below: 1. Load a presentation. 1. Get reference of the chart object. 1. Animate the series. 1. Write the presentation file to disk. In the example given below, we animated chart series. ```java import com.aspose.slides.*; // Instantiate Presentation class that represents a presentation file Presentation pres = new Presentation("ExistingChart.pptx"); try { // Get reference of the chart object ISlide slide = pres.getSlides().get_Item(0); IShapeCollection shapes = slide.getShapes(); IChart chart = (IChart) shapes.get_Item(0); // Animate the series slide.getTimeline().getMainSequence().addEffect(chart, EffectType.Fade, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMajorGroupingType.BySeries, 0, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMajorGroupingType.BySeries, 1, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMajorGroupingType.BySeries, 2, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMajorGroupingType.BySeries, 3, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); // Write the modified presentation to disk pres.save("AnimatingSeries_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` ## **Chart Category Animation** If you want to animate a chart category, write the code according to the steps listed below: 1. Load a presentation. 1. Get reference of the chart object. 1. Animate the Category. 1. Write the presentation file to disk. In the example given below, we animated chart category. ```java import com.aspose.slides.*; // Instantiate Presentation class that represents a presentation file Presentation pres = new Presentation("ExistingChart.pptx"); try { ISlide slide = pres.getSlides().get_Item(0); IShapeCollection shapes = slide.getShapes(); IChart chart = (IChart) shapes.get_Item(0); slide.getTimeline().getMainSequence().addEffect(chart, EffectType.Fade, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence) slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMajorGroupingType.ByCategory, 0, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence) slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMajorGroupingType.ByCategory, 1, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence) slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMajorGroupingType.ByCategory, 2, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence) slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMajorGroupingType.ByCategory, 3, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); pres.save("Sample_Animation_C.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` ## **Animation in a Series Element** If you want to animate series elements, write the code according to the steps listed below: 1. Load a presentation. 1. Get reference of the chart object. 1. Animate series elements. 1. Write the presentation file to disk. In the example given below, we have animated series' elements. ```java import com.aspose.slides.*; // Instantiate Presentation class that represents a presentation file Presentation pres = new Presentation("ExistingChart.pptx"); try { // Get reference of the chart object ISlide slide = pres.getSlides().get_Item(0); IShapeCollection shapes = slide.getShapes(); IChart chart = (IChart) shapes.get_Item(0); // Animate series elements slide.getTimeline().getMainSequence().addEffect(chart, EffectType.Fade, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 0, 0, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 0, 1, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 0, 2, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 0, 3, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 1, 0, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 1, 1, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 1, 2, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 1, 3, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 2, 0, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 2, 1, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 2, 2, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInSeries, 2, 3, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); // Write the presentation file to disk pres.save("AnimatingSeriesElements_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` ## **Animation in a Category Element** If you want to animate categories elements, write the code according to the steps listed below: 1. Load a presentation. 1. Get reference of the chart object. 1. Animate categories elements. 1. Write the presentation file to disk. In the example given below, we have animated categories elements. ```java import com.aspose.slides.*; // Instantiate Presentation class that represents a presentation file Presentation pres = new Presentation("ExistingChart.pptx"); try { // Get reference of the chart object ISlide slide = pres.getSlides().get_Item(0); IShapeCollection shapes = slide.getShapes(); IChart chart = (IChart) shapes.get_Item(0); // Animate categories' elements slide.getTimeline().getMainSequence().addEffect(chart, EffectType.Fade, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 0, 0, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 0, 1, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 0, 2, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 0, 3, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 1, 0, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 1, 1, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 1, 2, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 1, 3, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 2, 0, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 2, 1, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 2, 2, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); ((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart, EffectChartMinorGroupingType.ByElementInCategory, 2, 3, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious); // Write the presentation file to disk pres.save("AnimatingCategoriesElements_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` ## **FAQ** ### Are different effect types (e.g., entrance, emphasis, exit) supported for charts like for regular shapes? Yes. A chart is treated as a shape, so it supports the standard animation effect types, including entrance, emphasis, and exit, with full control via the slide's timeline and animation sequences. ### Can I combine chart animation with slide transitions? Yes. [Transitions](https://docs.aspose.com/slides/androidjava/slide-transition/) apply to the slide, while animation effects apply to objects on the slide. You can use both together in the same presentation and control them independently. ### Are chart animations preserved when saving to PPTX? Yes. When you [save to PPTX](https://docs.aspose.com/slides/androidjava/save-presentation/), all animation effects and their ordering are preserved because they are part of the presentation's native animation model. ### Can I read existing chart animations from a presentation and modify them? Yes. The API provides access to the slide timeline, sequences, and effects, allowing you to inspect existing chart animations and adjust them without recreating everything from scratch. ### Can I produce a video that includes chart animations using Aspose.Slides? Yes. You can [export a presentation to video](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-video/) while preserving animations, configuring timings and other export settings so the resulting clip reflects the animated playback. ## Related articles - [Animate PowerPoint Text on Android](https://docs.aspose.com/slides/androidjava/animated-text/) - [Enhance PowerPoint Presentations with Animations on Android](https://docs.aspose.com/slides/androidjava/powerpoint-animation/) # Animate PowerPoint Text on Android > Create dynamic animated text in PowerPoint and OpenDocument presentations using Aspose.Slides for Android, with easy-to-follow, optimized Java code examples. Source: https://docs.aspose.com/slides/androidjava/animated-text/ Updated: 2026-08-05 ## **Overview** This article explains how to work with animated text in Aspose.Slides by applying animation effects to individual paragraphs and retrieving the effects already assigned to paragraphs in a text frame. It focuses on the API methods used to add paragraph-level animation and inspect existing paragraph animation effects in a presentation. ## **Add Animation Effects to Paragraphs** We added the [**addEffect()**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Sequence#addEffect-com.aspose.slides.IParagraph-int-int-int-) method to the [**Sequence**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Sequence) and [**ISequence**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISequence) classes. This method allows you to add animation effects to a single paragraph. This sample code shows you how to add an animation effect to a single paragraph: ```java import com.aspose.slides.*; Presentation presentation = new Presentation("Presentation.pptx"); try { // select paragraph to add effect IAutoShape autoShape = (IAutoShape)presentation.getSlides().get_Item(0).getShapes().get_Item(0); IParagraph paragraph = autoShape.getTextFrame().getParagraphs().get_Item(0); // add Fly animation effect to selected paragraph IEffect effect = presentation.getSlides().get_Item(0).getTimeline().getMainSequence(). addEffect(paragraph, EffectType.Fly, EffectSubtype.Left, EffectTriggerType.OnClick); presentation.save("AnimationEffectinParagraph.pptx", SaveFormat.Pptx); } finally { if (presentation != null) presentation.dispose(); } ``` ## **Get Animation Effects of Paragraphs** You may decide to find out the animation effects added to a paragraph—for example, in one scenario, you want to get the animation effects in a paragraph because you plan to apply those effects to another paragraph or shape. Aspose.Slides for Android via Java allows you to get all the animation effects applied to paragraphs contained in a text frame (shape). This sample code shows you how to get the animation effects in a paragraph: ```java import com.aspose.slides.*; Presentation pres = new Presentation("Presentation.pptx"); try { ISequence sequence = pres.getSlides().get_Item(0).getTimeline().getMainSequence(); IAutoShape autoShape = (IAutoShape)pres.getSlides().get_Item(0).getShapes().get_Item(0); for (IParagraph paragraph : autoShape.getTextFrame().getParagraphs()) { IEffect[] effects = sequence.getEffectsByParagraph(paragraph); if (effects.length > 0) System.out.println("Paragraph \"" + paragraph.getText() + "\" has " + effects[0].getType() + " effect."); } } finally { pres.dispose(); } ``` ## **FAQ** ### How do text animations differ from slide transitions, and can they be combined? Text animations control object behavior over time on a slide, while [transitions](https://docs.aspose.com/slides/androidjava/slide-transition/) control how slides change. They’re independent and can be used together; playback order is governed by the animation timeline and the transition settings. ### Are text animations preserved when exporting to PDF or images? No. PDF and raster images are static, so you’ll see a single state of the slide without motion. To keep movement, use [video](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-video/) or [HTML](https://docs.aspose.com/slides/androidjava/export-to-html5/) export. ### Do text animations work in layouts and the slide master? Effects applied to layout/master objects are inherited by slides, but their timing and interaction with slide-level animations depend on the final sequence on the slide. ## Related articles - [Animation](https://docs.aspose.com/slides/androidjava/examples/elements/animation/) - [Animate PowerPoint Charts on Android](https://docs.aspose.com/slides/androidjava/animated-charts/) - [Enhance PowerPoint Presentations with Animations on Android](https://docs.aspose.com/slides/androidjava/powerpoint-animation/) # API Limitations > Know Aspose.Slides for Android limits: exports set fixed Application/Producer metadata in PPT, PPTX, ODP, and PDF—helping you plan integrations without surprises. Source: https://docs.aspose.com/slides/androidjava/api-limitations/ Updated: 2026-06-01 ## **Overview** When presentations are created or exported with Aspose.Slides, certain technical metadata is written to the output file. This article explains the limitations related to the `Application`, `Creator`, and `Producer` metadata fields in PPTX and PDF files. ## **Application and Producer** When you create or export presentations with Aspose.Slides for Android via Java, some technical metadata is written into the file. Two fields often raise questions: **Application** identifies the program that created or last saved a **PPTX** presentation. In Aspose.Slides for Android via Java, this value is fixed and shows the library vendor rather than your app name, even if you use [DocumentProperties.setNameOfApplication](https://reference.aspose.com/slides/androidjava/com.aspose.slides/documentproperties/#setNameOfApplication-java.lang.String-). **Producer** identifies the rendering engine that generated the final file during export. In **PDF** exports, metadata uses **Creator** and **Producer** fields. With Aspose.Slides for Android via Java, both of these are fixed and reflect the library and its version. **What’s restricted** You cannot override these fields through the API for the formats above. For **PPTX**, the Application property is written as "Aspose.Slides for Android via Java". For **PDF**, the Creator and Producer properties are written as "Aspose.Slides for Android via Java x.x.x." This behavior is by design and applies regardless of how you load or save the file, and regardless of values assigned using [DocumentProperties.setNameOfApplication](https://reference.aspose.com/slides/androidjava/com.aspose.slides/documentproperties/#setNameOfApplication-java.lang.String-). # API Reference > Create, edit, and convert presentations in Java—no PowerPoint needed. Aspose.Slides for Android supports PPT, PPTX, and ODP with fast SVG/PDF export. Source: https://docs.aspose.com/slides/androidjava/api-reference/ Updated: 2026-08-13 Aspose.Slides for Android via Java is a class library that enables Java applications for Android to read and write presentation documents without using Microsoft PowerPoint® or other software. Aspose.Slides for Android via Java allows you to manage text, shapes, tables, and animations; add audio and video to slides; preview slides; and export slides to SVG, PDF format, and more. Latest API Reference can be found at [Aspose.Slides for Android via Java API Reference](https://reference.aspose.com/slides/androidjava/). ## Related articles - [Aspose.Slides for Android via Java](https://docs.aspose.com/slides/androidjava/) - [Convert PowerPoint Presentations on Android | HTML, PNG, PDF, Word, TIFF](https://docs.aspose.com/slides/androidjava/convert-powerpoint/) # Restrict Presentation Edits with Shape Locks on Android > Learn how to lock and unlock shapes in PPTX presentations with Aspose.Slides for Android via Java to restrict selection, movement, resizing, and grouping. Source: https://docs.aspose.com/slides/androidjava/applying-protection-to-presentation/ Updated: 2026-10-20 ## **Overview** A common use for Aspose.Slides for Android via Java is to create, update, and save PowerPoint (PPTX) presentations as part of an automated workflow. When users receive these presentations, restricting changes to shapes can help preserve the intended layout and content. This article explains how shapes are organized on slides and how to apply and remove shape locks in a PPTX presentation. These locks let you restrict specific editing operations on individual shapes. ## **Composition of a Slide** A presentation slide is composed of components such as autoshapes, tables, OLE objects, grouped shapes, picture frames, video frames, connectors, and other elements used to build a presentation. In Aspose.Slides for Android via Java, each element on a slide is represented by an object that implements the [IShape](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishape/) interface or inherits from a class that does. Different shape types expose different locking options. The [IBaseShapeLock](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ibaseshapelock/) interface is the base interface for shape locks. Aspose.Slides for Android via Java provides the following lock interfaces: - [IAutoShapeLock](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iautoshapelock/) locks autoshapes. - [IConnectorLock](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iconnectorlock/) locks connector shapes. - [IGraphicalObjectLock](https://reference.aspose.com/slides/androidjava/com.aspose.slides/igraphicalobjectlock/) locks graphical objects. - [IGroupShapeLock](https://reference.aspose.com/slides/androidjava/com.aspose.slides/igroupshapelock/) locks group shapes. - [IPictureFrameLock](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ipictureframelock/) locks picture frames. To apply locks across a [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/), iterate through its slides and set the appropriate locks on each supported shape. ## **Apply and Remove Protection** Shape locks restrict operations such as selecting, moving, and resizing shapes. They do not make the entire presentation uneditable. ### **Apply Protection to PPTX Shapes** Aspose.Slides for Android via Java provides the [IShape](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishape/) interface to work with shapes on a slide. The example calls [setSelectLocked](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iautoshapelock/#setSelectLocked-boolean-), [setPositionLocked](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iautoshapelock/#setPositionLocked-boolean-), and [setSizeLocked](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iautoshapelock/#setSizeLocked-boolean-) with `true` for autoshapes, with equivalent locks for group shapes, connectors, and picture frames. Connectors use [setPositionMove](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iconnectorlock/#setPositionMove-boolean-) for movement; groups also use [setGroupingLocked](https://reference.aspose.com/slides/androidjava/com.aspose.slides/igroupshapelock/#setGroupingLocked-boolean-) to restrict grouping. The example loads an existing PPTX presentation, checks the shapes in each slide's shape collection, and saves a copy with these restrictions applied. Shapes outside the four handled types are left unchanged. The loop does not traverse the child shapes inside a group. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("Sample.pptx"); try { for (ISlide slide : presentation.getSlides()) { for (IShape shape : slide.getShapes()) { if (shape instanceof IAutoShape) { IAutoShape autoShape = (IAutoShape) shape; IAutoShapeLock autoShapeLock = (IAutoShapeLock) autoShape.getShapeLock(); autoShapeLock.setPositionLocked(true); autoShapeLock.setSelectLocked(true); autoShapeLock.setSizeLocked(true); } else if (shape instanceof IGroupShape) { IGroupShape groupShape = (IGroupShape) shape; IGroupShapeLock groupShapeLock = (IGroupShapeLock) groupShape.getShapeLock(); groupShapeLock.setGroupingLocked(true); groupShapeLock.setPositionLocked(true); groupShapeLock.setSelectLocked(true); groupShapeLock.setSizeLocked(true); } else if (shape instanceof IConnector) { IConnector connectorShape = (IConnector) shape; IConnectorLock connectorShapeLock = connectorShape.getShapeLock(); connectorShapeLock.setPositionMove(true); connectorShapeLock.setSelectLocked(true); connectorShapeLock.setSizeLocked(true); } else if (shape instanceof IPictureFrame) { IPictureFrame pictureFrame = (IPictureFrame) shape; IPictureFrameLock pictureFrameLock = (IPictureFrameLock) pictureFrame.getShapeLock(); pictureFrameLock.setPositionLocked(true); pictureFrameLock.setSelectLocked(true); pictureFrameLock.setSizeLocked(true); } } } presentation.save("ProtectedSample.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ### **Remove Protection** To remove a shape lock, set its value to `false`. The following example loads a presentation with shape locks and clears the selection, movement, and resizing restrictions through [IAutoShapeLock](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iautoshapelock/), [IGroupShapeLock](https://reference.aspose.com/slides/androidjava/com.aspose.slides/igroupshapelock/), [IConnectorLock](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iconnectorlock/), and [IPictureFrameLock](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ipictureframelock/). It also removes the grouping restriction by passing `false` to [IGroupShapeLock.setGroupingLocked](https://reference.aspose.com/slides/androidjava/com.aspose.slides/igroupshapelock/#setGroupingLocked-boolean-) and saves a copy of the presentation. Other lock settings are left unchanged. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("ProtectedSample.pptx"); try { for (ISlide slide : presentation.getSlides()) { for (IShape shape : slide.getShapes()) { if (shape instanceof IAutoShape) { IAutoShape autoShape = (IAutoShape) shape; IAutoShapeLock autoShapeLock = (IAutoShapeLock) autoShape.getShapeLock(); autoShapeLock.setPositionLocked(false); autoShapeLock.setSelectLocked(false); autoShapeLock.setSizeLocked(false); } else if (shape instanceof IGroupShape) { IGroupShape groupShape = (IGroupShape) shape; IGroupShapeLock groupShapeLock = (IGroupShapeLock) groupShape.getShapeLock(); groupShapeLock.setGroupingLocked(false); groupShapeLock.setPositionLocked(false); groupShapeLock.setSelectLocked(false); groupShapeLock.setSizeLocked(false); } else if (shape instanceof IConnector) { IConnector connectorShape = (IConnector) shape; IConnectorLock connectorShapeLock = connectorShape.getShapeLock(); connectorShapeLock.setPositionMove(false); connectorShapeLock.setSelectLocked(false); connectorShapeLock.setSizeLocked(false); } else if (shape instanceof IPictureFrame) { IPictureFrame pictureFrame = (IPictureFrame) shape; IPictureFrameLock pictureFrameLock = (IPictureFrameLock) pictureFrame.getShapeLock(); pictureFrameLock.setPositionLocked(false); pictureFrameLock.setSelectLocked(false); pictureFrameLock.setSizeLocked(false); } } } presentation.save("RemovedProtectionSample.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ### **Conclusion** Aspose.Slides for Android via Java lets you restrict specific editing operations on individual shapes or apply the same restrictions across slides. Choose the locks supported by each shape type, and set their values to `false` when you need to remove those restrictions. ## **FAQ** **Can I combine shape locks and password protection in the same presentation?** Yes. Shape locks restrict specific editing operations, while [password protection](https://docs.aspose.com/slides/androidjava/password-protected-presentation/) can restrict opening or modifying the presentation. You can use both in the same file. **Can I restrict editing on specific slides without affecting others?** Yes. Apply locks only to shapes on the selected slides. This does not change the lock settings on other slides. **How can I apply locks to individual shapes inside a group?** Iterate through the collection returned by the group's [getShapes](https://reference.aspose.com/slides/androidjava/com.aspose.slides/igroupshape/#getShapes--) method and apply the appropriate locks to each child shape. Repeat this for any nested groups. The examples above process only the slide's shape collection, so they do not set locks on individual group members. # Aspose.Slides for Android via Java Features > Explore Aspose.Slides for Android via Java features compared to Aspose.Slides for Java, including support for PPT, PPTX and ODP, conversions and rendering. Source: https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/ Updated: 2026-08-13 This section lists all the features of the API and shows the comparative availability of these in Aspose.Slides for Java vs. Aspose.Slides for Android via Java. |**S.No.**|**Feature**|**Aspose.Slides for Java**|**Aspose.Slides for Android via Java**| | :-: | :-: | :-: | :-: | |1|Working with Microsoft PowerPoint (PPT)|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |2|Working PresentationML (PPTX, XML)|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |3|Support for PPT to PPTX conversion|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |4|Support for Portable Document Format (PDF)|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |5|Support for XML Parser Specification (XPS)|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |6|Support for Tagged Image File Format (TIFF)|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |7|Support for ODP to PPTX Conversion|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |8|Support for Presentation To HTML Conversion|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |9|Support for exporting to SVG Format|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |10|Support for Slide Thumbnails|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |11|Support for Master Slides|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |12|Support for Normal Slides|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |13|Support for Notes Slides|

 

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |14|Support for Layout Slides|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |15|Support for slides Cloning|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |16|Support for working with  Place Holders and Text Holders|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |17|Support for Slide AutoShapes|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |18|Support for Tables|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |19|Support for SmartArt|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |20|Support for Ole Objects|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |21|Support for ActiveX Object|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |22|Support for Group Shapes|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |23|Support for Video Frame|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |24|Support for Audio Frame|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |25|Support for Picture Frame|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |26|Support for Charts|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |27|Support for VBA Macros|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| |28|Support for Animations|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

| |29|Support for Slide Transitions|

![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)

 

|![todo:image_alt_text](https://docs.aspose.com/slides/androidjava/aspose-slides-for-android-via-java-features/aspose-slides-for-android-via-java-features_1.gif)| # Manage Audio in Presentations on Android > Create and control audio frames in Aspose.Slides for Android—Java examples to embed, trim, loop, and configure playback across PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/androidjava/audio-frame/ Updated: 2026-08-05 ## **Overview** This article explains how to work with audio frames in Aspose.Slides. It shows how to add embedded audio to slides, customize the audio frame thumbnail, configure playback options such as volume, looping, hiding, trimming, and fade durations, and extract audio used in slide show transitions. ## **Create Audio Frames** Aspose.Slides for Android via Java allows you to add audio files to slides. The audio files are embedded in slides as audio frames. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class. 2. Get a slide's reference through its index. 3. Load the audio file stream you want to embed in the slide. 4. Add the embedded audio frame (containing the audio file) to the slide. 5. Set [PlayMode](https://reference.aspose.com/slides/androidjava/com.aspose.slides/AudioPlayModePreset) and `Volume` exposed by the [IAudioFrame](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IAudioFrame) object. 6. Save the modified presentation. This Java code shows you how to add an embedded audio frame to a slide: ```java import com.aspose.slides.*; import java.io.File; import java.io.FileInputStream; import java.io.IOException; // Instantiates a Presentation class that represents a presentation file Presentation pres = new Presentation(); try { // Gets the first slide ISlide sld = pres.getSlides().get_Item(0); // Loads the wav sound file to stream FileInputStream fstr = new FileInputStream(new File("audio.wav")); // Adds the Audio Frame IAudioFrame audioFrame = sld.getShapes().addAudioFrameEmbedded(50, 150, 100, 100, fstr); fstr.close(); // Sets the Play Mode and Volume of the Audio audioFrame.setPlayMode(AudioPlayModePreset.Auto); audioFrame.setVolume(AudioVolumeMode.Loud); // Writes the PowerPoint file to disk pres.save("AudioFrameEmbed_out.pptx", SaveFormat.Pptx); } catch(IOException e) { } finally { if (pres != null) pres.dispose(); } ``` ## **Change the Audio Frame Thumbnail** When you add an audio file to a presentation, the audio appears as a frame with a standard default image (see the image in the section below). You change the audio frame's preview image (set your preferred image). This Java code shows you how to change an audio frame's thumbnail or preview image: ```java import com.aspose.slides.*; import java.io.FileInputStream; import java.io.IOException; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); // Adds an audio frame to the slide with a specified position and size. FileInputStream audioStream = new FileInputStream("sample2.mp3"); IAudioFrame audioFrame = slide.getShapes().addAudioFrameEmbedded(150, 100, 50, 50, audioStream); audioStream.close(); // Adds an image to presentation resources. IPPImage picture; IImage image = Images.fromFile("eagle.jpeg"); try { picture = presentation.getImages().addImage(image); } finally { if (image != null) image.dispose(); } // Sets the image for the audio frame. audioFrame.getPictureFormat().getPicture().setImage(picture); // <----- //Saves the modified presentation to disk presentation.save("example_out.pptx", SaveFormat.Pptx); } catch(IOException e) { } finally { if (presentation != null) presentation.dispose(); } ``` ## **Change Audio Play Options** Aspose.Slides for Android via Java allows you to change options that control an audio's playback or properties. For example, you can adjust an audio's volume, set the audio to play looped, or even hide the audio icon. The **Audio Options** pane in Microsoft PowerPoint: ![example1_image](https://docs.aspose.com/slides/androidjava/audio-frame/audio_frame_0.png) PowerPoint **Audio Options** that correspond to Aspose.Slides [AudioFrame](https://reference.aspose.com/slides/androidjava/com.aspose.slides/AudioFrame) properties: - **Start** drop-down list matches the [AudioFrame.PlayMode](https://reference.aspose.com/slides/androidjava/com.aspose.slides/AudioFrame#getPlayMode--) property - **Volume** matches the [AudioFrame.Volume](https://reference.aspose.com/slides/androidjava/com.aspose.slides/AudioFrame#getVolume--) property - **Play Across Slides** matches the [AudioFrame.PlayAcrossSlides](https://reference.aspose.com/slides/androidjava/com.aspose.slides/AudioFrame#getPlayAcrossSlides--) property - **Loop until Stopped** matches the [AudioFrame.PlayLoopMode](https://reference.aspose.com/slides/androidjava/com.aspose.slides/AudioFrame#getPlayLoopMode--) property - **Hide During Show** matches the [AudioFrame.HideAtShowing](https://reference.aspose.com/slides/androidjava/com.aspose.slides/AudioFrame#getHideAtShowing--) property - **Rewind after Playing** matches the [AudioFrame.RewindAudio](https://reference.aspose.com/slides/androidjava/com.aspose.slides/AudioFrame#getRewindAudio--) property PowerPoint **Editing** options that correspond to Aspose.Slides [AudioFrame](https://reference.aspose.com/slides/androidjava/com.aspose.slides/audioframe/) properties: - **Fade In** matches the [AudioFrame.FadeInDuration](https://reference.aspose.com/slides/androidjava/com.aspose.slides/audioframe/#getFadeInDuration--) property - **Fade Out** matches the [AudioFrame.FadeOutDuration](https://reference.aspose.com/slides/androidjava/com.aspose.slides/audioframe/#getFadeOutDuration--) property - **Trim Audio Start Time** matches the [AudioFrame.TrimFromStart](https://reference.aspose.com/slides/androidjava/com.aspose.slides/audioframe/#getTrimFromStart--) property - **Trim Audio End Time** value equals the audio duration minus the value of [AudioFrame.TrimFromEnd](https://reference.aspose.com/slides/androidjava/com.aspose.slides/audioframe/#getTrimFromEnd--) property The PowerPoint **Volume controll** on the audio control panel corresponds to the [AudioFrame.VolumeValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/audioframe/#getVolumeValue--) property. It lets you change the audio volume as a percentage. This is how you change the Audio Play options: 1. [Сreate](https://docs.aspose.com/slides/androidjava/audio-frame/#create-audio-frame) or get the Audio Frame. 2. Set new values for the Audio Frame properties you want to adjust. 3. Save the modified PowerPoint file. This Java code demonstrates an operation in which an audio's options are adjusted: ```java import com.aspose.slides.*; Presentation pres = new Presentation("AudioFrameEmbed_out.pptx"); try { // Gets the AudioFrame shape AudioFrame audioFrame = (AudioFrame)pres.getSlides().get_Item(0).getShapes().get_Item(0); // Sets the Play mode to play on click audioFrame.setPlayMode(AudioPlayModePreset.OnClick); // Sets the volume to Low audioFrame.setVolume(AudioVolumeMode.Low); // Sets the audio to play across slides audioFrame.setPlayAcrossSlides(true); // Disables loop for the audio audioFrame.setPlayLoopMode(false); // Hides the AudioFrame during the slide show audioFrame.setHideAtShowing(true); // Rewinds the audio to start after playing audioFrame.setRewindAudio(true); // Saves the PowerPoint file to disk pres.save("AudioFrameEmbed_changed.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` This Java example shows how to add a new audio frame with embedded audio, trim it, and set the fade durations: ```java import com.aspose.slides.*; import java.io.FileInputStream; Presentation pres = new Presentation(); try { ISlide slide = pres.getSlides().get_Item(0); FileInputStream audioData = new FileInputStream("sampleaudio.mp3"); IAudio audio = pres.getAudios().addAudio(audioData, LoadingStreamBehavior.KeepLocked); IAudioFrame audioFrame = slide.getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio); // Sets the trimming start offset to 1.5 seconds audioFrame.setTrimFromStart(1500f); // Sets the trimming end offset to 2 seconds audioFrame.setTrimFromEnd(2000f); // Sets the fade-in duration to 200 ms audioFrame.setFadeInDuration(200f); // Sets the fade-out duration to 500 ms audioFrame.setFadeOutDuration(500f); pres.save("AudioFrameTrimFade_out.pptx", SaveFormat.Pptx); } finally { pres.dispose(); } ``` The following code sample shows how to retrieve an audio frame with embedded audio and set its volume to 85%: ```java import com.aspose.slides.*; Presentation pres = new Presentation("AudioFrameEmbed_out.pptx"); try { ISlide slide = pres.getSlides().get_Item(0); // Gets an audio frame shape IAudioFrame audioFrame = (IAudioFrame)slide.getShapes().get_Item(0); // Sets the audio volume to 85% audioFrame.setVolumeValue(85f); pres.save("AudioFrameValue_out.pptx", SaveFormat.Pptx); } finally { pres.dispose(); } ``` ## **Manage Audio Captions** Aspose.Slides allows you to add closed captions to an audio frame through the [getCaptionTracks](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaudioframe/#getCaptionTracks--) method. This method returns an [ICaptionsCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/icaptionscollection/), which lets you add WebVTT caption tracks, iterate through existing tracks, and remove them when necessary. **Add Audio Captions** Use the [getCaptionTracks](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaudioframe/#getCaptionTracks--) method to attach one or more caption tracks to an audio frame. In the following example, an audio file is added to a slide, and then a new caption track is loaded from a `.vtt` file. ```java import com.aspose.slides.*; import java.nio.file.Files; import java.nio.file.Paths; Presentation presentation = new Presentation(); try { byte[] audioData = Files.readAllBytes(Paths.get("audio.mp3")); IAudio audio = presentation.getAudios().addAudio(audioData); ISlide slide = presentation.getSlides().get_Item(0); IAudioFrame audioFrame = slide.getShapes().addAudioFrameEmbedded(10, 10, 50, 50, audio); // Add a new caption track from a WebVTT file. audioFrame.getCaptionTracks().add("New track", "track.vtt"); presentation.save("audio_with_captions.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` **Extract Audio Captions** You can iterate through the caption tracks associated with an audio frame and save them as `.vtt` files. Each caption track exposes its binary data and unique identifier, which can be used when exporting captions. ```java import com.aspose.slides.*; import java.io.FileOutputStream; import java.io.IOException; Presentation presentation = new Presentation("audio_with_captions.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); for (IShape shape : slide.getShapes()) { if (shape instanceof IAudioFrame) { IAudioFrame audioFrame = (IAudioFrame) shape; for (ICaptions captionTrack : audioFrame.getCaptionTracks()) { // Save the caption track as a .vtt file. FileOutputStream fos = new FileOutputStream(captionTrack.getCaptionId() + ".vtt"); fos.write(captionTrack.getBinaryData()); fos.close(); } } } } catch (IOException e){ } finally { presentation.dispose(); } ``` **Remove Audio Captions** To remove captions from an audio frame, use the methods provided by [ICaptionsCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/icaptionscollection/), such as [clear](https://reference.aspose.com/slides/androidjava/com.aspose.slides/icaptionscollection/#clear--), [remove](https://reference.aspose.com/slides/androidjava/com.aspose.slides/icaptionscollection/#remove-com.aspose.slides.ICaptions-), or [removeAt](https://reference.aspose.com/slides/androidjava/com.aspose.slides/icaptionscollection/#removeAt-int-). The following example removes all caption tracks from an audio frame. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("audio_with_captions.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); IAudioFrame audioFrame = (IAudioFrame) slide.getShapes().get_Item(0); // Remove all caption tracks from the audio frame. audioFrame.getCaptionTracks().clear(); presentation.save("audio_without_captions.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Extract Audio** Aspose.Slides for Android via Java allows you to extract the sound used in slide show transitions. For example, you can extract the sound used in a specific slide. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class and load the presentation containing the audio. 2. Get the relevant slide's reference through its index. 3. Access the [slideshow transitions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IBaseSlide#getSlideShowTransition--) for the slide. 4. Extract the sound in byte data. This code in Java shows you how to extract the audio used in a slide: ```java import com.aspose.slides.*; // Instantiates a Presentation class that represents a presentation file Presentation pres = new Presentation("AudioSlide.pptx"); try { // Accesses the desired slide ISlide slide = pres.getSlides().get_Item(0); // Gets the slideshow transition effects for the slide ISlideShowTransition transition = slide.getSlideShowTransition(); //Extracts the sound in byte array byte[] audio = transition.getSound().getBinaryData(); System.out.println("Length: " + audio.length); } finally { if (pres != null) pres.dispose(); } ``` ## **FAQ** ### Can I reuse the same audio asset across multiple slides without inflating the file size? Yes. Add the audio once to the presentation’s shared [audio collection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/#getAudios--) and create additional audio frames that reference that existing asset. This avoids duplicating media data and keeps the presentation size under control. ### Can I replace the sound in an existing audio frame without recreating the shape? Yes. For a linked sound, update the [link path](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaudioframe/#setLinkPathLong-java.lang.String-) to point to the new file. For an embedded sound, swap the [embedded audio](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaudioframe/#setEmbeddedAudio-com.aspose.slides.IAudio-) object with another one from the presentation’s [audio collection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/#getAudios--). The frame’s formatting and most playback settings remain intact. ### Does trimming change the underlying audio data stored in the presentation? No. Trimming adjusts only the playback boundaries. The original audio bytes remain untouched and accessible through the embedded audio or the presentation’s audio collection. ## Related articles - [Audio](https://docs.aspose.com/slides/androidjava/examples/elements/audio/) - [Manage Video Frames in Presentations on Android](https://docs.aspose.com/slides/androidjava/video-frame/) # Automating PowerPoint Generation on Android: Create Dynamic Presentations Easily > Automate slide creation on cloud platforms with Aspose.Slides for Android—generate, edit, and convert PowerPoint and OpenDocument files fast and reliably. Source: https://docs.aspose.com/slides/androidjava/automating-powerpoint-generation-on-cloud-platforms/ Updated: 2026-08-05 ## **Introduction** Creating PowerPoint presentations manually can be a time-consuming and repetitive task—especially when the content is based on dynamic data that frequently changes. Whether it's generating weekly business reports, assembling educational material, or producing client-ready sales decks, automation can save countless hours and ensure consistency across teams. For Android developers, automating the creation of PowerPoint presentations opens up powerful possibilities. You can integrate slide generation into web portals, deskt op tools, backend services, or cloud platforms to dynamically convert data into professional, branded presentations—on-demand. In this article, we’ll explore the common use cases for automated PowerPoint generation in Android apps (including deployments on cloud platforms) and why it's becoming an essential feature in modern solutions. From pulling real-time business data to converting text or images into slides, the goal is to transform raw content into structured, visual formats your audience can instantly understand. ## **Common Use Cases for PowerPoint Automation on Android** Automating PowerPoint generation is especially useful in scenarios where presentation content needs to be dynamically assembled, personalized, or frequently updated. Some of the most common real-world use cases include: - **Business Reports & Dashboards** Generate sales summaries, KPIs, or financial performance reports by pulling live data from databases or APIs. - **Personalized Sales & Marketing Decks** Automatically create client-specific pitch decks using CRM or form data, ensuring quick turnaround and brand consistency. - **Educational Content** Convert learning material, quizzes, or course summaries into structured slide decks for e-learning platforms. - **Data & AI-Powered Insights** Use natural language processing or analytics engines to transform raw data or long-form text into summarized presentations. - **Media-Based Slides** Assemble presentations from uploaded images, annotated screenshots, or video keyframes with supporting descriptions. - **Document Conversion** Automatically convert Word documents, PDFs, or form inputs into visual presentations with minimal manual effort. - **Developer and Technical Tools** Create tech demos, documentation overviews, or changelogs in slide format directly from code or markdown content. By automating these workflows, organizations can scale their content creation, maintain consistency, and free up time for more strategic work. ## **Let's Code** For this example, we’ve chosen **[Aspose.Slides for Android](https://products.aspose.com/slides/android-java/)** to demonstrate PowerPoint automation due to its comprehensive feature set and ease of use when working with presentations programmatically. Unlike lower-level libraries, which require developers to work directly with the Open XML structure (often resulting in verbose and less readable code), Aspose.Slides provides a higher-level API. It abstracts away the complexity, allowing developers to focus on presentation logic—such as layout, formatting, and data binding—without needing to understand the PowerPoint file format in detail. Although Aspose.Slides is a commercial library, it offers a [free trial](https://releases.aspose.com/slides/androidjava/) version that is fully capable of running the examples provided in this article. For the purpose of demonstrating ideas, testing features, or building a proof of concept like the one we’re covering here, the trial is more than sufficient. This makes it a convenient option for experimenting with automated PowerPoint generation without needing to commit to a license upfront. Ok, let’s walk through building a sample presentation using real-world content. ### **Create a Title Slide** We'll begin by creating a new presentation and adding a title slide with a main heading and subtitle. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); ISlide slide0 = presentation.getSlides().get_Item(0); ILayoutSlide layoutSlide = presentation.getLayoutSlides().getByType(SlideLayoutType.Title); slide0.setLayoutSlide(layoutSlide); IAutoShape titleShape = (IAutoShape)slide0.getShapes().get_Item(0); IAutoShape subtitleShape = (IAutoShape)slide0.getShapes().get_Item(1); titleShape.getTextFrame().setText("Quarterly Business Review – Q1 2025"); subtitleShape.getTextFrame().setText("Prepared for Executive Team"); ``` ![The title slide](https://docs.aspose.com/slides/androidjava/automating-powerpoint-generation-on-cloud-platforms/slide_0.png) ### **Add a Slide with a Column Chart** Next, we’ll create a slide showing regional sales performance as a column chart. ```java import com.aspose.slides.*; // The presentation created in the previous step. Presentation presentation = new Presentation(); ILayoutSlide layoutSlide1 = presentation.getLayoutSlides().getByType(SlideLayoutType.Blank); ISlide slide1 = presentation.getSlides().addEmptySlide(layoutSlide1); IChart chart = slide1.getShapes().addChart(ChartType.ClusteredColumn, 100, 100, 500, 350, false); chart.getLegend().setPosition(LegendPositionType.Bottom); chart.setTitle(true); chart.getChartTitle().addTextFrameForOverriding("Data from January – March 2025"); chart.getChartTitle().setOverlay(false); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); int worksheetIndex = 0; chart.getChartData().getCategories().add(workbook.getCell(worksheetIndex, 1, 0, "North America")); chart.getChartData().getCategories().add(workbook.getCell(worksheetIndex, 2, 0, "Europe")); chart.getChartData().getCategories().add(workbook.getCell(worksheetIndex, 3, 0, "Asia Pacific")); chart.getChartData().getCategories().add(workbook.getCell(worksheetIndex, 4, 0, "Latin America")); chart.getChartData().getCategories().add(workbook.getCell(worksheetIndex, 5, 0, "Middle East")); IChartSeries series = chart.getChartData().getSeries().add(workbook.getCell(worksheetIndex, 0, 1, "Sales ($K)"), chart.getType()); series.getDataPoints().addDataPointForBarSeries(workbook.getCell(worksheetIndex, 1, 1, 480)); series.getDataPoints().addDataPointForBarSeries(workbook.getCell(worksheetIndex, 2, 1, 365)); series.getDataPoints().addDataPointForBarSeries(workbook.getCell(worksheetIndex, 3, 1, 290)); series.getDataPoints().addDataPointForBarSeries(workbook.getCell(worksheetIndex, 4, 1, 150)); series.getDataPoints().addDataPointForBarSeries(workbook.getCell(worksheetIndex, 5, 1, 120)); ``` ![The slide with the chart](https://docs.aspose.com/slides/androidjava/automating-powerpoint-generation-on-cloud-platforms/slide_1.png) ### **Add a Slide with a Table** We’ll now add a slide that presents key performance metrics in table format. ```java import com.aspose.slides.*; // The presentation created in the previous step. Presentation presentation = new Presentation(); ILayoutSlide layoutSlide2 = presentation.getLayoutSlides().getByType(SlideLayoutType.Blank); ISlide slide2 = presentation.getSlides().addEmptySlide(layoutSlide2); double[] columnWidths = {200, 100}; double[] rowHeights = {40, 40, 40, 40, 40}; ITable table = slide2.getShapes().addTable(200, 200, columnWidths, rowHeights); table.getColumns().get_Item(0).get_Item(0).getTextFrame().setText("Metric"); table.getColumns().get_Item(1).get_Item(0).getTextFrame().setText("Value"); table.getColumns().get_Item(0).get_Item(1).getTextFrame().setText("Total Revenue"); table.getColumns().get_Item(1).get_Item(1).getTextFrame().setText("$1.4M"); table.getColumns().get_Item(0).get_Item(2).getTextFrame().setText("Gross Margin"); table.getColumns().get_Item(1).get_Item(2).getTextFrame().setText("54%"); table.getColumns().get_Item(0).get_Item(3).getTextFrame().setText("New Customers"); table.getColumns().get_Item(1).get_Item(3).getTextFrame().setText("340"); table.getColumns().get_Item(0).get_Item(4).getTextFrame().setText("Customer Retention"); table.getColumns().get_Item(1).get_Item(4).getTextFrame().setText("87%"); ``` ![The slide with the table](https://docs.aspose.com/slides/androidjava/automating-powerpoint-generation-on-cloud-platforms/slide_2.png) ### **Add a Summary Slide with Bullet Points** Lastly, we’ll include a summary and action plan using a simple bullet list. ```java import com.aspose.slides.*; import java.awt.Color; static IParagraph createBulletParagraph(String text) { Paragraph paragraph = new Paragraph(); paragraph.getParagraphFormat().getBullet().setType(BulletType.Symbol); paragraph.getParagraphFormat().setIndent(15); paragraph.getParagraphFormat().getDefaultPortionFormat().getFillFormat().setFillType(FillType.Solid); paragraph.getParagraphFormat().getDefaultPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK); paragraph.setText(text); return paragraph; } ``` ```java import com.aspose.slides.*; import java.awt.Color; import java.util.function.Function; // The presentation created in the previous step. Presentation presentation = new Presentation(); // The bullet paragraph factory declared above. Function createBulletParagraph = text -> { Paragraph paragraph = new Paragraph(); paragraph.getParagraphFormat().getBullet().setType(BulletType.Symbol); paragraph.getParagraphFormat().setIndent(15); paragraph.getParagraphFormat().getDefaultPortionFormat().getFillFormat().setFillType(FillType.Solid); paragraph.getParagraphFormat().getDefaultPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK); paragraph.setText(text); return paragraph; }; ILayoutSlide layoutSlide3 = presentation.getLayoutSlides().getByType(SlideLayoutType.Blank); ISlide slide3 = presentation.getSlides().addEmptySlide(layoutSlide3); IAutoShape bulletList = slide3.getShapes().addAutoShape(ShapeType.Rectangle, 100, 50, 600, 200); bulletList.getFillFormat().setFillType(FillType.NoFill); bulletList.getLineFormat().getFillFormat().setFillType(FillType.NoFill); bulletList.getTextFrame().getParagraphs().clear(); bulletList.getTextFrame().getParagraphs().add(createBulletParagraph.apply("Strong performance in North America; growth opportunity in Asia Pacific")); bulletList.getTextFrame().getParagraphs().add(createBulletParagraph.apply("Improve marketing outreach in underperforming regions")); bulletList.getTextFrame().getParagraphs().add(createBulletParagraph.apply("Prepare new campaign strategy for Q2")); bulletList.getTextFrame().getParagraphs().add(createBulletParagraph.apply("Schedule follow-up review in early July")); ``` ![The slide with the text](https://docs.aspose.com/slides/androidjava/automating-powerpoint-generation-on-cloud-platforms/slide_3.png) ### **Save the Presentation** Finally, we save the presentation to disk: ```java import com.aspose.slides.*; // The presentation created in the previous steps. Presentation presentation = new Presentation(); presentation.save("presentation.pptx", SaveFormat.Pptx); ``` ## **Conclusion** Automating PowerPoint generation in Android applications offers clear benefits in saving time and reducing manual effort. By integrating dynamic content such as charts, tables, and text, developers can quickly produce consistent, professional presentations—ideal for business reports, client meetings, or educational content. In this article, we've demonstrated how to automate the creation of a presentation from scratch, including adding a title slide, charts, and tables. This approach can be applied across various use cases where automated, data-driven presentations are needed. By leveraging the right tools, Android developers can efficiently automate PowerPoint creation, enhancing productivity and ensuring consistency across presentations. # Customize Bubble Charts in Presentations on Android > Create and customize powerful bubble charts in PowerPoint with Aspose.Slides for Android via Java to enhance your data visualization easily. Source: https://docs.aspose.com/slides/androidjava/bubble-chart/ Updated: 2026-11-08 ## **Overview** This article shows how to work with bubble charts in Aspose.Slides. It covers two specific customization options: scaling bubble sizes through the `setBubbleSizeScale` method and controlling how bubble size values are represented through the `setBubbleSizeRepresentation` method. The examples demonstrate how to create a bubble chart, adjust its size scaling, and switch the bubble size representation to use width. The article also includes a short FAQ section that clarifies support for the “Bubble with 3-D” chart type, notes that practical chart limits depend on performance and the target PowerPoint version, and explains that export preserves the chart’s appearance through the Aspose.Slides rendering engine. ## **Bubble Chart Size Scaling** Aspose.Slides for Android via Java provides support for Bubble chart size scaling. In Aspose.Slides for Android via Java [**IChartSeries.getBubbleSizeScale**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IChartSeries#getBubbleSizeScale--), [**IChartSeriesGroup.getBubbleSizeScale**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IChartSeriesGroup#getBubbleSizeScale--) and [**IChartSeriesGroup.setBubbleSizeScale**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IChartSeriesGroup#setBubbleSizeScale-int-) methods have been added. Below sample example is given.  ```java import com.aspose.slides.*; Presentation pres = new Presentation(); try { IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.Bubble, 100, 100, 400, 300); chart.getChartData().getSeriesGroups().get_Item(0).setBubbleSizeScale(150); pres.save("Result.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` ## **Represent Data as Bubble Chart Sizes** Methods [**setBubbleSizeRepresentation**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IChartSeriesGroup#setBubbleSizeRepresentation-int-) and [**getBubbleSizeRepresentation**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IChartSeriesGroup#getBubbleSizeRepresentation--) have been added to [IChartSeries](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IChartSeries), [IChartSeriesGroup](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IChartSeriesGroup) interfaces, and related classes. **BubbleSizeRepresentation** specifies how the bubble size values are represented in the bubble chart. Possible values are: [**BubbleSizeRepresentationType.Area**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/BubbleSizeRepresentationType#Area) and [**BubbleSizeRepresentationType.Width**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/BubbleSizeRepresentationType#Width). Accordingly, [**BubbleSizeRepresentationType**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/BubbleSizeRepresentationType) enum has been added to specify the possible ways to represent data as bubble chart sizes. Sample code is given below. ```java import com.aspose.slides.*; Presentation pres = new Presentation(); try { IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.Bubble, 50, 50, 600, 400, true); chart.getChartData().getSeriesGroups().get_Item(0).setBubbleSizeRepresentation(BubbleSizeRepresentationType.Width); pres.save("Presentation_BubbleSizeRepresentation.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` [![Two plots use identical X and Y coordinates and size values 1, 4 and 9. In Area mode their circle areas follow 1 to 4 to 9. In Width mode their diameters follow that ratio.](https://docs.aspose.com/slides/androidjava/bubble-chart/visual-bubble-chart-bf890435c020.svg)](https://docs.aspose.com/slides/androidjava/bubble-chart/visual-bubble-chart-bf890435c020.svg) *Illustrative comparison at the same scale. Area uses the circle’s area, while Width uses its diameter.* ## **FAQ** ### Is a "bubble chart with 3-D effect" supported, and how does it differ from a regular one? Yes. There is a separate chart type, "Bubble with 3-D." It applies 3-D styling to the bubbles but does not add an additional axis; the data remain X-Y-S (size). The type is available in the [chart type](https://reference.aspose.com/slides/androidjava/com.aspose.slides/charttype/) class. ### Is there a limit on the number of series and points in a bubble chart? There is no hard limit at the API level; constraints are determined by performance and the target PowerPoint version. It is recommended to keep the number of points reasonable for readability and rendering speed. ### How will export affect the appearance of a bubble chart (PDF, images)? Export to supported formats preserves the chart’s appearance; rendering is performed by the Aspose.Slides engine. For raster/vector formats, general chart-graphics rendering rules apply (resolution, anti-aliasing), so choose sufficient DPI for printing. # Manage Callouts in Presentation Charts on Android > Create and style callouts in Aspose.Slides for Android with concise Java code examples, compatible with PPT and PPTX to automate presentation workflows. Source: https://docs.aspose.com/slides/androidjava/callout/ Updated: 2026-08-05 ## **Overview** This article explains how to work with callouts for chart data labels in Aspose.Slides. It shows how to use the `setShowLabelAsDataCallout` method to display labels as callouts, how to configure callout-related label settings for a doughnut chart, and notes that callouts and their appearance are preserved when presentations are exported to PDF, HTML5, SVG, and raster image formats. ## **Using Callouts** New methods [**getShowLabelAsDataCallout()**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IDataLabelFormat#getShowLabelAsDataCallout--) and [**setShowLabelAsDataCallout()**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IDataLabelFormat#setShowLabelAsDataCallout-boolean-) have been added to [DataLabelFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/datalabelformat) class and [IDataLabelFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat) interface. These methods determine either specified chart's data label will be displayed as data callout or as data label. ```java import com.aspose.slides.*; Presentation pres = new Presentation(); try { IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.Pie, 50, 50, 500, 400); chart.getChartData().getSeries().get_Item(0).getLabels().getDefaultDataLabelFormat().setShowValue(true); chart.getChartData().getSeries().get_Item(0).getLabels().getDefaultDataLabelFormat().setShowLabelAsDataCallout(true); chart.getChartData().getSeries().get_Item(0).getLabels().get_Item(2).getDataLabelFormat().setShowLabelAsDataCallout(false); pres.save("DisplayCharts.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` ## **Set a Callout for a Doughnut Chart** Aspose.Slides for Android via Java provides support for setting series data label callout shape for a Doughnut chart. Below sample example is given.  ```java import com.aspose.slides.*; Presentation pres = new Presentation(); try { ISlide slide = pres.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Doughnut, 10, 10, 500, 500, false); IChartDataWorkbook workBook = chart.getChartData().getChartDataWorkbook(); chart.getChartData().getSeries().clear(); chart.getChartData().getCategories().clear(); chart.setLegend(false); int seriesIndex = 0; while (seriesIndex < 15) { IChartSeries series = chart.getChartData().getSeries().add(workBook.getCell(0, 0, seriesIndex + 1, "SERIES " + seriesIndex), chart.getType()); series.setExplosion(0); series.getParentSeriesGroup().setDoughnutHoleSize((byte)20); series.getParentSeriesGroup().setFirstSliceAngle(351); seriesIndex++; } int categoryIndex = 0; while (categoryIndex < 15) { chart.getChartData().getCategories().add(workBook.getCell(0, categoryIndex + 1, 0, "CATEGORY " + categoryIndex)); int i = 0; while (i < chart.getChartData().getSeries().size()) { IChartSeries iCS = chart.getChartData().getSeries().get_Item(i); IChartDataPoint dataPoint = iCS.getDataPoints().addDataPointForDoughnutSeries(workBook.getCell(0, categoryIndex + 1, i + 1, 1)); dataPoint.getFormat().getFill().setFillType(FillType.Solid); dataPoint.getFormat().getLine().getFillFormat().setFillType(FillType.Solid); dataPoint.getFormat().getLine().getFillFormat().getSolidFillColor().setColor(java.awt.Color.WHITE); dataPoint.getFormat().getLine().setWidth(1); dataPoint.getFormat().getLine().setStyle(LineStyle.Single); dataPoint.getFormat().getLine().setDashStyle(LineDashStyle.Solid); if (i == chart.getChartData().getSeries().size() - 1) { IDataLabel lbl = dataPoint.getLabel(); lbl.getTextFormat().getTextBlockFormat().setAutofitType(TextAutofitType.Shape); lbl.getDataLabelFormat().getTextFormat().getPortionFormat().setFontBold(NullableBool.True); lbl.getDataLabelFormat().getTextFormat().getPortionFormat().setLatinFont(new FontData("DINPro-Bold")); lbl.getDataLabelFormat().getTextFormat().getPortionFormat().setFontHeight(12); lbl.getDataLabelFormat().getTextFormat().getPortionFormat().getFillFormat().setFillType(FillType.Solid); lbl.getDataLabelFormat().getTextFormat().getPortionFormat().getFillFormat().getSolidFillColor().setColor(java.awt.Color.LIGHT_GRAY); lbl.getDataLabelFormat().getFormat().getLine().getFillFormat().getSolidFillColor().setColor(java.awt.Color.WHITE); lbl.getDataLabelFormat().setShowValue(false); lbl.getDataLabelFormat().setShowCategoryName(true); lbl.getDataLabelFormat().setShowSeriesName(false); lbl.getDataLabelFormat().setShowLeaderLines(true); lbl.getDataLabelFormat().setShowLabelAsDataCallout(false); chart.validateChartLayout(); lbl.setX((float) lbl.getX()+ (float)0.5); lbl.setY((float)lbl.getY()+ (float)0.5); } i++; } categoryIndex++; } pres.save("chart.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` ## **FAQ** ### Are callouts preserved when converting a presentation to PDF, HTML5, SVG, or images? Yes. Callouts are part of the chart rendering, so when you export to [PDF](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-pdf/), [HTML5](https://docs.aspose.com/slides/androidjava/export-to-html5/), [SVG](https://docs.aspose.com/slides/androidjava/render-a-slide-as-an-svg-image/), or [raster images](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-png/), they are preserved together with the slide’s formatting. ### Do custom fonts work in callouts, and can their appearance be preserved on export? Yes. Aspose.Slides supports [embedding fonts](https://docs.aspose.com/slides/androidjava/embedded-font/) into the presentation and controls font embedding during exports such as [PDF](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-pdf/), ensuring the callouts look the same across different systems. # Customize Chart Axes in Presentations on Android > Discover how to use Aspose.Slides for Android via Java to customize chart axes in PowerPoint presentations for reports and visualizations. Source: https://docs.aspose.com/slides/androidjava/chart-axis/ Updated: 2026-10-30 ## **Overview** This article explains how to customize chart axes with Aspose.Slides for Android via Java. It covers calculated axis values, switching chart rows and columns, axis visibility, category label and tick-mark intervals, date categories and formatting, title rotation, axis positioning, display units, and logarithmic scaling. ## **Get the Max Values on the Vertical Axis on Charts** Create a [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) and add an area chart with default data. Call [validateChartLayout](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chart/#validateChartLayout--) before reading calculated axis values so that the chart layout is up to date. Read [getActualMaxValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#getActualMaxValue--) and [getActualMinValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#getActualMinValue--) for the axis limits, and [getActualMajorUnit](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#getActualMajorUnit--) and [getActualMinorUnit](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#getActualMinorUnit--) for the tick intervals. [getActualMajorUnitScale](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#getActualMajorUnitScale--) and [getActualMinorUnitScale](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#getActualMinorUnitScale--) provide time-unit scales, which are relevant to date axes. The example stores these values in local variables and saves the chart. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Area, 100, 100, 500, 350); chart.validateChartLayout(); double maxValue = chart.getAxes().getVerticalAxis().getActualMaxValue(); double minValue = chart.getAxes().getVerticalAxis().getActualMinValue(); double majorUnit = chart.getAxes().getVerticalAxis().getActualMajorUnit(); double minorUnit = chart.getAxes().getVerticalAxis().getActualMinorUnit(); int majorUnitScale = chart.getAxes().getVerticalAxis().getActualMajorUnitScale(); int minorUnitScale = chart.getAxes().getVerticalAxis().getActualMinorUnitScale(); presentation.save("AxisValues_out.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Swap the Data between Axes** Use [switchRowColumn](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chartdata/#switchRowColumn--) to exchange the roles of series and categories in chart data. Each former category becomes a series, and each former series becomes a category. This changes how the data is grouped; it does not exchange the horizontal and vertical axes. The example uses [setRange](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chartdata/#setRange-java.lang.String-) to bind the default data to `Sheet1!A1:D5`, including the header row and category column, before switching rows and columns. It saves a chart with four series and three categories. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 100, 100, 400, 300); chart.getChartData().setRange("Sheet1!A1:D5"); chart.getChartData().switchRowColumn(); presentation.save("SwitchChartRowColumns_out.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Reverse the Plotting Order of an Axis** Use [setPlotOrderReversed](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setPlotOrderReversed-boolean-) to reverse a category or value axis. For example, a horizontal bar chart can show project stages from top to bottom in the same order as the worksheet: Planning, Development, Testing. Reversing an axis changes the plotting direction; it does not sort or rearrange the workbook data. By comparison, [switchRowColumn](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chartdata/#switchRowColumn--) exchanges the roles of series and categories. The following example creates a horizontal bar chart with three stages and one series. It saves a presentation with three slides: normal order, reversed categories, and reversed values. Each copy uses the same dataset, and only one axis is reversed on each copy. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredBar, 50, 40, 620, 320); chart.setLegend(false); chart.getChartData().getCategories().clear(); chart.getChartData().getSeries().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); workbook.clear(0); IChartSeries series = chart.getChartData().getSeries().add(ChartType.ClusteredBar); String[] stages = { "Planning", "Development", "Testing" }; int[] values = { 10, 30, 20 }; for (int i = 0; i < stages.length; i++) { IChartDataCell categoryCell = workbook.getCell(0, i + 1, 0, stages[i]); chart.getChartData().getCategories().add(categoryCell); IChartDataCell valueCell = workbook.getCell(0, i + 1, 1, values[i]); series.getDataPoints().addDataPointForBarSeries(valueCell); } // Slide 2: display the first category at the top. ISlide categorySlide = presentation.getSlides().addClone(slide); IChart categoryChart = (IChart)categorySlide.getShapes().get_Item(0); categoryChart.getAxes().getVerticalAxis().setPlotOrderReversed(true); // Keep the horizontal value axis at the bottom. categoryChart.getAxes().getVerticalAxis().setCrossType(CrossesType.Maximum); // Slide 3: reverse only the horizontal numeric scale. ISlide valueSlide = presentation.getSlides().addClone(slide); IChart valueChart = (IChart)valueSlide.getShapes().get_Item(0); valueChart.getAxes().getHorizontalAxis().setPlotOrderReversed(true); presentation.save("ReversedAxes.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` Reversing an axis can also move the perpendicular axis to the opposite side of the plot. [setCrossType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setCrossType-int-) controls where the other axis crosses the axis being configured. In slide 2, calling it with `CrossesType.Maximum` on the reversed category axis keeps the horizontal value axis at the bottom. For a specific crossing point, use [setCrossAt](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setCrossAt-float-). Check the crossing settings when changing direction, especially if the chart already has a custom crossing point. Call `setPlotOrderReversed` with `false` to restore the normal plotting direction; crossing settings are separate. | Normal order (slide 1) | Reversed categories (slide 2) | Reversed values (slide 3) | | --- | --- | --- | | ![Horizontal bar chart with normal category and value axis order](https://docs.aspose.com/slides/androidjava/chart-axis/axis-order-normal.png) | ![Horizontal bar chart with categories displayed from top to bottom](https://docs.aspose.com/slides/androidjava/chart-axis/axis-order-categories-reversed.png) | ![Horizontal bar chart with a reversed value axis and zero on the right](https://docs.aspose.com/slides/androidjava/chart-axis/axis-order-values-reversed.png) | | Categories run from bottom to top; values increase from left to right. | Planning, Development, and Testing run from top to bottom. Values and workbook row order are unchanged. | Categories retain their normal order; values increase from right to left. The category axis crosses at zero on the right. | ## **Disable the Vertical Axis for Line Charts** Call [setVisible](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setVisible-boolean-) with `false` on the vertical axis to hide it. The example creates a line chart with default data and saves it with the vertical axis hidden. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Line, 100, 100, 400, 300); chart.getAxes().getVerticalAxis().setVisible(false); presentation.save("HiddenVerticalAxis.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Disable the Horizontal Axis for Line Charts** Call [setVisible](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setVisible-boolean-) with `false` on the horizontal axis to hide it. The example creates a line chart with default data and saves it with the horizontal axis hidden. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Line, 100, 100, 400, 300); chart.getAxes().getHorizontalAxis().setVisible(false); presentation.save("HiddenHorizontalAxis.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Change a Category Axis** Use [setCategoryAxisType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setCategoryAxisType-int-) to choose a date or text category axis. This example requires `ExistingChart.pptx`, with a chart as the first shape on the first slide and category cells containing numeric Excel date values. It changes the horizontal axis to a date axis. Calling [setAutomaticMajorUnit](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setAutomaticMajorUnit-boolean-) with `false`, [setMajorUnit](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setMajorUnit-double-) with `1`, and [setMajorUnitScale](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setMajorUnitScale-int-) with `TimeUnitType.Months` places major ticks at one-month intervals. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("ExistingChart.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = (IChart) slide.getShapes().get_Item(0); chart.getAxes().getHorizontalAxis().setCategoryAxisType(CategoryAxisType.Date); chart.getAxes().getHorizontalAxis().setAutomaticMajorUnit(false); chart.getAxes().getHorizontalAxis().setMajorUnit(1); chart.getAxes().getHorizontalAxis().setMajorUnitScale(TimeUnitType.Months); presentation.save("ChangeChartCategoryAxis_out.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ### **Determine the Category Axis Type from Data** Call [setCategoryAxisTypeAutomatically](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setCategoryAxisTypeAutomatically--) after populating the categories, then read [getCategoryAxisType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#getCategoryAxisType--) to inspect the selection. This is useful when the same chart receives either text labels or numeric date values. The method determines the type when called; it does not enable a persistent mode that reevaluates later data changes. Call it again after replacing the categories. The following example creates a chart with text categories and prints `true` when the selected type is `CategoryAxisType.Text`. It then replaces the category cell values with dates and calls the method again, printing `true` when the selected type is `CategoryAxisType.Date`. Dates are stored as numeric OLE Automation values, calculated for these dates as the number of days since December 30, 1899, rather than date strings. Both calendars use UTC and are cleared before setting the dates so daylight saving time and the current time of day do not affect the calculation. [setCustomNumberFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setCustomNumberFormat-java.lang.String-) controls how those values are displayed; it does not convert text into numeric dates. For more on category cells, see [Chart Workbook](https://docs.aspose.com/slides/androidjava/chart-workbook/). Use automatic determination when the input is known to contain text categories or numeric dates, as in this example. For ordinary numeric labels, mixed categories, or empty data, explicitly call [setCategoryAxisType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setCategoryAxisType-int-) to match the intended meaning. Numeric values alone do not establish that the categories represent dates. ```java import com.aspose.slides.*; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.TimeZone; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 30, 40, 660, 320); chart.getChartData().getCategories().clear(); chart.getChartData().getSeries().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); workbook.clear(0); IChartDataCell seriesName = workbook.getCell(0, 0, 1, "Sales"); IChartSeries series = chart.getChartData().getSeries().add(seriesName, chart.getType()); String[] labels = { "First", "Second", "Third" }; for (int i = 0; i < labels.length; i++) { IChartDataCell categoryCell = workbook.getCell(0, i + 1, 0, labels[i]); chart.getChartData().getCategories().add(categoryCell); IChartDataCell valueCell = workbook.getCell(0, i + 1, 1, (i + 1) * 10); series.getDataPoints().addDataPointForBarSeries(valueCell); } IAxis axis = chart.getAxes().getHorizontalAxis(); axis.setCategoryAxisTypeAutomatically(); System.out.println(axis.getCategoryAxisType() == CategoryAxisType.Text); // true TimeZone timeZone = TimeZone.getTimeZone("UTC"); Calendar baseDate = new GregorianCalendar(timeZone); baseDate.clear(); baseDate.set(1899, Calendar.DECEMBER, 30); int[][] dates = { { 2026, Calendar.JANUARY, 1 }, { 2026, Calendar.JANUARY, 2 }, { 2026, Calendar.FEBRUARY, 1 } }; for (int i = 0; i < dates.length; i++) { IChartDataCell categoryCell = workbook.getCell(0, i + 1, 0); Calendar date = new GregorianCalendar(timeZone); date.clear(); date.set(dates[i][0], dates[i][1], dates[i][2]); double serialDate = (date.getTimeInMillis() - baseDate.getTimeInMillis()) / 86400000.0; categoryCell.setValue(serialDate); categoryCell.setCustomNumberFormat("yyyy-mm-dd"); } axis.setCategoryAxisTypeAutomatically(); System.out.println(axis.getCategoryAxisType() == CategoryAxisType.Date); // true presentation.save("AutomaticCategoryAxis.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Control Category Axis Label Intervals** When a chart has many categories, reduce the number of visible axis labels without removing categories or data points. Call [setAutomaticTickLabelSpacing](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setAutomaticTickLabelSpacing-boolean-) with `false`, then pass the desired category interval to [setTickLabelSpacing](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setTickLabelSpacing-long-). For text categories in their normal order, counting starts at the first category: | Interval | Labels displayed in the example | | --- | --- | | `1` | Category 1, Category 2, Category 3, ... Category 24 | | `2` | Category 1, Category 3, Category 5, ... Category 23 | | `3` | Category 1, Category 4, Category 7, ... Category 22 | An interval of `3` displays every third label, leaving two labels hidden between displayed labels. It does not remove the corresponding columns. Automatic spacing chooses an interval based on the available space; it does not necessarily display every label. Tick marks have separate controls. Call [setAutomaticTickMarksSpacing](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setAutomaticTickMarksSpacing-boolean-) with `false` and use [setTickMarksSpacing](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setTickMarksSpacing-long-) to set their interval. For example, `1` keeps a tick mark at every category interval while labels appear only every third category. Use [setMajorTickMark](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setMajorTickMark-int-) with a visible style so you can see the result. Calling either automatic-spacing setter with `true` again lets the chart choose that interval again. The following self-contained example creates 24 categories and one series, then saves three slides in `CategoryAxisIntervals.pptx`: automatic spacing, manual label spacing with independent tick marks, and restored automatic spacing. The two copies retain the original chart data. No input presentation is required. Horizontal label text makes the difference in density easy to see. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 30, 40, 660, 320); chart.setLegend(false); chart.getChartData().getCategories().clear(); chart.getChartData().getSeries().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); workbook.clear(0); IChartSeries series = chart.getChartData().getSeries().add(ChartType.ClusteredColumn); for (int i = 0; i < 24; i++) { IChartDataCell categoryCell = workbook.getCell(0, i + 1, 0, "Category " + (i + 1)); chart.getChartData().getCategories().add(categoryCell); IChartDataCell valueCell = workbook.getCell(0, i + 1, 1, 10 + i % 6 * 5); series.getDataPoints().addDataPointForBarSeries(valueCell); } IAxis axis = chart.getAxes().getHorizontalAxis(); axis.setCategoryAxisType(CategoryAxisType.Text); axis.getTextFormat().getTextBlockFormat().setRotationAngle(0); axis.getTextFormat().getPortionFormat().setFontHeight(12); axis.setMajorTickMark(TickMarkType.Outside); axis.setAutomaticTickLabelSpacing(true); axis.setAutomaticTickMarksSpacing(true); // Slide 2: show every third label, but keep a tick mark for every category. ISlide manualSlide = presentation.getSlides().addClone(slide); IChart manualChart = (IChart)manualSlide.getShapes().get_Item(0); IAxis manualAxis = manualChart.getAxes().getHorizontalAxis(); manualAxis.setAutomaticTickLabelSpacing(false); manualAxis.setTickLabelSpacing(3); manualAxis.setAutomaticTickMarksSpacing(false); manualAxis.setTickMarksSpacing(1); // Slide 3: let the chart choose both intervals again. ISlide restoredSlide = presentation.getSlides().addClone(manualSlide); IChart restoredChart = (IChart)restoredSlide.getShapes().get_Item(0); restoredChart.getAxes().getHorizontalAxis().setAutomaticTickLabelSpacing(true); restoredChart.getAxes().getHorizontalAxis().setAutomaticTickMarksSpacing(true); presentation.save("CategoryAxisIntervals.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` **Automatic spacing (slide 1):** In this rendering, every second category label is displayed and wraps onto two lines. The automatic result can vary with chart size, fonts, and the renderer. ![Automatic category label spacing with all 24 columns visible](https://docs.aspose.com/slides/androidjava/chart-axis/category-axis-automatic.png) **Manual spacing (slide 2):** Every third label is displayed on one line, while tick marks remain at every category interval. All 24 columns, including those without labels, remain visible with the same values. Slide 3 restores the automatic appearance shown above. ![Manual category label interval of three with all 24 columns visible](https://docs.aspose.com/slides/androidjava/chart-axis/category-axis-manual.png) ### **Choose the Correct Axis and Interval** Use this category-count interval for a text category axis, such as the category axis of a column, line, area, or bar chart. In a column chart, it is the horizontal axis. In a horizontal bar chart, the category axis is vertical, so apply these settings to the axis returned by [getVerticalAxis](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxesmanager/#getVerticalAxis--). Tick-mark spacing also applies to a series axis in charts that have one. Do not use category label spacing to set the numeric scale of a value axis. On a value axis, [setMajorUnit](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setMajorUnit-double-) specifies a difference in values: for example, a major unit of `10` produces ticks at 0, 10, 20, and so on when the axis starts at zero. A category label interval of `3` instead counts category positions, regardless of their data values. Scatter and bubble charts use value axes rather than a text category axis. For a date axis, use time-based major units and scales as described in [Change a Category Axis](https://docs.aspose.com/slides/androidjava/chart-axis/#change-a-category-axis). ## **Set the Date Format for Category Axis Values** The example replaces the default chart data with four annual values. Dates are stored as OLE Automation serial numbers in the first worksheet (index `0`), calculated as the number of days since December 30, 1899, for these dates. Both calendars use UTC and are cleared before setting the dates so daylight saving time and the current time of day do not affect the calculation. Use [setCategoryAxisType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setCategoryAxisType-int-) with `CategoryAxisType.Date`, call [setNumberFormatLinkedToSource](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setNumberFormatLinkedToSource-boolean-) with `false`, and pass `yyyy` to [setNumberFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setNumberFormat-java.lang.String-) so the category labels display four-digit years independently of the cell formatting. ```java import com.aspose.slides.*; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.TimeZone; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Line, 50, 50, 450, 300); chart.getChartData().getCategories().clear(); chart.getChartData().getSeries().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); workbook.clear(0); TimeZone timeZone = TimeZone.getTimeZone("UTC"); Calendar baseDate = new GregorianCalendar(timeZone); baseDate.clear(); baseDate.set(1899, Calendar.DECEMBER, 30); IChartSeries series = chart.getChartData().getSeries().add(ChartType.Line); for (int i = 0; i < 4; i++) { Calendar date = new GregorianCalendar(timeZone); date.clear(); date.set(2015 + i, Calendar.JANUARY, 1); double serialDate = (date.getTimeInMillis() - baseDate.getTimeInMillis()) / 86400000.0; IChartDataCell categoryCell = workbook.getCell(0, i + 1, 0, serialDate); chart.getChartData().getCategories().add(categoryCell); IChartDataCell valueCell = workbook.getCell(0, i + 1, 1, i + 1); series.getDataPoints().addDataPointForLineSeries(valueCell); } chart.getAxes().getHorizontalAxis().setCategoryAxisType(CategoryAxisType.Date); chart.getAxes().getHorizontalAxis().setNumberFormatLinkedToSource(false); chart.getAxes().getHorizontalAxis().setNumberFormat("yyyy"); presentation.save("DateAxisFormat.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Set a Rotation Angle for a Chart Axis Title** Call [setTitle](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setTitle-boolean-) with `true` on the vertical axis, provide title text, and use [setRotationAngle](https://reference.aspose.com/slides/androidjava/com.aspose.slides/icharttextblockformat/#setRotationAngle-float-) to rotate the title. The angle is measured in degrees; this example saves a column chart with its value-axis title rotated by 90 degrees. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 450, 300); chart.getAxes().getVerticalAxis().setTitle(true); chart.getAxes().getVerticalAxis().getTitle().addTextFrameForOverriding("Value"); chart.getAxes().getVerticalAxis().getTitle().getTextFormat().getTextBlockFormat().setRotationAngle(90); presentation.save("RotatedAxisTitle.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Set the Axis Position on a Category or Value Axis** Use [setAxisBetweenCategories](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setAxisBetweenCategories-boolean-) to control whether the value axis crosses the category axis between categories or at category tick marks. This setting applies to category axes. The example sets it to `true` on the horizontal category axis of a column chart and saves the result. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 450, 300); chart.getAxes().getHorizontalAxis().setAxisBetweenCategories(true); presentation.save("AxisBetweenCategories.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Set the Display Unit on a Chart Value Axis** Use [setDisplayUnit](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setDisplayUnit-int-) to scale the labels on a value axis without changing the underlying data. With [DisplayUnitType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/displayunittype/) set to `Millions`, a value of 60,000,000 is displayed as 60. The example creates a column chart and applies the millions display unit to its vertical axis. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 450, 300); chart.getAxes().getVerticalAxis().setDisplayUnit(DisplayUnitType.Millions); presentation.save("Result.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Configure a Logarithmic Value Axis** A logarithmic value axis is useful when positive values span several orders of magnitude. For example, a service might receive 10, 100, 1,000, 10,000, and 100,000 requests over five periods. On a linear scale, the smaller values appear close together near zero. A logarithmic scale makes their relative growth easier to compare: equal distances represent equal ratios rather than equal differences. Call [setLogarithmic](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setLogarithmic-boolean-) with `true` on the value axis and use [setLogBase](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setLogBase-double-) to choose the base. This changes how the existing values are displayed; it does not change the data or add a logarithmic trend line. A trend line represents a fitted relationship in the data and is a separate feature. ### **Choose the Value Axis and Base** For a line or column chart, the value axis is returned by [getVerticalAxis](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxesmanager/#getVerticalAxis--). For a horizontal bar chart, it is returned by [getHorizontalAxis](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxesmanager/#getHorizontalAxis--). Scatter and bubble charts have two value axes, so choose the horizontal axis for X values, the vertical axis for Y values, or both. Do not apply logarithmic scaling to a category axis. The default logarithmic base is `10`. For PPTX charts, use a base from `2` through `1000`, inclusive; fractional bases such as `2.5` are also supported. With base `10`, successive powers such as 10, 100, 1,000, and 10,000 are equally spaced. ### **Compare Linear and Logarithmic Scaling** The following self-contained example creates a line chart with the five request counts on the first slide, then clones that slide and enables a base-10 logarithmic value axis on the second. Both slides retain the same data. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Line, 30, 40, 660, 200); chart.setLegend(false); chart.getChartData().getCategories().clear(); chart.getChartData().getSeries().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); workbook.clear(0); IChartSeries series = chart.getChartData().getSeries().add(ChartType.Line); double[] values = { 10, 100, 1000, 10000, 100000 }; for (int i = 0; i < values.length; i++) { IChartDataCell categoryCell = workbook.getCell(0, i + 1, 0, "Period " + (i + 1)); chart.getChartData().getCategories().add(categoryCell); IChartDataCell valueCell = workbook.getCell(0, i + 1, 1, values[i]); series.getDataPoints().addDataPointForLineSeries(valueCell); } // Keep the first slide linear and change only the copy's value-axis scale. ISlide logarithmicSlide = presentation.getSlides().addClone(slide); IChart logarithmicChart = (IChart)logarithmicSlide.getShapes().get_Item(0); IAxis valueAxis = logarithmicChart.getAxes().getVerticalAxis(); valueAxis.setLogarithmic(true); valueAxis.setLogBase(10); presentation.save("LogarithmicAxis.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` **Linear scale (slide 1):** Equal vertical distances represent equal differences in request counts. The largest value dominates the chart, making the smaller values difficult to distinguish. ![Line chart in PowerPoint showing five request counts on a linear value axis](https://docs.aspose.com/slides/androidjava/chart-axis/value-axis-linear.png) **Logarithmic scale (slide 2):** Equal vertical distances represent equal ratios. Each period has ten times as many requests as the previous one, so the points form a straight rising line on the base-10 scale. The axis labels still show the original request counts. ![The same five request counts in PowerPoint on a base-10 logarithmic value axis](https://docs.aspose.com/slides/androidjava/chart-axis/value-axis-logarithmic.png) ### **Handle Zero and Negative Values** A logarithmic scale can display only strictly positive values. Check the data before enabling it. If zero or negative values are meaningful, keep a linear scale or show them separately. If excluding those values is appropriate for the analysis, explain the omission. Do not silently replace them with small positive numbers, as this changes the meaning of the data. Any manually configured minimum or maximum for a logarithmic axis must also be positive. ## **FAQ** **How do I set the value at which one axis crosses the other (axis crossing)?** Use [setCrossType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setCrossType-int-) to select the crossing behavior. To specify a numeric crossing value, use [setCrossAt](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setCrossAt-float-). These settings let you move the axis crossing to a suitable baseline. **How can I position tick labels relative to the axis?** Call [setTickLabelPosition](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setTickLabelPosition-int-) using [TickLabelPositionType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ticklabelpositiontype/): `Low`, `High`, `NextTo`, or `None`. To control the tick marks themselves, use [setMajorTickMark](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setMajorTickMark-int-) or [setMinorTickMark](https://reference.aspose.com/slides/androidjava/com.aspose.slides/axis/#setMinorTickMark-int-); these are separate from label positioning. ## Related articles - [Format Presentation Charts on Android](https://docs.aspose.com/slides/androidjava/chart-formatting/) # Optimize Chart Calculations for Presentations on Android > Understand chart calculations, data updates, and precision control in Aspose.Slides for Android for PPT and PPTX, with practical Java code examples. Source: https://docs.aspose.com/slides/androidjava/chart-calculations/ Updated: 2026-08-05 ## **Overview** Aspose.Slides provides APIs for working with chart calculations and layout data in presentations. This article shows how to retrieve the actual values of chart elements, including the real position and size of elements that implement `IActualLayout` and the actual values of chart axes. It also explains that these values are populated after chart layout validation. In addition, the article demonstrates how to get the actual position of parent chart elements and how to hide chart components such as the title, axes, legend, and grid lines. Together, these examples help you inspect chart layout information and control the visibility of chart elements in PowerPoint presentations programmatically. ## **Calculate Actual Values of Chart Elements** Aspose.Slides for Android via Java provides a simple API for getting these properties. Properties of [IAxis](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IAxis) interface provide information about actual position of axis chart element ([IAxis.getActualMaxValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IAxis#getActualMaxValue--), [IAxis.getActualMinValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IAxis#getActualMinValue--), [IAxis.getActualMajorUnit](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IAxis#getActualMajorUnit--), [IAxis.getActualMinorUnit](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IAxis#getActualMinorUnit--), [IAxis.getActualMajorUnitScale](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IAxis#getActualMajorUnitScale--), [IAxis.getActualMinorUnitScale](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IAxis#getActualMinorUnitScale--)). It is necessary to call method [IChart.validateChartLayout()](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IChart#validateChartLayout--) previously to fill properties with actual values. ```java import com.aspose.slides.*; Presentation pres = new Presentation(); try { Chart chart = (Chart)pres.getSlides().get_Item(0).getShapes().addChart(ChartType.Area, 100, 100, 500, 350); chart.validateChartLayout(); double maxValue = chart.getAxes().getVerticalAxis().getActualMaxValue(); double minValue = chart.getAxes().getVerticalAxis().getActualMinValue(); double majorUnit = chart.getAxes().getHorizontalAxis().getActualMajorUnit(); double minorUnit = chart.getAxes().getHorizontalAxis().getActualMinorUnit(); } finally { if (pres != null) pres.dispose(); } ``` ## **Calculate Actual Position of Parent Chart Elements** Aspose.Slides for Android via Java provides a simple API for getting these properties. Properties of [IActualLayout](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IActualLayout) interface provide information about actual position of parent chart element ([IActualLayout.getActualX](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IActualLayout#getActualX--), [IActualLayout.getActualY](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IActualLayout#getActualY--), [IActualLayout.getActualWidth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IActualLayout#getActualWidth--), [IActualLayout.getActualHeight](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IActualLayout#getActualHeight--)). It is necessary to call method [IChart.validateChartLayout()](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IChart#validateChartLayout--) previously to fill properties with actual values. ```java import com.aspose.slides.*; Presentation pres = new Presentation(); try { Chart chart = (Chart) pres.getSlides().get_Item(0).getShapes().addChart(ChartType.ClusteredColumn, 100, 100, 500, 350); chart.validateChartLayout(); double x = chart.getPlotArea().getActualX(); double y = chart.getPlotArea().getActualY(); double w = chart.getPlotArea().getActualWidth(); double h = chart.getPlotArea().getActualHeight(); } finally { if (pres != null) pres.dispose(); } ``` ## **Hide Chart Elements** This topic helps you to understand how to hide information from chart. Using Aspose.Slides for Android via Java you can hide **Title, Vertical Axis, Horizontal Axis** and **Grid Lines** from chart. Below code example shows how to use these properties. ```java import com.aspose.slides.*; import java.awt.Color; Presentation pres = new Presentation(); try { ISlide slide = pres.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.LineWithMarkers, 140, 118, 320, 370); //Hiding chart Title chart.setTitle(false); ///Hiding Values axis chart.getAxes().getVerticalAxis().setVisible(false); //Category Axis visibility chart.getAxes().getHorizontalAxis().setVisible(false); //Hiding Legend chart.setLegend(false); //Hiding MajorGridLines chart.getAxes().getHorizontalAxis().getMajorGridLinesFormat().getLine().getFillFormat().setFillType(FillType.NoFill); IChartSeriesCollection seriesCollection = chart.getChartData().getSeries(); while (seriesCollection.size() > 1) { seriesCollection.removeAt(seriesCollection.size() - 1); } IChartSeries series = seriesCollection.get_Item(0); series.getMarker().setSymbol(MarkerStyleType.Circle); series.getLabels().getDefaultDataLabelFormat().setShowValue(true); series.getLabels().getDefaultDataLabelFormat().setPosition(LegendDataLabelPosition.Top); series.getMarker().setSize(15); //Setting series line color series.getFormat().getLine().getFillFormat().setFillType(FillType.Solid); series.getFormat().getLine().getFillFormat().getSolidFillColor().setColor(Color.MAGENTA); series.getFormat().getLine().setDashStyle(LineDashStyle.Solid); pres.save("HideInformationFromChart.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` ## **FAQ** ### Do external Excel workbooks work as a data source, and how does that affect recalculation? Yes. A chart can reference an external workbook: when you connect or refresh the external source, formulas and values are taken from that workbook, and the chart reflects the updates during open/edit operations. The API lets you [specify the external workbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chartdata/#setExternalWorkbook-java.lang.String-boolean-) path and manage the linked data. ### Can I compute and display trendlines without implementing regression myself? Yes. [Trendlines](https://docs.aspose.com/slides/androidjava/trend-line/) (linear, exponential, and others) are added and updated by Aspose.Slides; their parameters are recalculated from the series data automatically, so you don’t need to implement your own calculations. ### If a presentation has multiple charts with external links, can I control which workbook each chart uses for computed values? Yes. Each chart can point to its own [external workbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chartdata/#setExternalWorkbook-java.lang.String-boolean-), or you can create/replace an external workbook per chart independently of the others. # Manage Chart Data Labels in Presentations on Android > Learn to add and format chart data labels in PowerPoint presentations using Aspose.Slides for Android via Java for more engaging slides. Source: https://docs.aspose.com/slides/androidjava/chart-data-label/ Updated: 2026-11-06 ## **Introduction** Data labels display information about chart series and individual data points, helping readers identify values and understand the chart. This article explains how to format values, display percentages, read label text, control labels beyond the axis maximum, adjust category axis label spacing, and position pie chart labels. ## **Count Visible Data Labels** Use [getCountOfVisibleDataLabels](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelcollection/#getCountOfVisibleDataLabels--) to check how many data labels are enabled for display before publishing a presentation. Unlike [getCount](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelcollection/#getCount--), which returns the total number of labels in the collection, it takes the series defaults and individual label settings into account. This example creates a column chart with one series and three data points. It accesses the series' label collection through [getLabels](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getLabels--) and prints the visible count as the settings change: **0, 3, 2, 3**. The total count remains **3**. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 500, 300); chart.getChartData().getSeries().clear(); chart.getChartData().getCategories().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); IChartDataCell seriesCell = workbook.getCell(0, 0, 1, "Values"); IChartSeries series = chart.getChartData().getSeries().add(seriesCell, chart.getType()); for (int i = 0; i < 3; i++) { IChartDataCell categoryCell = workbook.getCell(0, i + 1, 0, "Category " + (i + 1)); chart.getChartData().getCategories().add(categoryCell); IChartDataCell valueCell = workbook.getCell(0, i + 1, 1, (i + 1) * 10); series.getDataPoints().addDataPointForBarSeries(valueCell); } IDataLabelCollection labels = series.getLabels(); System.out.println("Total: " + labels.getCount() + "; visible: " + labels.getCountOfVisibleDataLabels()); // Total: 3; visible: 0 labels.getDefaultDataLabelFormat().setShowValue(true); System.out.println("Visible: " + labels.getCountOfVisibleDataLabels()); // Visible: 3 labels.get_Item(1).getDataLabelFormat().setShowValue(false); System.out.println("Visible: " + labels.getCountOfVisibleDataLabels()); // Visible: 2 labels.get_Item(1).getDataLabelFormat().setShowLegendKey(true); System.out.println("Visible: " + labels.getCountOfVisibleDataLabels()); // Visible: 3 } finally { presentation.dispose(); } ``` The series' [getDefaultDataLabelFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelcollection/#getDefaultDataLabelFormat--) supplies the default settings. Passing `true` to [setShowValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/#setShowValue-boolean-) there displays values for all three labels. Passing `false` through one label's [getDataLabelFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabel/#getDataLabelFormat--) overrides that setting for the selected label. Passing `true` to [setShowLegendKey](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/#setShowLegendKey-boolean-) makes that label count as visible again, even though its value remains hidden. The visible count reflects visibility settings. It does not measure whether labels overlap, are clipped, or are readable in the rendered chart. ## **Set Data Precision in Chart Data Labels** Use [setNumberFormatOfValues](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#setNumberFormatOfValues-java.lang.String-) to format series values. This example creates a line chart with default data, displays its data table, and enables value labels for the first series. The format `#,##0.00` displays a thousands separator and two decimal places without changing the underlying values. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Line, 50, 50, 450, 300); chart.setDataTable(true); IChartSeries series = chart.getChartData().getSeries().get_Item(0); series.setNumberFormatOfValues("#,##0.00"); series.getLabels().getDefaultDataLabelFormat().setShowValue(true); presentation.save("PrecisionOfDatalabels_out.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` To format the numeric cells in a chart's embedded workbook, see [Set Custom Number Formats for Workbook Cells](https://docs.aspose.com/slides/androidjava/chart-workbook/#set-custom-number-formats-for-workbook-cells). That example also shows value labels following their source cell formats while preserving the stored numeric values. ## **Display Percentages as Labels** For a stacked column chart, calculate each value as a percentage of its category total and assign the text to the text frame returned by [getTextFrameForOverriding](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ioverridabletext/#getTextFrameForOverriding--). This example uses the default chart data and displays percentages with two decimal places in an 8-point font. Categories with a total of zero are skipped to avoid division by zero. Recalculate the custom label text if the chart data changes. ```java import com.aspose.slides.*; import java.util.Locale; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.StackedColumn, 20, 20, 400, 400); double[] categoryTotals = new double[chart.getChartData().getCategories().size()]; for (int k = 0; k < chart.getChartData().getCategories().size(); k++) { for (int i = 0; i < chart.getChartData().getSeries().size(); i++) { IChartSeries series = chart.getChartData().getSeries().get_Item(i); Number pointValue = (Number) series.getDataPoints().get_Item(k).getValue().getData(); categoryTotals[k] += pointValue.doubleValue(); } } for (int x = 0; x < chart.getChartData().getSeries().size(); x++) { IChartSeries series = chart.getChartData().getSeries().get_Item(x); series.getLabels().getDefaultDataLabelFormat().setShowLegendKey(false); for (int j = 0; j < series.getDataPoints().size(); j++) { IDataLabel label = series.getDataPoints().get_Item(j).getLabel(); if (categoryTotals[j] == 0) { continue; } Number pointValue = (Number) series.getDataPoints().get_Item(j).getValue().getData(); double dataPointPercent = (pointValue.doubleValue() / categoryTotals[j]) * 100; IPortion portion = new Portion(); portion.setText(String.format(Locale.US, "%.2f %%", dataPointPercent)); portion.getPortionFormat().setFontHeight(8f); label.getTextFrameForOverriding().setText(""); IParagraph paragraph = label.getTextFrameForOverriding().getParagraphs().get_Item(0); paragraph.getPortions().add(portion); label.getDataLabelFormat().setShowValue(true); label.getDataLabelFormat().setShowSeriesName(false); label.getDataLabelFormat().setShowPercentage(false); label.getDataLabelFormat().setShowLegendKey(false); label.getDataLabelFormat().setShowCategoryName(false); label.getDataLabelFormat().setShowBubbleSize(false); } } presentation.save("DisplayPercentageAsLabels_out.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Set the Percentage Sign with Chart Data Labels** When values are stored as fractions, use [setNumberFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/#setNumberFormat-java.lang.String-) to display percentages. Pass `false` to [setNumberFormatLinkedToSource](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/#setNumberFormatLinkedToSource-boolean-) to apply the label format independently of the source cells. This example creates a 100% stacked column chart with red and blue series across four categories. Each pair of values adds up to 1. The label format `0.0%` displays 0.30 as 30.0%, while the vertical axis uses two decimal places. Both series use white, 10-point label text. ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.PercentsStackedColumn, 20, 20, 500, 400); chart.getAxes().getVerticalAxis().setNumberFormatLinkedToSource(false); chart.getAxes().getVerticalAxis().setNumberFormat("0.00%"); chart.getChartData().getSeries().clear(); chart.getChartData().getCategories().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); int worksheetIndex = 0; for (int i = 0; i < 4; i++) { IChartDataCell categoryCell = workbook.getCell(worksheetIndex, i + 1, 0, "Category " + (i + 1)); chart.getChartData().getCategories().add(categoryCell); } String[] seriesNames = { "Reds", "Blues" }; int[] seriesColors = { Color.RED, Color.BLUE }; double[][] values = { { 0.30, 0.50, 0.80, 0.65 }, { 0.70, 0.50, 0.20, 0.35 } }; for (int i = 0; i < seriesNames.length; i++) { IChartDataCell seriesCell = workbook.getCell(worksheetIndex, 0, i + 1, seriesNames[i]); IChartSeries series = chart.getChartData().getSeries().add(seriesCell, chart.getType()); for (int j = 0; j < 4; j++) { IChartDataCell valueCell = workbook.getCell(worksheetIndex, j + 1, i + 1, values[i][j]); series.getDataPoints().addDataPointForBarSeries(valueCell); } series.getFormat().getFill().setFillType(FillType.Solid); series.getFormat().getFill().getSolidFillColor().setColor(seriesColors[i]); IDataLabelFormat labelFormat = series.getLabels().getDefaultDataLabelFormat(); labelFormat.setShowValue(true); labelFormat.setNumberFormatLinkedToSource(false); labelFormat.setNumberFormat("0.0%"); labelFormat.getTextFormat().getPortionFormat().setFontHeight(10); labelFormat.getTextFormat().getPortionFormat().getFillFormat().setFillType(FillType.Solid); labelFormat.getTextFormat().getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.WHITE); } presentation.save("SetDataLabelsPercentageSign_out.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Read the Actual Text of Data Labels** Use [getActualLabelText](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabel/#getActualLabelText--) to retrieve the text produced by a data label's settings. This is useful when extracting labels for reports, searching presentation content, or validating generated charts. In the example below, the default [data label format](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/) combines each category name, series name, and value. One point formats its value as a percentage, and another uses custom text from [getTextFrameForOverriding](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ioverridabletext/#getTextFrameForOverriding--). ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 300); chart.getChartData().getSeries().clear(); chart.getChartData().getCategories().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); IChartDataCell firstCategoryCell = workbook.getCell(0, 1, 0, "Q1"); chart.getChartData().getCategories().add(firstCategoryCell); IChartDataCell secondCategoryCell = workbook.getCell(0, 2, 0, "Q2"); chart.getChartData().getCategories().add(secondCategoryCell); IChartDataCell northSeriesCell = workbook.getCell(0, 0, 1, "North"); IChartSeries north = chart.getChartData().getSeries().add(northSeriesCell, chart.getType()); IChartDataCell northFirstValueCell = workbook.getCell(0, 1, 1, 0.25); north.getDataPoints().addDataPointForBarSeries(northFirstValueCell); IChartDataCell northSecondValueCell = workbook.getCell(0, 2, 1, 0.75); north.getDataPoints().addDataPointForBarSeries(northSecondValueCell); IChartDataCell southSeriesCell = workbook.getCell(0, 0, 2, "South"); IChartSeries south = chart.getChartData().getSeries().add(southSeriesCell, chart.getType()); IChartDataCell southFirstValueCell = workbook.getCell(0, 1, 2, 0.40); south.getDataPoints().addDataPointForBarSeries(southFirstValueCell); IChartDataCell southSecondValueCell = workbook.getCell(0, 2, 2, 0.60); south.getDataPoints().addDataPointForBarSeries(southSecondValueCell); for (IChartSeries series : chart.getChartData().getSeries()) { IDataLabelFormat format = series.getLabels().getDefaultDataLabelFormat(); format.setShowCategoryName(true); format.setShowSeriesName(true); format.setShowValue(true); } north.getLabels().get_Item(1).getDataLabelFormat().setNumberFormatLinkedToSource(false); north.getLabels().get_Item(1).getDataLabelFormat().setNumberFormat("0%"); south.getLabels().get_Item(0).getTextFrameForOverriding().setText("Reviewed"); for (IChartSeries series : chart.getChartData().getSeries()) { for (IChartDataPoint point : series.getDataPoints()) { IDataLabel label = point.getLabel(); if (!label.isVisible()) { continue; } System.out.println("Value: " + point.getValue().getData() + "; label: " + label.getActualLabelText()); } } } finally { presentation.dispose(); } ``` The number stored in a data point remains `0.75`, even when its label shows `75%` along with the category and series names. Custom text replaces the generated label text. [getActualLabelText](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabel/#getActualLabelText--) returns the resulting label string in either case. Check [isVisible](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabel/#isVisible--) separately, as shown above, when you want to extract only visible labels. ## **Control Data Labels Beyond the Axis Maximum** When you limit an axis range manually, some data points may exceed its maximum. Use [setShowDataLabelsOverMaximum](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#setShowDataLabelsOverMaximum-boolean-) to control whether their data labels are shown. This setting changes label visibility; it does not change the axis range or the underlying data values. The example below creates a 2D clustered column chart with values of 60 and 120. It passes `false` to [setAutomaticMaxValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setAutomaticMaxValue-boolean-) and sets the maximum to 100 with [setMaxValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setMaxValue-double-) on the vertical axis. The first slide allows labels beyond the maximum; a copy of that slide disables them. Both slides are saved in `DataLabelsOverMaximum.pptx`. Enable value labels with [setShowValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/#setShowValue-boolean-). The chart-level setting does not enable value display by itself or override an individual label's disabled value display. This example enables values for the entire series and uses [setPosition](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/#setPosition-int-) to place labels at the outside end of each column. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 600, 400); chart.setLegend(false); chart.getChartData().getSeries().clear(); chart.getChartData().getCategories().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); IChartDataCell firstCategory = workbook.getCell(0, 1, 0, "Within range"); IChartDataCell secondCategory = workbook.getCell(0, 2, 0, "Above maximum"); chart.getChartData().getCategories().add(firstCategory); chart.getChartData().getCategories().add(secondCategory); IChartDataCell seriesName = workbook.getCell(0, 0, 1, "Values"); IChartSeries series = chart.getChartData().getSeries().add(seriesName, chart.getType()); IChartDataCell firstValue = workbook.getCell(0, 1, 1, 60); IChartDataCell secondValue = workbook.getCell(0, 2, 1, 120); series.getDataPoints().addDataPointForBarSeries(firstValue); series.getDataPoints().addDataPointForBarSeries(secondValue); series.getLabels().getDefaultDataLabelFormat().setShowValue(true); series.getLabels().getDefaultDataLabelFormat().setPosition(LegendDataLabelPosition.OutsideEnd); chart.getAxes().getVerticalAxis().setAutomaticMaxValue(false); chart.getAxes().getVerticalAxis().setMaxValue(100); chart.setShowDataLabelsOverMaximum(true); ISlide secondSlide = presentation.getSlides().addClone(slide); IChart secondChart = (IChart) secondSlide.getShapes().get_Item(0); secondChart.setShowDataLabelsOverMaximum(false); presentation.save("DataLabelsOverMaximum.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The following images show the saved slides rendered by Microsoft PowerPoint. With `true`, the label **120** is visible at the upper boundary; with `false`, it is hidden. The label **60** remains visible, the axis maximum stays at **100**, and the second data point remains **120** in both cases. | setShowDataLabelsOverMaximum(true) | setShowDataLabelsOverMaximum(false) | | --- | --- | | ![PowerPoint chart showing the value label 120 with an axis maximum of 100](https://docs.aspose.com/slides/androidjava/chart-data-label/data-labels-over-maximum-true.png) | ![PowerPoint chart hiding the value label 120 with an axis maximum of 100](https://docs.aspose.com/slides/androidjava/chart-data-label/data-labels-over-maximum-false.png) | This example uses a 2D column chart with a value axis. Charts without a value axis, such as pie and doughnut charts, do not have an axis maximum to limit in this way. ## **Set Label Distance from an Axis** Use [setLabelOffset](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setLabelOffset-int-) to control the distance between category axis labels and the axis. The value is a percentage of the maximum font size of the axis labels. This example creates a clustered column chart and sets the horizontal axis label offset to 500. This setting affects category axis labels rather than labels attached to individual data points. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 300); chart.getAxes().getHorizontalAxis().setLabelOffset(500); presentation.save("SetCategoryAxisLabelDistance_out.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Adjust Label Location** On a pie chart, adjust data label positions to improve spacing and make room for leader lines. This example displays the value of the first data point, places its label outside the slice, and adjusts its horizontal and vertical offsets using [setX](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ilayoutable/#setX-float-) and [setY](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ilayoutable/#setY-float-). These offsets are relative to the chart width and height, respectively. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Pie, 50, 50, 200, 200); IChartSeriesCollection series = chart.getChartData().getSeries(); IDataLabel label = series.get_Item(0).getLabels().get_Item(0); label.getDataLabelFormat().setShowValue(true); label.getDataLabelFormat().setPosition(LegendDataLabelPosition.OutsideEnd); label.setX(0.71f); label.setY(0.04f); presentation.save("presentation.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ![Pie chart with an adjusted data label position](https://docs.aspose.com/slides/androidjava/chart-data-label/pie-chart-adjusted-label.png) ## **Format Leader Lines** When pie chart labels sit outside their slices, leader lines help readers match each value to the correct slice. A contrasting color and a slightly thicker line can make these connections easier to follow, while transparency and a dashed style keep the lines visually unobtrusive. Use [getLeaderLinesFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelcollection/#getLeaderLinesFormat--) to format leader lines at the series' data label collection level. The settings in `series.getLabels().getLeaderLinesFormat().getLine()` apply to the collection, rather than to an individual label. This example creates a pie chart with default data, displays values outside the slices, and enables [setShowLeaderLines](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/#setShowLeaderLines-boolean-). It moves two labels farther from their slices using [setX](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ilayoutable/#setX-float-) and [setY](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ilayoutable/#setY-float-) offsets, expressed as fractions of the chart width and height. No input presentation is required. The line's [getFillFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ilineformat/#getFillFormat--) sets a solid blue color with an alpha value of 191 out of 255, giving approximately 25% transparency. [setWidth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ilineformat/#setWidth-double-) sets the thickness to 2 points, and [setDashStyle](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ilineformat/#setDashStyle-byte-) makes the line dashed. ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Pie, 80, 50, 560, 400); chart.setLegend(false); IChartSeries series = chart.getChartData().getSeries().get_Item(0); IDataLabelFormat labelFormat = series.getLabels().getDefaultDataLabelFormat(); labelFormat.setShowValue(true); labelFormat.setPosition(LegendDataLabelPosition.OutsideEnd); labelFormat.setShowLeaderLines(true); // Move two labels farther away from their slices. series.getLabels().get_Item(0).setX(0.10f); series.getLabels().get_Item(0).setY(-0.05f); series.getLabels().get_Item(1).setX(-0.10f); series.getLabels().get_Item(1).setY(0.05f); ILineFormat line = series.getLabels().getLeaderLinesFormat().getLine(); line.getFillFormat().setFillType(FillType.Solid); line.getFillFormat().getSolidFillColor().setColor(Color.argb(191, 30, 90, 160)); line.setWidth(2); line.setDashStyle(LineDashStyle.Dash); presentation.save("FormattedLeaderLines.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` Enabling leader lines does not guarantee that a line will appear for every label. Visibility depends on label placement and the chart's layout behavior. In this example, the two displaced labels have visible leader lines; the labels that remain close to their slices do not need them. The following image shows the saved `FormattedLeaderLines.pptx` rendered with Aspose.Slides: ![Pie chart with blue, semitransparent dashed leader lines connecting two outside labels to their slices](https://docs.aspose.com/slides/androidjava/chart-data-label/formatted-leader-lines.png) ## **Add Multiple Rows of Data Labels Above a Column Chart** This example creates a column chart with two rows of data labels above the plot area. Series A displays the visible columns, while Series B and Series C provide the additional labels. Their columns are hidden by removing the fill and outline. The [ChartSeriesGroup.setOverlap](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chartseriesgroup/#setOverlap-byte-) method aligns all three series with the same category centers. The [ChartPlotArea](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chartplotarea/) settings reserve space for the label rows. After [Chart.validateChartLayout](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chart/#validateChartLayout--) calculates the default positions, [DataLabel.setX](https://reference.aspose.com/slides/androidjava/com.aspose.slides/datalabel/#setX-float-) and [DataLabel.setY](https://reference.aspose.com/slides/androidjava/com.aspose.slides/datalabel/#setY-float-) preserve the horizontal alignment and apply vertical offsets to arrange the labels in two rows. The numbers remain data labels linked to the series values; only the row headings are separate text shapes. ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 40, 40, 640, 200); chart.setTitle(false); chart.setLegend(false); chart.getTextFormat().getPortionFormat().setFontHeight(12); chart.getChartData().getSeries().clear(); chart.getChartData().getCategories().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); workbook.clear(0); String[] categories = {"North", "South", "East", "West"}; String[] seriesNames = {"Series A", "Series B", "Series C"}; double[][] seriesValues = { {35, 42, 28, 47}, {22, 31, 19, 26}, {12, 16, 14, 18} }; for (int categoryIndex = 0; categoryIndex < categories.length; categoryIndex++) { IChartDataCell categoryCell = workbook.getCell(0, categoryIndex + 1, 0, categories[categoryIndex]); chart.getChartData().getCategories().add(categoryCell); } for (int seriesIndex = 0; seriesIndex < seriesNames.length; seriesIndex++) { IChartDataCell seriesCell = workbook.getCell(0, 0, seriesIndex + 1, seriesNames[seriesIndex]); IChartSeries series = chart.getChartData().getSeries().add(seriesCell, ChartType.ClusteredColumn); for (int categoryIndex = 0; categoryIndex < categories.length; categoryIndex++) { IChartDataCell valueCell = workbook.getCell(0, categoryIndex + 1, seriesIndex + 1, seriesValues[seriesIndex][categoryIndex]); series.getDataPoints().addDataPointForBarSeries(valueCell); } if (seriesIndex > 0) { // Hide the columns of B and C, but keep their data labels. series.getFormat().getFill().setFillType(FillType.NoFill); series.getFormat().getLine().getFillFormat().setFillType(FillType.NoFill); series.getLabels().getDefaultDataLabelFormat().setShowValue(true); series.getLabels().getDefaultDataLabelFormat().getTextFormat().getPortionFormat().setFontHeight(12); IFillFormat labelFill = series.getLabels().getDefaultDataLabelFormat().getTextFormat().getPortionFormat().getFillFormat(); labelFill.setFillType(FillType.Solid); labelFill.getSolidFillColor().setColor(Color.BLACK); series.getLabels().getDefaultDataLabelFormat().setPosition(LegendDataLabelPosition.InsideBase); } } // Align all three series with the same category centers. chart.getChartData().getSeries().get_Item(0).getParentSeriesGroup().setOverlap((byte) 100); // Use fewer gridlines for this compact example. chart.getAxes().getVerticalAxis().setAutomaticMajorUnit(false); chart.getAxes().getVerticalAxis().setMajorUnit(10); // Reserve space above the plot for two rows of data labels. chart.getPlotArea().setLayoutTargetType(LayoutTargetType.Inner); chart.getPlotArea().setX(0.15f); chart.getPlotArea().setY(0.32f); chart.getPlotArea().setWidth(0.80f); chart.getPlotArea().setHeight(0.48f); chart.validateChartLayout(); for (int seriesIndex = 1; seriesIndex < seriesNames.length; seriesIndex++) { IChartSeries series = chart.getChartData().getSeries().get_Item(seriesIndex); float rowTop = seriesIndex == 1 ? 0.15f : 0.03f; for (int categoryIndex = 0; categoryIndex < categories.length; categoryIndex++) { IDataLabel dataLabel = series.getDataPoints().get_Item(categoryIndex).getLabel(); // Keep the default horizontal position. Y is an offset from // the default label position, expressed as a chart-height fraction. dataLabel.setX(0); dataLabel.setY(rowTop - dataLabel.getActualY() / chart.getHeight()); } // Only the row heading is a separate text shape. IAutoShape rowHeading = slide.getShapes().addAutoShape(ShapeType.Rectangle, chart.getX(), chart.getY() + rowTop * chart.getHeight(), 85, 18); rowHeading.getFillFormat().setFillType(FillType.NoFill); rowHeading.getLineFormat().getFillFormat().setFillType(FillType.NoFill); rowHeading.addTextFrame(seriesNames[seriesIndex]); rowHeading.getTextFrame().getTextFrameFormat().setMarginTop(0); rowHeading.getTextFrame().getTextFrameFormat().setMarginBottom(0); IPortionFormat headingFormat = rowHeading.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat(); headingFormat.setFontHeight(12); headingFormat.getFillFormat().setFillType(FillType.Solid); headingFormat.getFillFormat().getSolidFillColor().setColor(Color.BLACK); } presentation.save("multiple-rows-of-labels.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ![Column chart with two rows of data labels above the plot area](https://docs.aspose.com/slides/androidjava/chart-data-label/multiple-rows-of-labels.png) ## **FAQ** **How can I prevent data labels from overlapping on dense charts?** Combine automatic label placement, leader lines, and reduced font size; if necessary, hide some fields (for example, the category) or show labels only for extreme values or key points. **How can I disable labels only for zero, negative, or empty values?** Filter data points before enabling labels and turn off display for values of 0, negative values, or missing values according to a defined rule. **How can I ensure a consistent label style when exporting to PDF/images?** Explicitly set the font family and size and verify that the font is available in the rendering environment to avoid fallback. # Manage Chart Data Markers in Presentations on Android > Customize chart data markers in Aspose.Slides for Android, boosting presentation impact across PPT and PPTX formats with clear Java code examples. Source: https://docs.aspose.com/slides/androidjava/chart-data-marker/ Updated: 2026-08-05 ## **Overview** This article explains how to work with chart data markers in Aspose.Slides. It shows how to create a chart, access a series and its data points, apply picture fills to markers at the data-point level, adjust marker size, and save the updated presentation. It also notes that standard marker shapes are available through the `MarkerStyleType` enumeration and that marker appearance is preserved when exporting charts to raster formats or SVG. ## **Set Chart Marker Options** The markers can be set on chart data points inside particular series. In order to set chart marker options. Please follow the steps below: - Instantiate [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class. - Creating the default chart. - Set the picture. - Take first chart series. - Add new data point. - Write presentation to disk. In the example given below, we have set the chart marker options on data points level. ```java import com.aspose.slides.*; import java.io.File; import java.io.FileInputStream; import java.io.IOException; // Creating empty presentation Presentation pres = new Presentation(); try { // Access first slide ISlide slide = pres.getSlides().get_Item(0); // Creating the default chart IChart chart = slide.getShapes().addChart(ChartType.LineWithMarkers, 0, 0, 400, 400); // Getting the default chart data WorkSheet index int defaultWorksheetIndex = 0; // Getting the chart data WorkSheet IChartDataWorkbook fact = chart.getChartData().getChartDataWorkbook(); // Delete demo series chart.getChartData().getSeries().clear(); // Add new series chart.getChartData().getSeries().add(fact.getCell(defaultWorksheetIndex, 1, 1, "Series 1"), chart.getType()); // Load the picture 1 IPPImage imgx1 = pres.getImages().addImage(new FileInputStream(new File("Desert.jpg"))); // Load the picture 2 IPPImage imgx2 = pres.getImages().addImage(new FileInputStream(new File("Tulips.jpg"))); // Take first chart series IChartSeries series = chart.getChartData().getSeries().get_Item(0); // Add new point (1:3) there. IChartDataPoint point = series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 1, 1, (double) 4.5)); point.getMarker().getFormat().getFill().setFillType(FillType.Picture); point.getMarker().getFormat().getFill().getPictureFillFormat().getPicture().setImage(imgx1); point = series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 2, 1, (double) 2.5)); point.getMarker().getFormat().getFill().setFillType(FillType.Picture); point.getMarker().getFormat().getFill().getPictureFillFormat().getPicture().setImage(imgx2); point = series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 3, 1, (double) 3.5)); point.getMarker().getFormat().getFill().setFillType(FillType.Picture); point.getMarker().getFormat().getFill().getPictureFillFormat().getPicture().setImage(imgx1); point = series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 4, 1, (double) 4.5)); point.getMarker().getFormat().getFill().setFillType(FillType.Picture); point.getMarker().getFormat().getFill().getPictureFillFormat().getPicture().setImage(imgx2); // Changing the chart series marker series.getMarker().setSize(15); // Save presentation with chart pres.save("MarkOptions_out.pptx", SaveFormat.Pptx); } catch (IOException e) { } finally { if (pres != null) pres.dispose(); } ``` ## **FAQ** ### Which marker shapes are available out of the box? Standard shapes are available (circle, square, diamond, triangle, etc.); the list is defined by the [MarkerStyleType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/markerstyletype/) class. If you need a non-standard shape, use a marker with a picture fill to emulate custom visuals. ### Are markers preserved when exporting a chart to an image or SVG? Yes. When rendering charts to [raster formats](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-png/) or saving [shapes as SVG](https://docs.aspose.com/slides/androidjava/render-a-slide-as-an-svg-image/), markers retain their appearance and settings, including size, fill, and outline. # Customize Chart Data Tables in Presentations on Android > Customize chart data table fonts, borders, and legend keys in PowerPoint presentations using Aspose.Slides for Android via Java. Source: https://docs.aspose.com/slides/androidjava/chart-data-table/ Updated: 2026-09-24 ## **Overview** Aspose.Slides for Android via Java lets you display a chart's data table and customize its text formatting, borders, and legend keys. This article explains how to enable the table, format its text, control each type of border, and show or hide legend keys. The examples save the configured charts in PPTX files. ## **Set Font Properties** To display a chart's data table, pass `true` to [setDataTable](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chart/#setDataTable-boolean-). Use [getChartDataTable](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chart/#getChartDataTable--) to access the table and configure its text formatting. 1. Load the presentation using the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) class. 1. Add a clustered column chart to the first slide. 1. Enable the chart's data table. 1. Enable bold text with [setFontBold](https://reference.aspose.com/slides/androidjava/com.aspose.slides/baseportionformat/#setFontBold-byte-) and pass `20` to [setFontHeight](https://reference.aspose.com/slides/androidjava/com.aspose.slides/baseportionformat/#setFontHeight-float-) for 20-point text. 1. Save the modified presentation. The following example requires `test.pptx` in the working directory with at least one slide. It adds a chart with default data at position (50, 50), with a width of 600 points and a height of 400 points. The saved `output.pptx` contains the chart with its data table enabled and the specified font settings applied. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("test.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 600, 400); chart.setDataTable(true); IChartPortionFormat portionFormat = chart.getChartDataTable().getTextFormat().getPortionFormat(); portionFormat.setFontBold(NullableBool.True); portionFormat.setFontHeight(20); presentation.save("output.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Customize Data Table Borders** Enable the table with [IChart.setDataTable](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#setDataTable-boolean-) and access it through [IChart.getChartDataTable](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#getChartDataTable--). You can control three types of borders independently: - [setBorderHorizontal](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatatable/#setBorderHorizontal-boolean-) controls horizontal cell borders. - [setBorderVertical](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatatable/#setBorderVertical-boolean-) controls vertical cell borders. - [setBorderOutline](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatatable/#setBorderOutline-boolean-) controls the outer border of the table. Pass `true` to each method to display its borders or `false` to hide them. The following example creates a clustered column chart with default data, displays horizontal borders and the outer border, and hides vertical borders. It requires no input file. The chart's position and size are specified in points. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 600, 400); chart.setDataTable(true); IDataTable dataTable = chart.getChartDataTable(); dataTable.setBorderHorizontal(true); dataTable.setBorderVertical(false); dataTable.setBorderOutline(true); presentation.save("data-table-borders.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The comparison below uses the same chart data and legend key setting in all four cases. Starting with all borders enabled, each remaining variant disables just one border setting. The lower-left variant matches the border settings in the example. ![Chart data tables with all borders enabled, no horizontal borders, no vertical borders, and no outer border](https://docs.aspose.com/slides/androidjava/chart-data-table/data-table-borders.png) ## **Show or Hide Legend Keys** Legend keys are small colored markers beside the series names in the data table. They help readers match each table row to a chart series. Pass `true` to [setShowLegendKey](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatatable/#setShowLegendKey-boolean-) to show these markers or `false` to hide them. The chart's separate legend is controlled by [IChart.setLegend](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#setLegend-boolean-). These settings are independent: hiding the separate legend does not hide the keys inside the data table, and hiding the table's keys does not hide the separate legend. The following example creates a chart with default data, enables its data table, and shows legend keys inside it while hiding the separate legend. All table borders are explicitly enabled. No input presentation is required. To hide only the table's keys, pass `false` to [setShowLegendKey](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatatable/#setShowLegendKey-boolean-). ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 600, 400); chart.setDataTable(true); chart.setLegend(false); IDataTable dataTable = chart.getChartDataTable(); dataTable.setBorderHorizontal(true); dataTable.setBorderVertical(true); dataTable.setBorderOutline(true); dataTable.setShowLegendKey(true); presentation.save("data-table-legend-keys.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The comparison below shows the same table with legend keys enabled and disabled. All borders remain enabled, and the separate chart legend is hidden in both cases. ![Chart data tables with legend keys shown on the left and hidden on the right](https://docs.aspose.com/slides/androidjava/chart-data-table/data-table-legend-keys.png) ## **FAQ** **Can I show legend keys in a chart's data table?** Yes. Pass `true` to [setShowLegendKey](https://reference.aspose.com/slides/androidjava/com.aspose.slides/datatable/#setShowLegendKey-boolean-) to display legend keys or `false` to hide them. **Will the data table be preserved when exporting the presentation to PDF, HTML, or images?** Yes. Aspose.Slides renders the chart and its displayed data table as part of the slide when exporting to [PDF](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-pdf/), [HTML](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-html/), or [images](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-png/). **Can I work with data tables in charts loaded from a template?** Yes. For a chart loaded from an existing presentation or template, use [hasDataTable](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chart/#hasDataTable--) and [setDataTable](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chart/#setDataTable-boolean-) to check or change whether its data table is displayed. **How can I find charts that have a data table enabled?** Iterate through the shapes on each slide, identify the charts, and call their [hasDataTable](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chart/#hasDataTable--) method. A value of `true` indicates that the data table is enabled. # Customize Presentation Chart Entities on Android > Understand chart entities in Aspose.Slides for Android and learn to manage series, categories, data points and axes in PowerPoint PPT and PPTX using Java. Source: https://docs.aspose.com/slides/androidjava/chart-entities/ Updated: 2025-11-23 --- lastmod: 2025-11-23T12:56:22+04:00 title: Customize Presentation Chart Entities on Android linktitle: Chart Entities type: docs weight: 30 url: /androidjava/chart-entities/ keywords: - callout - axis - data label - data marker - data table - legend - plot area - data series - error bar - trend line - PowerPoint - presentation - Android - Java - Aspose.Slides description: "Understand chart entities in Aspose.Slides for Android and learn to manage series, categories, data points and axes in PowerPoint PPT and PPTX using Java." --- ## Related articles - [Create and Customize PowerPoint Charts on Android](https://docs.aspose.com/slides/androidjava/powerpoint-charts/) - [Format Presentation Charts on Android](https://docs.aspose.com/slides/androidjava/chart-formatting/) - [Customize Error Bars in Presentation Charts on Android](https://docs.aspose.com/slides/androidjava/error-bar/) # Format Presentation Charts on Android > Learn chart formatting in Aspose.Slides for Android via Java and elevate your PowerPoint presentation with custom axes, fonts, number formats, and rounded chart borders. Source: https://docs.aspose.com/slides/androidjava/chart-formatting/ Updated: 2026-11-09 ## **Overview** This article explains how to format charts in PowerPoint presentations by using Aspose.Slides. It shows how to customize key chart elements such as axes, grid lines, titles, legends, the plot area, and wall fills to improve the appearance and readability of chart data. It also demonstrates how to set font properties for chart text, apply preset numeric formats to chart data, and enable rounded corners for the chart area. Together, these examples show how to control both the visual style and data presentation of charts in a presentation. For separate fills and outlines on rising and falling intervals, see the [stock chart example](https://docs.aspose.com/slides/androidjava/create-chart/#create-stock-charts). ## **Format Chart Entities** Use [IChart](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/) to format chart titles, axes, grid lines, legends, and the plot area. This example creates a line chart with markers and default data, then applies separate text and line styles to its value and category axes. Font sizes and line widths are specified in points; category labels are rotated by 45 degrees. The value axis uses [setNumberFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setNumberFormat-java.lang.String-) independently of the source cells. Its scale runs from -2 to 15, with major intervals of 2 and minor intervals of 0.5. The example also combines percentage formatting with [setDisplayUnit](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setDisplayUnit-int-) set to thousands, so adapt these settings to the meaning and magnitude of your data. The legend stays outside the plot area because [setOverlay](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ilegend/#setOverlay-boolean-) is called with `false`. Back-wall and floor fills are configured through [getBackWall](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#getBackWall--) and [getFloor](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#getFloor--), but these surfaces are only visible in 3D charts. ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.LineWithMarkers, 50, 50, 500, 400); chart.setTitle(true); chart.getChartTitle().addTextFrameForOverriding(""); IPortion chartTitle = chart.getChartTitle().getTextFrameForOverriding().getParagraphs().get_Item(0).getPortions().get_Item(0); chartTitle.setText("Sample Chart"); chartTitle.getPortionFormat().getFillFormat().setFillType(FillType.Solid); chartTitle.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.GRAY); chartTitle.getPortionFormat().setFontHeight(20); chartTitle.getPortionFormat().setFontBold(NullableBool.True); chartTitle.getPortionFormat().setFontItalic(NullableBool.True); chart.getAxes().getVerticalAxis().getMajorGridLinesFormat().getLine().getFillFormat().setFillType(FillType.Solid); chart.getAxes().getVerticalAxis().getMajorGridLinesFormat().getLine().getFillFormat().getSolidFillColor().setColor(Color.BLUE); chart.getAxes().getVerticalAxis().getMajorGridLinesFormat().getLine().setWidth(5); chart.getAxes().getVerticalAxis().getMajorGridLinesFormat().getLine().setDashStyle(LineDashStyle.DashDot); chart.getAxes().getVerticalAxis().getMinorGridLinesFormat().getLine().getFillFormat().setFillType(FillType.Solid); chart.getAxes().getVerticalAxis().getMinorGridLinesFormat().getLine().getFillFormat().getSolidFillColor().setColor(Color.RED); chart.getAxes().getVerticalAxis().getMinorGridLinesFormat().getLine().setWidth(3); chart.getAxes().getVerticalAxis().setNumberFormatLinkedToSource(false); chart.getAxes().getVerticalAxis().setDisplayUnit(DisplayUnitType.Thousands); chart.getAxes().getVerticalAxis().setNumberFormat("0.0%"); chart.getAxes().getVerticalAxis().setAutomaticMajorUnit(false); chart.getAxes().getVerticalAxis().setAutomaticMaxValue(false); chart.getAxes().getVerticalAxis().setAutomaticMinorUnit(false); chart.getAxes().getVerticalAxis().setAutomaticMinValue(false); chart.getAxes().getVerticalAxis().setMaxValue(15f); chart.getAxes().getVerticalAxis().setMinValue(-2f); chart.getAxes().getVerticalAxis().setMinorUnit(0.5f); chart.getAxes().getVerticalAxis().setMajorUnit(2.0f); IChartPortionFormat valueAxisText = chart.getAxes().getVerticalAxis().getTextFormat().getPortionFormat(); valueAxisText.setFontBold(NullableBool.True); valueAxisText.setFontHeight(16); valueAxisText.setFontItalic(NullableBool.True); valueAxisText.getFillFormat().setFillType(FillType.Solid); valueAxisText.getFillFormat().getSolidFillColor().setPresetColor(PresetColor.DarkGreen); valueAxisText.setLatinFont(new FontData("Times New Roman")); chart.getAxes().getVerticalAxis().setTitle(true); chart.getAxes().getVerticalAxis().getTitle().addTextFrameForOverriding(""); IPortion valueAxisTitle = chart.getAxes().getVerticalAxis().getTitle().getTextFrameForOverriding().getParagraphs().get_Item(0).getPortions().get_Item(0); valueAxisTitle.setText("Primary Axis"); valueAxisTitle.getPortionFormat().getFillFormat().setFillType(FillType.Solid); valueAxisTitle.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.GRAY); valueAxisTitle.getPortionFormat().setFontHeight(20); valueAxisTitle.getPortionFormat().setFontBold(NullableBool.True); valueAxisTitle.getPortionFormat().setFontItalic(NullableBool.True); chart.getAxes().getHorizontalAxis().getMajorGridLinesFormat().getLine().getFillFormat().setFillType(FillType.Solid); chart.getAxes().getHorizontalAxis().getMajorGridLinesFormat().getLine().getFillFormat().getSolidFillColor().setColor(Color.rgb(0, 128, 0)); chart.getAxes().getHorizontalAxis().getMajorGridLinesFormat().getLine().setWidth(5); chart.getAxes().getHorizontalAxis().getMinorGridLinesFormat().getLine().getFillFormat().setFillType(FillType.Solid); chart.getAxes().getHorizontalAxis().getMinorGridLinesFormat().getLine().getFillFormat().getSolidFillColor().setColor(Color.YELLOW); chart.getAxes().getHorizontalAxis().getMinorGridLinesFormat().getLine().setWidth(3); IChartPortionFormat categoryAxisText = chart.getAxes().getHorizontalAxis().getTextFormat().getPortionFormat(); categoryAxisText.setFontBold(NullableBool.True); categoryAxisText.setFontHeight(16); categoryAxisText.setFontItalic(NullableBool.True); categoryAxisText.getFillFormat().setFillType(FillType.Solid); categoryAxisText.getFillFormat().getSolidFillColor().setColor(Color.BLUE); categoryAxisText.setLatinFont(new FontData("Arial")); chart.getAxes().getHorizontalAxis().setTitle(true); chart.getAxes().getHorizontalAxis().getTitle().addTextFrameForOverriding(""); IPortion categoryAxisTitle = chart.getAxes().getHorizontalAxis().getTitle().getTextFrameForOverriding().getParagraphs().get_Item(0).getPortions().get_Item(0); categoryAxisTitle.setText("Sample Category"); categoryAxisTitle.getPortionFormat().getFillFormat().setFillType(FillType.Solid); categoryAxisTitle.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.GRAY); categoryAxisTitle.getPortionFormat().setFontHeight(20); categoryAxisTitle.getPortionFormat().setFontBold(NullableBool.True); categoryAxisTitle.getPortionFormat().setFontItalic(NullableBool.True); chart.getAxes().getHorizontalAxis().setTickLabelPosition(TickLabelPositionType.Low); chart.getAxes().getHorizontalAxis().setTickLabelRotationAngle(45); IChartPortionFormat legendText = chart.getLegend().getTextFormat().getPortionFormat(); legendText.setFontBold(NullableBool.True); legendText.setFontHeight(16); legendText.setFontItalic(NullableBool.True); legendText.getFillFormat().setFillType(FillType.Solid); legendText.getFillFormat().getSolidFillColor().setPresetColor(PresetColor.DarkRed); chart.getLegend().setOverlay(false); chart.getBackWall().setThickness(1); chart.getBackWall().getFormat().getFill().setFillType(FillType.Solid); chart.getBackWall().getFormat().getFill().getSolidFillColor().setColor(Color.rgb(255, 165, 0)); chart.getFloor().getFormat().getFill().setFillType(FillType.Solid); chart.getFloor().getFormat().getFill().getSolidFillColor().setColor(Color.RED); chart.getPlotArea().getFormat().getFill().setFillType(FillType.Solid); chart.getPlotArea().getFormat().getFill().getSolidFillColor().setPresetColor(PresetColor.LightCyan); presentation.save("FormattedChart_out.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Set Font Properties for a Chart** Set the default font size for chart text through [Chart.getTextFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chart/#getTextFormat--). The example creates a clustered column chart with a 20-point font and enables value labels for the first series through [setShowValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/#setShowValue-boolean-). Text elements with their own explicit font settings can override the chart default. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 100, 100, 500, 400); chart.getTextFormat().getPortionFormat().setFontHeight(20); chart.getChartData().getSeries().get_Item(0).getLabels().getDefaultDataLabelFormat().setShowValue(true); presentation.save("FontPropertiesForChart.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Set the Numeric Format** Use [IChartDataCell.setPresetNumberFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setPresetNumberFormat-byte-) to apply a built-in number format to chart workbook cells. This example creates a clustered column chart with default, cell-backed data and applies format index 10 (`0.00%`) to each series value cell. This changes how the values are displayed in the workbook without changing the underlying numbers; for example, 0.25 is displayed as 25.00%. Axis and data-label formats can be configured separately. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 500, 400); IChartSeriesCollection series = chart.getChartData().getSeries(); for (IChartSeries chartSeries : series) { for (IChartDataPoint dataPoint : chartSeries.getDataPoints()) { dataPoint.getValue().getAsCell().setPresetNumberFormat((byte) 10); // 0.00% } } presentation.save("PresetNumberFormat_out.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The following table lists built-in number format indices with representative Excel formats for the English (United States) locale. The exact format strings and their display can vary by application and locale, particularly for currency and dates. Some Excel formats also differ from the defaults in the OOXML standard, as described in [Microsoft's number format implementation notes](https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oi29500/17d11129-219b-4e2c-88db-45844d21e528). | Index | Format | | --- | --- | | 0 | `General` | | 1 | `0` | | 2 | `0.00` | | 3 | `#,##0` | | 4 | `#,##0.00` | | 5 | `"$"#,##0_);("$"#,##0)` | | 6 | `"$"#,##0_);[Red]("$"#,##0)` | | 7 | `"$"#,##0.00_);("$"#,##0.00)` | | 8 | `"$"#,##0.00_);[Red]("$"#,##0.00)` | | 9 | `0%` | | 10 | `0.00%` | | 11 | `0.00E+00` | | 12 | `# ?/?` | | 13 | `# ??/??` | | 14 | `m/d/yyyy` | | 15 | `d-mmm-yy` | | 16 | `d-mmm` | | 17 | `mmm-yy` | | 18 | `h:mm AM/PM` | | 19 | `h:mm:ss AM/PM` | | 20 | `h:mm` | | 21 | `h:mm:ss` | | 22 | `m/d/yyyy h:mm` | | 37 | `#,##0_);(#,##0)` | | 38 | `#,##0_);[Red](#,##0)` | | 39 | `#,##0.00_);(#,##0.00)` | | 40 | `#,##0.00_);[Red](#,##0.00)` | | 41 | `_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)` | | 42 | `_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)` | | 43 | `_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)` | | 44 | `_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)` | | 45 | `mm:ss` | | 46 | `[h]:mm:ss` | | 47 | `mm:ss.0` | | 48 | `##0.0E+0` | | 49 | `@` | ## **Set Chart Area Rounded Borders** Call [IChart.setRoundedCorners](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#setRoundedCorners-boolean-) with `true` to round the corners of the chart area. The example creates a clustered column chart and uses [getLineFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishape/#getLineFormat--) to give its outline a solid gray color and a single-line style before saving the presentation. ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 100, 600, 400); chart.getLineFormat().getFillFormat().setFillType(FillType.Solid); chart.getLineFormat().getFillFormat().getSolidFillColor().setColor(Color.GRAY); chart.getLineFormat().setStyle(LineStyle.Single); chart.setRoundedCorners(true); presentation.save("out.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Edit Existing Chart Annotations** A chart can contain custom shapes, such as a text annotation explaining the status of a report. Access these shapes through [IChart.getUserShapes](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#getUserShapes--), also listed under [Chart.getUserShapes](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chart/#getUserShapes--) in the Chart API Reference. The collection returned by [getShapes](https://reference.aspose.com/slides/androidjava/com.aspose.slides/igroupshape/#getShapes--) contains the chart-owned shapes. An ordinary text box placed over a chart belongs to the slide, even if it looks like part of the chart. Iterating through [Slide.getShapes](https://reference.aspose.com/slides/androidjava/com.aspose.slides/baseslide/#getShapes--) finds the chart and ordinary slide shapes, but does not enumerate the individual shapes inside the chart. Chart titles and data labels are separate chart elements, not custom annotations in this collection. Download [chart-annotations.pptx](https://docs.aspose.com/slides/androidjava/chart-formatting/chart-annotations.pptx) and place it in the application's working directory. Its first slide contains a chart with an ungrouped annotation reading "Preliminary results", a chart-owned line, and an ordinary slide text box reading "Slide overlay". The example finds the first chart on that slide and changes the annotation to "Final results" when the report is ready to publish. It checks for an empty collection and only edits an [IAutoShape](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iautoshape/) with a non-null text frame returned by [getTextFrame](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iautoshape/#getTextFrame--) and the expected text. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("chart-annotations.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = null; for (IShape shape : slide.getShapes()) { if (shape instanceof IChart) { chart = (IChart) shape; break; } } if (chart == null || chart.getUserShapes().getShapes().size() == 0) { System.out.println("No chart or chart-owned shapes found."); return; } boolean updated = false; for (IShape shape : chart.getUserShapes().getShapes()) { if (shape instanceof IAutoShape) { IAutoShape annotation = (IAutoShape) shape; if (annotation.getTextFrame() != null && "Preliminary results".equals(annotation.getTextFrame().getText())) { annotation.getTextFrame().setText("Final results"); updated = true; break; } } } if (updated) { presentation.save("chart-annotations-updated.pptx", SaveFormat.Pptx); } else { System.out.println("No matching text annotation found."); } } finally { presentation.dispose(); } ``` The line and the slide text box remain unchanged. The following images show the input and the saved, reopened result: | Before editing | After editing | | --- | --- | | ![Chart annotation reading Preliminary results](https://docs.aspose.com/slides/androidjava/chart-formatting/chart-annotations-before.png) | ![Chart annotation reading Final results](https://docs.aspose.com/slides/androidjava/chart-formatting/chart-annotations-after.png) | The example inspects only the top-level chart-owned shapes. If an annotation is inside an [IGroupShape](https://reference.aspose.com/slides/androidjava/com.aspose.slides/igroupshape/), inspect that group's [getShapes](https://reference.aspose.com/slides/androidjava/com.aspose.slides/igroupshape/#getShapes--) collection as well. Repeat this recursively for nested groups, applying the same text checks to their child shapes. A group itself is a container; do not treat it as a text box. ## **FAQ** **Can I set semi-transparent fills for columns/areas while keeping the border opaque?** Yes. Fill transparency and the outline are configured separately. This is useful for improving the readability of the grid and data in dense visualizations. **How can I deal with data labels when they overlap?** Reduce the font size, disable nonessential label components (for example, categories), adjust the label position, show labels only for selected points if necessary, or switch the format to "value + legend". **Can I apply gradient or pattern fills to series?** Yes. Series support solid, gradient, and pattern fills. In practice, use gradients sparingly and avoid combinations that reduce contrast with the grid and text. ## Related articles - [Customize Chart Axes in Presentations on Android](https://docs.aspose.com/slides/androidjava/chart-axis/) - [Customize Presentation Chart Entities on Android](https://docs.aspose.com/slides/androidjava/chart-entities/) # Customize Chart Legends in Presentations on Android > Customize chart legends with Aspose.Slides for Android via Java to optimize PowerPoint presentations with tailored legend formatting. Source: https://docs.aspose.com/slides/androidjava/chart-legend/ Updated: 2026-09-30 ## **Overview** Aspose.Slides for Android via Java provides options for customizing chart legends in PowerPoint presentations. This article shows how to position and size a legend, set the font size for the whole legend, format an individual legend entry, and hide or restore selected entries. The FAQ covers related behaviors, including reserving space for the legend, displaying multiline labels, and inheriting formatting from the presentation theme. ## **Legend Positioning** Use the legend's [setX](https://reference.aspose.com/slides/androidjava/com.aspose.slides/legend/#setX-float-), [setY](https://reference.aspose.com/slides/androidjava/com.aspose.slides/legend/#setY-float-), [setWidth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/legend/#setWidth-float-), and [setHeight](https://reference.aspose.com/slides/androidjava/com.aspose.slides/legend/#setHeight-float-) methods to specify its position and size as fractions of the chart's dimensions. This example creates a presentation and adds a clustered column chart with default data to the first slide. Dividing the desired legend offsets and dimensions by the chart's width and height converts them to relative values: the legend is offset by 50 points from the chart's top-left corner and sized to 100 by 100 points. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 500, 500); // Express the legend's position and size relative to the chart. chart.getLegend().setX(50 / chart.getWidth()); chart.getLegend().setY(50 / chart.getHeight()); chart.getLegend().setWidth(100 / chart.getWidth()); chart.getLegend().setHeight(100 / chart.getHeight()); presentation.save("legend_position.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Set the Font Size of a Legend** Use the legend's [getTextFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/legend/#getTextFormat--) to access its text formatting and use [setFontHeight](https://reference.aspose.com/slides/androidjava/com.aspose.slides/baseportionformat/#setFontHeight-float-) to set the font size in points. This example creates a chart with default data and sets the legend text to 20 points. It also disables automatic bounds for the vertical axis and sets its range to -5 through 10. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 600, 400); chart.getLegend().getTextFormat().getPortionFormat().setFontHeight(20); chart.getAxes().getVerticalAxis().setAutomaticMinValue(false); chart.getAxes().getVerticalAxis().setMinValue(-5); chart.getAxes().getVerticalAxis().setAutomaticMaxValue(false); chart.getAxes().getVerticalAxis().setMaxValue(10); presentation.save("legend_font_size.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Set the Font Size of an Individual Legend Entry** Use the collection returned by the legend's [getEntries](https://reference.aspose.com/slides/androidjava/com.aspose.slides/legend/#getEntries--) method to access formatting for a specific entry. Entry indices are zero-based, so index `1` refers to the second entry. This example creates a clustered column chart whose default data includes at least two series. It formats the second legend entry with bold, italic, and 20-point blue text. ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 600, 400); IChartTextFormat textFormat = chart.getLegend().getEntries().get_Item(1).getTextFormat(); textFormat.getPortionFormat().setFontBold(NullableBool.True); textFormat.getPortionFormat().setFontHeight(20); textFormat.getPortionFormat().setFontItalic(NullableBool.True); textFormat.getPortionFormat().getFillFormat().setFillType(FillType.Solid); textFormat.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.BLUE); presentation.save("legend_entry_format.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Hide Individual Legend Entries** To exclude an auxiliary series from the legend while keeping its data visible, call [ILegendEntryProperties.setHide](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ilegendentryproperties/#setHide-boolean-) with `true` through [IChartSeries.getRelatedLegendEntry](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getRelatedLegendEntry--). This hides only the selected legend entry; it does not remove the series or its data points. Calling [IChart.setLegend](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#setLegend-boolean-) with `false`, in contrast, hides the entire legend. The example below creates a clustered column chart with multiple series using default data. It hides the second series' legend entry (index `1`) and saves the presentation. It then restores the entry by calling [setHide](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ilegendentryproperties/#setHide-boolean-) with `false` and saves a second copy. The columns remain visible in both files. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 600, 400); chart.setLegend(true); ILegendEntryProperties legendEntry = chart.getChartData().getSeries().get_Item(1).getRelatedLegendEntry(); legendEntry.setHide(true); presentation.save("hidden_legend_entry.pptx", SaveFormat.Pptx); // Restore the same entry without changing the chart data. legendEntry.setHide(false); presentation.save("restored_legend_entry.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The comparison below shows the same chart with all entries visible and with the second entry hidden. The second series' columns remain unchanged. ![Comparison of a chart with all legend entries visible and with Series 2 hidden from the legend; all columns remain visible.](https://docs.aspose.com/slides/androidjava/chart-legend/hide-legend-entry.png) In column, bar, and line charts, legend entries identify series. For pie charts, they identify individual data points (slices), so use [IChartDataPoint.getRelatedLegendEntry](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapoint/#getRelatedLegendEntry--) on the selected slice instead. The API documents this data-point method for the `Pie`, `Pie3D`, `ExplodedPie`, `ExplodedPie3D`, `PieOfPie`, and `BarOfPie` chart types. Do not assume it applies to doughnut charts, which are not included in that list. ## **FAQ** **Can I make the chart allocate space for the legend instead of overlaying it?** Yes. Call [setOverlay](https://reference.aspose.com/slides/androidjava/com.aspose.slides/legend/#setOverlay-boolean-) with `false` to reserve space for the legend instead of allowing it to overlap the plot area. **Can I make multiline legend labels?** Yes. Long labels can wrap when the available width is insufficient. You can also use newline characters in series names to request line breaks. **How do I make the legend follow the presentation theme's color scheme?** Leave the legend's colors, fills, and fonts unset so that it can inherit theme formatting. Explicit formatting overrides the corresponding theme settings. # Customize Plot Areas of Presentation Charts on Android > Discover how to customize chart plot areas in PowerPoint presentations with Aspose.Slides for Android via Java. Improve your slide visuals effortlessly. Source: https://docs.aspose.com/slides/androidjava/chart-plot-area/ Updated: 2026-11-08 ## **Overview** This article shows how to work with a chart’s plot area in Aspose.Slides. It explains how to get the actual position and size of the plot area by validating the chart layout and then reading its X, Y, width, and height values. It also demonstrates how to configure the plot area’s layout mode when the layout is set manually, using `LayoutTargetType` to define whether the plot area is calculated by its inner region or by its outer region together with axes and axis labels. ## **Get Width and Height of a Chart Plot Area** Aspose.Slides for Android via Java provides a simple API for reading the actual position and size of a chart's plot area.  1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class. 1. Access first slide. 1. Add chart with default data. 1. Call method [IChart.validateChartLayout()](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IChart#validateChartLayout--) before to get actual values. 1. Gets actual X location (left) of the chart element relative to the left top corner of the chart. 1. Gets actual top of the chart element relative to the left top corner of the chart. 1. Gets actual width of the chart element. 1. Gets actual height of the chart element. ```java import com.aspose.slides.*; // Create an instance of Presentation class Presentation pres = new Presentation(); try { Chart chart = (Chart)pres.getSlides().get_Item(0).getShapes().addChart(ChartType.ClusteredColumn, 100, 100, 500, 350); chart.validateChartLayout(); double x = chart.getPlotArea().getActualX(); double y = chart.getPlotArea().getActualY(); double w = chart.getPlotArea().getActualWidth(); double h = chart.getPlotArea().getActualHeight(); } finally { if (pres != null) pres.dispose(); } ``` ## **Set the Layout Mode of a Chart Plot Area** Aspose.Slides for Android via Java provides a simple API to set the layout mode of the chart plot area. Methods [**setLayoutTargetType**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ChartPlotArea#setLayoutTargetType-int-) and [**getLayoutTargetType**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ChartPlotArea#getLayoutTargetType--) have been added to [**ChartPlotArea**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ChartPlotArea) class and [**IChartPlotArea**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IChartPlotArea) interface. If the layout of the plot area defined manually this property specifies whether to layout the plot area by its inside (not including axis and axis labels) or outside (including axis and axis labels). There are two possible values which are defined in [**LayoutTargetType**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/LayoutTargetType) enum. - [**LayoutTargetType.Inner**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/LayoutTargetType#Inner) - specifies that the plot area size shall determine the size of the plot area, not including the tick marks and axis labels. - [**LayoutTargetType.Outer**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/LayoutTargetType#Outer) - specifies that the plot area size shall determine the size of the plot area, the tick marks, and the axis labels. [![The same chart frame and manual rectangle are used in both renders. In Inner mode the target follows the grid, leaving ticks and labels outside. In Outer mode they take up room inside the target.](https://docs.aspose.com/slides/androidjava/chart-plot-area/visual-chart-plot-area-2345b90e2bdf.svg)](https://docs.aspose.com/slides/androidjava/chart-plot-area/visual-chart-plot-area-2345b90e2bdf.svg) *The dashed outline marks the same manual rectangle in both renders. Inner leaves room for ticks and labels outside it. Outer fits them inside it.* Sample code is given below. ```java import com.aspose.slides.*; // Create an instance of Presentation class Presentation pres = new Presentation(); try { ISlide slide = pres.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 100, 600, 400); chart.getPlotArea().setX(0.2f); chart.getPlotArea().setY(0.2f); chart.getPlotArea().setWidth(0.7f); chart.getPlotArea().setHeight(0.7f); chart.getPlotArea().setLayoutTargetType(LayoutTargetType.Inner); pres.save("SetLayoutMode_inner.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` ## **FAQ** ### In what units are actual x, actual y, actual width, and actual height returned? In points; 1 inch = 72 points. These are Aspose.Slides coordinate units. ### How does the Plot Area differ from the Chart Area in terms of content? The Plot Area is the data drawing region (series, gridlines, trendlines, etc.); the Chart Area includes the surrounding elements (title, legend, etc.). In 3D charts, the Plot Area also includes the walls/floor and the axes. ### How are the Plot Area’s x, y, width, and height interpreted when layout is manual? They are fractions (0–1) of the chart’s overall size; in this mode, auto-positioning is disabled and the fractions you set are used. ### Why did the Plot Area position change after adding/moving the legend? The legend sits in the chart area outside the Plot Area but affects layout and available space, so the Plot Area may shift when auto-positioning is in effect. (This is standard behavior for PowerPoint charts.) # Manage Chart Data Series in Presentations on Android > Learn how to manage chart series, data points, workbook cells, formatting, overlap, gap width, and negative values in presentations on Android. Source: https://docs.aspose.com/slides/androidjava/chart-series/ Updated: 2026-10-26 ## **Overview** A chart can store its plotted values in workbook cells or directly as numeric literals. An [IChartSeries](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/) represents one set of related values, and each [IChartDataPoint](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapoint/) represents a point in that series. [IChartCategory](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartcategory/) objects provide the labels or grouping values shared by the series. In charts created with default data, series names, categories, and point values use [IChartDataCell](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/) objects from the chart workbook. For a typical category chart, the default workbook uses row 0 for series names, column 0 for category names, and the remaining cells for series values. Worksheet, row, and column indexes passed to [IChartDataWorkbook.getCell](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/#getCell-int-int-int-) are zero-based. This layout is useful when you create a chart with default data, but do not assume that every existing chart uses it. For a loaded presentation, inspect the cells referenced by the series, categories, and data points before changing workbook values. Chart settings have three different scopes: - Series-level settings, such as [IChartSeries.getFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getFormat--), provide the default appearance for all points in one series. - Data-point settings, such as [IChartDataPoint.getFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapoint/#getFormat--), override the series appearance for one point. - Group settings apply to compatible series that belong to the same [IChartSeriesGroup](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseriesgroup/). Access the group through [IChartSeries.getParentSeriesGroup](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getParentSeriesGroup--) when you need to set options such as overlap or gap width. When no explicit point or series fill is set, the chart style and theme determine the automatic appearance. When both series and point formatting are present, the point formatting takes precedence for that point. ![chart-series-powerpoint](https://docs.aspose.com/slides/androidjava/chart-series/chart-series-powerpoint.png) ## **Set Series Values Using Numeric Literals** Use numeric literals when series values come from application data or calculations and do not need worksheet cell references. Call [setDataSourceTypeForValues](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapointcollection/#setDataSourceTypeForValues-int-) with [DataSourceType.DoubleLiterals](https://reference.aspose.com/slides/androidjava/com.aspose.slides/datasourcetype/#DoubleLiterals) before assigning each point's [getValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapoint/#getValue--) result through [setAsLiteralDouble](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idoublechartvalue/#setAsLiteralDouble-double-). The collection setting controls the source type of all point values in that series. Each point value's [getDataSourceType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ibasechartvalue/#getDataSourceType--) method reports the selected type; change it through the collection setting. With `Worksheet`, use [getAsCell](https://reference.aspose.com/slides/androidjava/com.aspose.slides/isinglecellchartvalue/#getAsCell--) to access the referenced cell. With `DoubleLiterals`, use [getAsLiteralDouble](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idoublechartvalue/#getAsLiteralDouble--) or `setAsLiteralDouble` to read or write the number directly. The following example creates a column chart with default series and categories, then assigns calculated values of 10, 20, and so on to the existing points of its first series. It saves the presentation, reopens it, and prints the stored values. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 300); IChartSeries series = chart.getChartData().getSeries().get_Item(0); series.getDataPoints().setDataSourceTypeForValues(DataSourceType.DoubleLiterals); for (int i = 0; i < series.getDataPoints().size(); i++) { series.getDataPoints().get_Item(i).getValue().setAsLiteralDouble((i + 1) * 10); } presentation.save("numeric_literals.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } Presentation reopenedPresentation = new Presentation("numeric_literals.pptx"); try { ISlide reopenedSlide = reopenedPresentation.getSlides().get_Item(0); IChart reopenedChart = (IChart) reopenedSlide.getShapes().get_Item(0); IChartSeries reopenedSeries = reopenedChart.getChartData().getSeries().get_Item(0); for (IChartDataPoint point : reopenedSeries.getDataPoints()) { System.out.println(point.getValue().getAsLiteralDouble()); } } finally { reopenedPresentation.dispose(); } ``` The point value source type is separate from [IChartData.getDataSourceType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#getDataSourceType--), which identifies the chart's internal or external workbook configuration. Using numeric literals does not, by itself, remove the embedded workbook. In this example, the workbook remains available for category labels, series names, and the other series. See [Chart Workbook](https://docs.aspose.com/slides/androidjava/chart-workbook/) for workbook management. For scatter and bubble charts, use [setDataSourceTypeForXValues](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapointcollection/#setDataSourceTypeForXValues-int-) and [setDataSourceTypeForYValues](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapointcollection/#setDataSourceTypeForYValues-int-) to choose the sources for [getXValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapoint/#getXValue--) and [getYValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapoint/#getYValue--). Bubble charts also use [setDataSourceTypeForBubbleSizes](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapointcollection/#setDataSourceTypeForBubbleSizes-int-) for [getBubbleSize](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapoint/#getBubbleSize--). Set each applicable source to `DoubleLiterals` before assigning numbers through that value's `setAsLiteralDouble` method. ## **Set the Chart Series Overlap** [IChartSeries.getOverlap](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getOverlap--) reports how much bars or columns overlap in a 2D chart, from -100 through 100 percent. It is a read-only projection of the setting on the parent series group. Use [IChartSeriesGroup.setOverlap](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseriesgroup/#setOverlap-byte-) to update every compatible series in that group. This option applies to chart types that display grouped bars or columns; it does not affect unrelated series groups in a combination chart. The following example sets the overlap for the group that contains the first series: ```java import com.aspose.slides.*; final int firstSlideIndex = 0; final int firstSeriesIndex = 0; final byte overlapPercent = 30; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(firstSlideIndex); // The new chart contains sample series, categories, and values. IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 200); IChartSeries series = chart.getChartData().getSeries().get_Item(firstSeriesIndex); series.getParentSeriesGroup().setOverlap(overlapPercent); presentation.save("series_overlap.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The result: ![The series overlap](https://docs.aspose.com/slides/androidjava/chart-series/series_overlap.png) ## **Change the Series Fill Color** Use [IChartSeries.getFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getFormat--) to set the default fill for an entire series. If a point already has an explicit fill, its [IChartDataPoint.getFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapoint/#getFormat--) setting overrides the series fill for that point. The following example applies a solid blue fill to the first series: ```java import com.aspose.slides.*; import android.graphics.Color; final int firstSlideIndex = 0; final int firstSeriesIndex = 0; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(firstSlideIndex); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 200); IChartSeries series = chart.getChartData().getSeries().get_Item(firstSeriesIndex); series.getFormat().getFill().setFillType(FillType.Solid); series.getFormat().getFill().getSolidFillColor().setColor(Color.BLUE); presentation.save("series_color.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The result: ![The color of the series](https://docs.aspose.com/slides/androidjava/chart-series/series_color.png) ## **Change the Series Name** A series name is stored in the chart data workbook and is normally displayed in the legend. In the default workbook created for a clustered column chart, cell B1 is at row 0, column 1 and contains the name of the first series. The named constants in the following example make that structure explicit: ```java import com.aspose.slides.*; final int firstSlideIndex = 0; final int worksheetIndex = 0; final int seriesNameRowIndex = 0; final int firstSeriesColumnIndex = 1; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(firstSlideIndex); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 200); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); IChartDataCell seriesNameCell = workbook.getCell(worksheetIndex, seriesNameRowIndex, firstSeriesColumnIndex); seriesNameCell.setValue("Revenue"); presentation.save("series_name.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` You can also update the cell already referenced by [IChartSeries.getName](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getName--). This approach avoids assuming a particular row and column in an existing chart: ```java import com.aspose.slides.*; final int firstSlideIndex = 0; final int firstSeriesIndex = 0; final int firstNameCellIndex = 0; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(firstSlideIndex); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 200); IChartSeries series = chart.getChartData().getSeries().get_Item(firstSeriesIndex); IChartDataCell seriesNameCell = series.getName().getAsCells().get_Item(firstNameCellIndex); seriesNameCell.setValue("Revenue"); presentation.save("series_name.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The result: ![The series name](https://docs.aspose.com/slides/androidjava/chart-series/series_name.png) ### **Create a Series with a Name from Multiple Cells** A composite series name is useful when a product name and a reporting period are stored in separate workbook cells. For example, you can combine `Product A` in B1 and `2026` in C1 into a single series name while keeping both parts linked to their source cells. Use [IChartDataWorkbook.getCellCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/#getCellCollection-java.lang.String-boolean-) to retrieve the name range, then pass that collection to [IChartSeriesCollection.add](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseriescollection/#add-com.aspose.slides.IChartCellCollection-int-). The `skipHiddenCells` argument controls whether hidden cells are included: `true` excludes them, while `false` includes them. This example uses `false` to include every cell in the name range. The following example creates a presentation with one series and two data points. Cells B1:C1 supply only the series name; A2:A3 supply the category labels, and B2:B3 supply the numeric values. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 620, 180); chart.getChartData().getSeries().clear(); chart.getChartData().getCategories().clear(); chart.setLegend(true); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); workbook.clear(0); // These two cells supply the series name. workbook.getCell(0, 0, 1, "Product A"); workbook.getCell(0, 0, 2, "2026"); IChartCellCollection nameCells = workbook.getCellCollection("Sheet1!$B$1:$C$1", false); IChartSeries series = chart.getChartData().getSeries().add(nameCells, ChartType.ClusteredColumn); // Separate cells supply the categories and numeric data points. IChartDataCell northCategory = workbook.getCell(0, 1, 0, "North"); IChartDataCell southCategory = workbook.getCell(0, 2, 0, "South"); chart.getChartData().getCategories().add(northCategory); chart.getChartData().getCategories().add(southCategory); IChartDataCell northValue = workbook.getCell(0, 1, 1, 120); IChartDataCell southValue = workbook.getCell(0, 2, 1, 150); series.getDataPoints().addDataPointForBarSeries(northValue); series.getDataPoints().addDataPointForBarSeries(southValue); presentation.save("composite_series_name.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The resulting series name is `Product A 2026`, with a space between the two cell values. The legend displays this as one entry for both columns. The image below illustrates the result: ![Column chart with North and South values and the composite series name Product A 2026 in the legend](https://docs.aspose.com/slides/androidjava/chart-series/composite_series_name.png) ## **Get the Automatic Series Fill Color** [IChartSeries.getAutomaticSeriesColor](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getAutomaticSeriesColor--) returns the color calculated from the series index and the chart style as an Android ARGB color integer. This is the color used when the series fill has not been explicitly defined. Calling the method reads the calculated color; it does not assign a new fill. The following example prints the automatic color integer of each default series: ```java import com.aspose.slides.*; final int firstSlideIndex = 0; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(firstSlideIndex); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 200); int seriesCount = chart.getChartData().getSeries().size(); for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) { IChartSeries series = chart.getChartData().getSeries().get_Item(seriesIndex); int automaticColor = series.getAutomaticSeriesColor(); System.out.println("Series " + seriesIndex + ": " + automaticColor); } } finally { presentation.dispose(); } ``` The exact integer values depend on the chart style and theme. ## **Set Invert Fill Color for a Chart Series** For bar, column, and bubble series, [IChartSeries.setInvertIfNegative](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#setInvertIfNegative-boolean-) can display negative values with a different fill. Set the regular series fill to solid, enable inversion, and assign the negative-value color through [IChartSeries.getInvertedSolidFillColor](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getInvertedSolidFillColor--). Negative numbers remain unchanged in the workbook; only their display color changes. The following example replaces the default chart data with one series. Worksheet row 0 contains the series name, column 0 contains category names, and column 1 contains the values: ```java import com.aspose.slides.*; import android.graphics.Color; final int firstSlideIndex = 0; final int worksheetIndex = 0; final int headerRowIndex = 0; final int categoryColumnIndex = 0; final int firstSeriesColumnIndex = 1; final int firstDataRowIndex = 1; String[] categoryNames = { "Category 1", "Category 2", "Category 3" }; int[] seriesValues = { -20, 50, -30 }; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(firstSlideIndex); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 200); IChartData chartData = chart.getChartData(); IChartDataWorkbook workbook = chartData.getChartDataWorkbook(); chartData.getSeries().clear(); chartData.getCategories().clear(); IChartDataCell seriesNameCell = workbook.getCell(worksheetIndex, headerRowIndex, firstSeriesColumnIndex, "Series 1"); int chartType = chart.getType(); IChartSeries series = chartData.getSeries().add(seriesNameCell, chartType); for (int categoryIndex = 0; categoryIndex < categoryNames.length; categoryIndex++) { int dataRowIndex = firstDataRowIndex + categoryIndex; String categoryName = categoryNames[categoryIndex]; int seriesValue = seriesValues[categoryIndex]; IChartDataCell categoryCell = workbook.getCell(worksheetIndex, dataRowIndex, categoryColumnIndex, categoryName); chartData.getCategories().add(categoryCell); IChartDataCell valueCell = workbook.getCell(worksheetIndex, dataRowIndex, firstSeriesColumnIndex, seriesValue); series.getDataPoints().addDataPointForBarSeries(valueCell); } int automaticSeriesColor = series.getAutomaticSeriesColor(); series.getFormat().getFill().setFillType(FillType.Solid); series.getFormat().getFill().getSolidFillColor().setColor(automaticSeriesColor); series.setInvertIfNegative(true); series.getInvertedSolidFillColor().setColor(Color.RED); presentation.save("inverted_solid_fill_color.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The result: ![The inverted solid fill color](https://docs.aspose.com/slides/androidjava/chart-series/inverted_solid_fill_color.png) You can enable inversion for one point through [IChartDataPoint.setInvertIfNegative](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapoint/#setInvertIfNegative-boolean-). In the following example, inversion is disabled for the series and enabled only for the selected point. The point is also assigned a negative value so that the effect is visible: ```java import com.aspose.slides.*; import android.graphics.Color; final int firstSlideIndex = 0; final int firstSeriesIndex = 0; final int targetDataPointIndex = 2; final int negativeValue = -30; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(firstSlideIndex); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 200); IChartSeries series = chart.getChartData().getSeries().get_Item(firstSeriesIndex); int automaticSeriesColor = series.getAutomaticSeriesColor(); series.getFormat().getFill().setFillType(FillType.Solid); series.getFormat().getFill().getSolidFillColor().setColor(automaticSeriesColor); series.getInvertedSolidFillColor().setColor(Color.RED); series.setInvertIfNegative(false); IChartDataPoint dataPoint = series.getDataPoints().get_Item(targetDataPointIndex); dataPoint.getValue().getAsCell().setValue(negativeValue); dataPoint.setInvertIfNegative(true); presentation.save("data_point_invert_color_if_negative.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Clear a Specific Data Point Value** To make one point empty without removing the other points, set its backing workbook cell to `null`. For a column chart, the plotted value is available through [IChartDataPoint.getValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapoint/#getValue--). The data point stays at the same category position, but the chart treats its value as blank according to the chart's blank-value settings. The following example clears only the second point in the first series: ```java import com.aspose.slides.*; final int firstSlideIndex = 0; final int firstSeriesIndex = 0; final int targetDataPointIndex = 1; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(firstSlideIndex); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 200); IChartSeries series = chart.getChartData().getSeries().get_Item(firstSeriesIndex); IChartDataPoint dataPoint = series.getDataPoints().get_Item(targetDataPointIndex); dataPoint.getValue().getAsCell().setValue(null); presentation.save("clear_data_point_value.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` Scatter charts use separate X and Y cells, and bubble charts also use a size cell. Clear only the cell that represents the value you intend to remove. Do not call [IChartDataPointCollection.clear](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapointcollection/#clear--) when you want to keep the other points, because that method removes every data point from the collection. ## **Control the Display of Empty Cells** Hidden cells that contain values are a separate case from empty cells. To include or exclude data from hidden worksheet rows and columns, see [Include Data from Hidden Rows and Columns](https://docs.aspose.com/slides/androidjava/chart-workbook/#include-data-from-hidden-rows-and-columns). An empty workbook cell represents missing data; a cell containing `0` represents a known numeric value. Call [IChartDataCell.setValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setValue-java.lang.Object-) with `null` to make a cell empty. A numeric zero remains a zero regardless of the blank-cell setting. Use [IChart.setDisplayBlanksAs](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#setDisplayBlanksAs-int-) to choose how the chart displays empty cells. This setting applies to the whole chart. It changes how blanks are plotted, without filling the empty workbook cell with zero or an interpolated value. The following self-contained example creates a line chart with one series, clears the value for Day 3, and saves the same chart with each mode. No input file is required. The [IChartDataWorkbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/) uses worksheet 0, column 0 for category labels, and column 1 for values; row 0 holds the series name. The final data is `10, 20, empty, 30, 40`. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.LineWithMarkers, 40, 40, 640, 400); IChartData chartData = chart.getChartData(); IChartDataWorkbook workbook = chartData.getChartDataWorkbook(); chartData.getSeries().clear(); chartData.getCategories().clear(); IChartDataCell seriesNameCell = workbook.getCell(0, 0, 1, "Measurements"); IChartSeries series = chartData.getSeries().add(seriesNameCell, chart.getType()); int[] values = { 10, 20, 25, 30, 40 }; for (int i = 0; i < values.length; i++) { IChartDataCell categoryCell = workbook.getCell(0, i + 1, 0, "Day " + (i + 1)); chartData.getCategories().add(categoryCell); IChartDataCell valueCell = workbook.getCell(0, i + 1, 1, values[i]); series.getDataPoints().addDataPointForLineSeries(valueCell); } // Leave Day 3 genuinely empty, while retaining its category and data point. workbook.getCell(0, 3, 1).setValue(null); int[] modes = { DisplayBlanksAsType.Gap, DisplayBlanksAsType.Zero, DisplayBlanksAsType.Span }; String[] modeNames = { "Gap", "Zero", "Span" }; for (int i = 0; i < modes.length; i++) { chart.setDisplayBlanksAs(modes[i]); presentation.save("empty_cells_" + modeNames[i] + ".pptx", SaveFormat.Pptx); } } finally { presentation.dispose(); } ``` Each output file stores the mode assigned before saving: `empty_cells_Gap.pptx`, `empty_cells_Zero.pptx`, and `empty_cells_Span.pptx`. To save only one version, assign the desired mode and save the presentation once instead of iterating over the modes. The comparison below shows the same data in all three files. Day 3 is empty in the workbook in every case: ![Line charts with identical data: Gap breaks the line at Day 3, Zero drops the line to zero, and Span connects Day 2 to Day 4.](https://docs.aspose.com/slides/androidjava/chart-series/display_blanks_as.png) The visible effect depends on the chart type. A line chart makes all three modes easy to compare. Bar and column charts have no line to connect across a missing category, so `Span` cannot produce the connecting segment shown above; a missing column and a zero-height column can also look alike. Similarly, a scatter chart with markers only has no connecting line. Do not expect three distinct results for every chart type; check the output for the type you use. ## **Set the Series Gap Width** Gap width is the space between adjacent bar or column clusters, expressed as a percentage of the bar or column width. Like overlap, it belongs to the parent series group rather than to one series. Call [IChartSeriesGroup.setGapWidth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseriesgroup/#setGapWidth-int-) once for the group. A larger value creates more space between clusters; a smaller value makes them denser. The following example changes the gap width and saves only the final presentation: ```java import com.aspose.slides.*; final int firstSlideIndex = 0; final int firstSeriesIndex = 0; final int gapWidthPercent = 30; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(firstSlideIndex); IChart chart = slide.getShapes().addChart(ChartType.StackedColumn, 20, 20, 500, 200); IChartSeries series = chart.getChartData().getSeries().get_Item(firstSeriesIndex); series.getParentSeriesGroup().setGapWidth(gapWidthPercent); presentation.save("gap_width_30.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The result: ![The gap width](https://docs.aspose.com/slides/androidjava/chart-series/gap_width.png) ## **Show or Hide Series Lines** Series lines visually connect related parts of a chart. Use [IChartSeriesGroup.setSeriesLines](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseriesgroup/#setSeriesLines-boolean-) to show or hide them in supported stacked bar and OfPie charts. In two-dimensional stacked bar and column charts, they connect corresponding stack boundaries across categories. In Pie of Pie and Bar of Pie charts, they connect the main plot to the secondary plot. This setting is not a general-purpose connector for other chart types. Access the group through [IChartSeries.getParentSeriesGroup](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getParentSeriesGroup--). The setting applies to every series in that group. [IChartSeries.hasSeriesLines](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#hasSeriesLines--) is read-only and reflects the parent group's setting; call the group's setter to update it. The following example creates one [PieOfPie](https://reference.aspose.com/slides/androidjava/com.aspose.slides/charttype/#PieOfPie) chart with default data. It saves the same chart with series lines enabled and then disabled, producing two presentations for comparison. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.PieOfPie, 50, 50, 600, 400); IChartSeries series = chart.getChartData().getSeries().get_Item(0); IChartSeriesGroup seriesGroup = series.getParentSeriesGroup(); seriesGroup.setSeriesLines(true); presentation.save("series_lines_enabled.pptx", SaveFormat.Pptx); seriesGroup.setSeriesLines(false); presentation.save("series_lines_disabled.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` | Series lines enabled | Series lines disabled | | --- | --- | | ![Pie of Pie chart with series lines enabled](https://docs.aspose.com/slides/androidjava/chart-series/series_lines_enabled.png) | ![Pie of Pie chart with series lines disabled](https://docs.aspose.com/slides/androidjava/chart-series/series_lines_disabled.png) | | The two lines connect the main pie to the secondary pie. | Both pies remain visible, but the connecting lines are hidden. | Series lines differ from data label leader lines, which connect labels to their data points; gridlines, which mark intervals along chart axes; and the lines in a line chart, which represent data values. This setting does not control those elements. ## **FAQ** **Which chart types support data series?** All chart types represented by the [ChartType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/charttype/) enumeration use chart data, but their series do not all have the same value structure or settings. For example, category charts use categories and values, scatter charts use X and Y values, and bubble charts add bubble sizes. Use the data-point creation method that matches the series type. Options such as overlap and gap width apply only to compatible bar or column groups. **What is a chart series group?** An [IChartSeriesGroup](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseriesgroup/) contains compatible series that share group-level plotting settings. A combination chart can contain more than one group, so changing the group reached through one series does not necessarily change every series in the chart. **Does a newly created chart contain default data?** Yes. By default, [IShapeCollection.addChart](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishapecollection/#addChart-int-float-float-float-float-) creates sample series, categories, and values. You can edit those cells or clear both the series and category collections before adding a completely custom data set. An overload can also create a chart without default data. **How are chart objects connected to workbook cells?** Series names, category labels, and data-point values reference cells in an [IChartDataWorkbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/). Changing a referenced cell updates the corresponding chart element. When you build custom data, keep category rows and series-value rows aligned so that each point is plotted under the intended category. **How do I clear one point instead of the whole series?** Set the relevant value cell to `null` to retain the point's category position as an empty point. Use [IChartDataPointCollection.clear](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapointcollection/#clear--) only when you intend to remove all points from that series. If you also remove categories, update every series so their values remain aligned with the category collection. **How are empty points displayed?** The result depends on the chart type and the value configured through [IChart.setDisplayBlanksAs](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#setDisplayBlanksAs-int-). Supported charts can display blanks as gaps, as zero values, or by connecting neighboring points. Choose the setting that matches the meaning of missing data in your presentation. See [Control the Display of Empty Cells](https://docs.aspose.com/slides/androidjava/chart-series/#control-the-display-of-empty-cells) for a complete example and visual comparison. **How are negative values formatted?** For supported bar, column, and bubble series, call [IChartSeries.setInvertIfNegative](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#setInvertIfNegative-boolean-) and set the color returned by [IChartSeries.getInvertedSolidFillColor](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseries/#getInvertedSolidFillColor--). You can override the behavior for an individual point with [IChartDataPoint.setInvertIfNegative](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatapoint/#setInvertIfNegative-boolean-). These methods affect formatting, not the stored numeric values. **Which formatting wins when both a series and a point are formatted?** Explicit data-point formatting takes precedence for that point. Other points continue to use the explicit series format or, when the series format is not defined, the automatic chart style and theme. Group settings such as overlap and gap width control layout and are not point-level formatting overrides. **Is there a limit to how many series a chart can contain?** Aspose.Slides does not impose a separate fixed series-count limit. In practice, presentation file constraints, available memory, rendering time, and chart readability determine a useful limit. **What should I change when columns are too close together or too far apart?** Call [IChartSeriesGroup.setGapWidth](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartseriesgroup/#setGapWidth-int-) on the appropriate parent series group. Increase the value to widen the space between clusters, or decrease it to bring the clusters closer together. # Customize Presentation Charts on Android > Explore every chart type you can create or edit with Aspose.Slides for Android – fast, Java code-first guides for PowerPoint presentations. Source: https://docs.aspose.com/slides/androidjava/chart-types/ Updated: 2025-11-23 --- lastmod: 2025-11-23T12:56:22+04:00 title: Customize Presentation Charts on Android linktitle: Chart Types type: docs weight: 20 url: /androidjava/chart-types/ keywords: - customize chart - manage chart - chart type - PowerPoint chart - presentation chart - PPT chart - PPTX chart - PowerPoint - presentation - Android - Java - Aspose.Slides description: "Explore every chart type you can create or edit with Aspose.Slides for Android – fast, Java code-first guides for PowerPoint presentations." --- ## Related articles - [Create and Customize PowerPoint Charts on Android](https://docs.aspose.com/slides/androidjava/powerpoint-charts/) - [Manage Media Files on Android](https://docs.aspose.com/slides/androidjava/manage-media-files/) - [AI Features in Aspose.Slides](https://docs.aspose.com/slides/androidjava/ai/) # Manage Chart Workbooks in Presentations on Android > Discover Aspose.Slides for Android via Java: effortlessly manage chart workbooks in PowerPoint and OpenDocument formats to streamline your presentation data. Source: https://docs.aspose.com/slides/androidjava/chart-workbook/ Updated: 2026-10-22 ## **Overview** This article explains how to work with chart workbooks in Aspose.Slides. It shows how to read and write chart data through workbook streams, use workbook cells as chart data labels, access worksheet collections, and specify the data source type for chart values. It also covers working with external workbooks as chart data sources. The examples demonstrate how to create and assign an external workbook, retrieve the path of an external workbook linked to a chart, and edit chart data when the workbook is available. For workbook cells that represent missing data, see [Control the Display of Empty Cells](https://docs.aspose.com/slides/androidjava/chart-series/) for the difference between an empty cell and zero, and a line-chart comparison of the available display modes. ## **Include Data from Hidden Rows and Columns** Use [IChart.setPlotVisibleCellsOnly](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#setPlotVisibleCellsOnly-boolean-) to control whether a chart plots data from hidden worksheet rows and columns. Set it to `true` to plot only visible cells, or `false` to include both visible and hidden cells. This setting controls chart plotting; it does not hide or unhide worksheet rows or columns. The [sample presentation](https://docs.aspose.com/slides/androidjava/chart-workbook/hidden-source-data.pptx) contains a column chart as the first shape on its first slide. The embedded worksheet, `Sheet1`, contains the following source range, `A1:C4`. Row 3 and column C are hidden, but their cells still contain values. | Worksheet row | A: Month | B: Retail | C: Wholesale (hidden column) | | --- | --- | --- | --- | | 2 | January | 10 | 30 | | 3 (hidden row) | February | 40 | 60 | | 4 | March | 20 | 50 | Access source cells through [IChartData.getChartDataWorkbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#getChartDataWorkbook--) and read [IChartDataCell.isHidden](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#isHidden--) to inspect their hidden status. This method reports the hidden status without changing it. In this file, B2 is visible, B3 belongs to the hidden row, and C2 belongs to the hidden column; the example prints `false`, `true`, and `true`, respectively. For this example, refresh the chart data after changing the plotting setting: retain the embedded workbook with [readWorkbookStream](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#readWorkbookStream--) and reload it with [writeWorkbookStream](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#writeWorkbookStream-byte---). When including all cells, also use [setRange](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#setRange-java.lang.String-) to restore the complete range, including the hidden February category. Simply changing the flag is insufficient to refresh this sample's cached chart data and category labels. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("hidden-source-data.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); int shapeCount = slide.getShapes().size(); if (shapeCount > 0 && slide.getShapes().get_Item(0) instanceof IChart) { IChart chart = (IChart) slide.getShapes().get_Item(0); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); System.out.println("B2 hidden: " + workbook.getCell(0, "B2").isHidden()); System.out.println("B3 hidden: " + workbook.getCell(0, "B3").isHidden()); System.out.println("C2 hidden: " + workbook.getCell(0, "C2").isHidden()); byte[] workbookData = chart.getChartData().readWorkbookStream(); for (boolean visibleOnly : new boolean[] { true, false }) { chart.setPlotVisibleCellsOnly(visibleOnly); // Refresh the chart data from the embedded workbook. chart.getChartData().writeWorkbookStream(workbookData); if (!visibleOnly) { // Restore the complete source range, including hidden categories. chart.getChartData().setRange("Sheet1!$A$1:$C$4"); } presentation.save("hidden_cells_" + visibleOnly + ".pptx", SaveFormat.Pptx); } } else { System.out.println("The first shape is not a chart."); } } finally { presentation.dispose(); } ``` The example saves two versions of the presentation: one with only the visible Retail values (10 and 20), and another with all six values. The images below illustrate the two plotting modes. Row 3 and column C remain hidden in both embedded workbooks. | Only visible cells (`true`) | All cells (`false`) | | --- | --- | | ![Only visible cells: Retail values 10 and 20 for January and March.](https://docs.aspose.com/slides/androidjava/chart-workbook/hidden_cells_True.png) | ![All cells: Retail and Wholesale values for January, February, and March.](https://docs.aspose.com/slides/androidjava/chart-workbook/hidden_cells_False.png) | A hidden cell containing a value is different from an empty cell. [IChart.setDisplayBlanksAs](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#setDisplayBlanksAs-int-) controls how missing values are displayed; it does not include or exclude hidden source data. See [Control the Display of Empty Cells](https://docs.aspose.com/slides/androidjava/chart-series/#control-the-display-of-empty-cells) for an example. ## **Retrieve a Chart's Data Range** Before updating workbook data in an existing presentation, inspect the source ranges to identify which worksheet cells each chart uses. The [IChartData.getRange](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#getRange--) method returns the current data range as a worksheet-qualified formula, such as `Sheet1!$A$1:$D$5`. Here, `Sheet1` is the worksheet name, `!` separates it from the cell range, and `$A$1:$D$5` identifies cells A1 through D5, inclusive. The dollar signs indicate absolute row and column references. The method reads the current range without changing the chart or its workbook. If the chart does not use a workbook as its data source, it throws `InvalidOperationException`. For more information, see the [ChartData API Reference](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chartdata/). This example opens a presentation and checks the shapes directly on each slide for charts. It prints each chart's name and source range. If a chart does not use a workbook, it prints a message and continues to the next chart. ```java import com.aspose.slides.*; import com.aspose.slides.exceptions.InvalidOperationException; Presentation presentation = new Presentation("presentation.pptx"); try { for (ISlide slide : presentation.getSlides()) { for (IShape shape : slide.getShapes()) { if (shape instanceof IChart) { IChart chart = (IChart) shape; try { String range = chart.getChartData().getRange(); System.out.println(chart.getName() + ": " + range); } catch (InvalidOperationException exception) { System.out.println(chart.getName() + ": The chart does not use a workbook as its data source."); } } } } } finally { presentation.dispose(); } ``` ## **Read and Write Chart Data from a Workbook** Aspose.Slides for Android via Java provides the [readWorkbookStream](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#readWorkbookStream--) and [writeWorkbookStream](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#writeWorkbookStream-byte---) methods that allow you to read and write chart data workbooks (containing chart data edited with Aspose.Cells). **Note** that the chart data has to be organized in the same manner or must have a structure similar to the source. This example uses a presentation with a chart as the first shape on its first slide. It reads the embedded workbook into a byte array, clears the existing series and categories, and writes the same workbook back. The changes remain in memory; the example does not save the presentation. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("chart.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); int shapeCount = slide.getShapes().size(); if (shapeCount > 0 && slide.getShapes().get_Item(0) instanceof IChart) { IChart chart = (IChart) slide.getShapes().get_Item(0); IChartData chartData = chart.getChartData(); byte[] workbookData = chartData.readWorkbookStream(); chartData.getSeries().clear(); chartData.getCategories().clear(); chartData.writeWorkbookStream(workbookData); } else { System.out.println("The first shape is not a chart."); } } finally { presentation.dispose(); } ``` ### **Validate Chart Layout After Workbook Modification** When you replace an embedded workbook with a modified one, the chart retains its original series and category collections. This mismatch can cause [IChart.validateChartLayout](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#validateChartLayout--) to fail with an index-out-of-range error. Clear the existing series and categories before writing the updated workbook back to the chart. This example uses a chart that is the first shape on the first slide. The comment marks where workbook editing would occur; the runnable example writes the original workbook back and validates the layout in memory. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("chart.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); int shapeCount = slide.getShapes().size(); if (shapeCount > 0 && slide.getShapes().get_Item(0) instanceof IChart) { IChart chart = (IChart) slide.getShapes().get_Item(0); IChartData chartData = chart.getChartData(); byte[] workbookData = chartData.readWorkbookStream(); // Modify the workbook bytes here, for example, using Aspose.Cells. chartData.getSeries().clear(); chartData.getCategories().clear(); chartData.writeWorkbookStream(workbookData); chart.validateChartLayout(); } else { System.out.println("The first shape is not a chart."); } } finally { presentation.dispose(); } ``` Clearing the collections removes stale data references before the workbook is written back. Rebuild any required series and category mappings for the updated workbook before using the chart. ## **Set Custom Number Formats for Workbook Cells** Use [IChartDataCell.setCustomNumberFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setCustomNumberFormat-java.lang.String-) to control how numeric values appear in a chart's embedded workbook. For example, a report may need a conversion rate displayed as a percentage with four decimal places and a coefficient displayed with five decimal places. Keep both values numeric so they remain available for calculations and chart plotting. A number format changes the display, not the stored value. The format `0.0000%` displays `0.125` as `12.5000%`; it does not replace the stored number with `12.5`. Similarly, `0.00000` displays `0.1234567` as `0.12346` without rounding the stored value. If the custom format is an empty string (`""`), the format returned by [getPresetNumberFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#getPresetNumberFormat--) is used instead. The following example creates a column chart and accesses its cells through [getChartDataWorkbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#getChartDataWorkbook--). On worksheet 0, B2 contains the conversion rate and C2 contains the coefficient. Both cells supply chart values. The example also enables value labels linked to the source formats. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { presentation.getSlideSize().setSize(720, 270, SlideSizeScaleType.DoNotScale); ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 20, 620, 210); chart.setTitle(false); chart.getAxes().getVerticalAxis().setNumberFormatLinkedToSource(false); chart.getAxes().getVerticalAxis().setNumberFormat("0.00"); chart.getAxes().getVerticalAxis().setAutomaticMinValue(false); chart.getAxes().getVerticalAxis().setMinValue(0); chart.getChartData().getSeries().clear(); chart.getChartData().getCategories().clear(); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); workbook.clear(0); IChartDataCell categoryCell = workbook.getCell(0, "A2", "Sample"); chart.getChartData().getCategories().add(categoryCell); IChartDataCell percentageCell = workbook.getCell(0, "B2", 0.125); percentageCell.setCustomNumberFormat("0.0000%"); IChartDataCell percentageName = workbook.getCell(0, "B1", "Conversion rate"); IChartSeries percentageSeries = chart.getChartData().getSeries().add(percentageName, chart.getType()); percentageSeries.getDataPoints().addDataPointForBarSeries(percentageCell); IChartDataCell precisionCell = workbook.getCell(0, "C2", 0.1234567); precisionCell.setCustomNumberFormat("0.00000"); IChartDataCell precisionName = workbook.getCell(0, "C1", "Coefficient"); IChartSeries precisionSeries = chart.getChartData().getSeries().add(precisionName, chart.getType()); precisionSeries.getDataPoints().addDataPointForBarSeries(precisionCell); for (IChartSeries series : chart.getChartData().getSeries()) { IDataLabelFormat labelFormat = series.getDataPoints().get_Item(0).getLabel().getDataLabelFormat(); labelFormat.setShowValue(true); labelFormat.setNumberFormatLinkedToSource(true); } presentation.save("CustomCellFormats.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` Workbook cell formats are separate from formats set directly on chart axes or data labels. In this example, each label displays its source cell's value because [setShowValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/#setShowValue-boolean-) is set to `true`, and follows the source number format because [setNumberFormatLinkedToSource](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/#setNumberFormatLinkedToSource-boolean-) is set to `true`. After saving and reopening the presentation, the labels display `12.5000%` and `0.12346`, as shown below. The vertical axis uses its own number format, assigned with [setNumberFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setNumberFormat-java.lang.String-) as `0.00`, with [setNumberFormatLinkedToSource](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iaxis/#setNumberFormatLinkedToSource-boolean-) set to `false`. To format a data label independently, set its source-link flag to `false` and assign a format with [setNumberFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/idatalabelformat/#setNumberFormat-java.lang.String-). This does not change the workbook cell's format. For example, an independent label format of `0.00` displays the first value as `0.13`, while B2 still displays `12.5000%`. See [Chart Data Labels](https://docs.aspose.com/slides/androidjava/chart-data-label/#set-the-percentage-sign-with-chart-data-labels) for direct label formatting. The image below was rendered from the saved presentation after reopening it: ![Column chart with source-linked labels showing 12.5000% and 0.12346 and an independently formatted numeric axis.](https://docs.aspose.com/slides/androidjava/chart-workbook/custom-cell-formats.png) ## **Set a Workbook Cell as a Chart Data Label** You can use text from workbook cells as chart data labels. This example adds a bubble chart with default data to the first slide of an existing presentation. It uses cells A10:A12 on worksheet 0 for the first three labels in the first series, enables labels from cells, and saves the updated presentation. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("chart2.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Bubble, 50, 50, 600, 400, true); IChartSeries series = chart.getChartData().getSeries().get_Item(0); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); series.getLabels().getDefaultDataLabelFormat().setShowLabelValueFromCell(true); series.getLabels().get_Item(0).setValueFromCell(workbook.getCell(0, "A10", "Label 0 cell value")); series.getLabels().get_Item(1).setValueFromCell(workbook.getCell(0, "A11", "Label 1 cell value")); series.getLabels().get_Item(2).setValueFromCell(workbook.getCell(0, "A12", "Label 2 cell value")); presentation.save("resultchart.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Manage Worksheets** The [IChartDataWorkbook.getWorksheets](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/#getWorksheets--) method provides access to the worksheets in a chart workbook. This example creates a pie chart with default data and prints each worksheet name to the console. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Pie, 50, 50, 400, 500); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); for (int i = 0; i < workbook.getWorksheets().size(); i++) { System.out.println(workbook.getWorksheets().get_Item(i).getName()); } } finally { presentation.dispose(); } ``` ## **Specify the Data Source Type** Series point values can also be stored directly as numeric literals. See [Set Series Values Using Numeric Literals](https://docs.aspose.com/slides/androidjava/chart-series/#set-series-values-using-numeric-literals) for a complete example that saves and reads them. The source type of point values is separate from the chart's internal or external workbook configuration; using numeric literals does not, by itself, remove the embedded workbook. This example creates a 3D column chart with default data and sets two series names using different data sources. The first name uses a string literal; the second uses cell C1 on worksheet 0. The [DataSourceType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/datasourcetype/) enumeration selects the source for each name. The example saves the presentation with the updated series names. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Column3D, 50, 50, 600, 400, true); IStringChartValue literalName = chart.getChartData().getSeries().get_Item(0).getName(); literalName.setDataSourceType(DataSourceType.StringLiterals); literalName.setData("LiteralString"); IStringChartValue cellName = chart.getChartData().getSeries().get_Item(1).getName(); IChartDataCell nameCell = chart.getChartData().getChartDataWorkbook().getCell(0, "C1", "NewCell"); cellName.setDataSourceType(DataSourceType.Worksheet); cellName.setData(nameCell); presentation.save("pres.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Detect Unsupported Embedded Workbook Formats** Aspose.Slides does not support the Excel binary workbook (.xlsb) format that can be embedded in some charts. You can use the [getEmbeddedWorkbookType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#getEmbeddedWorkbookType--) method on [IChartData](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/) together with the [WorkbookType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/workbooktype/) enumeration to detect unsupported formats and skip those charts. This example inspects the shapes on the first slide of an existing presentation, skips non-chart shapes, and prints a diagnostic message for each chart with an embedded .xlsb workbook. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("sample.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); for (IShape shape : slide.getShapes()) { if (!(shape instanceof IChart)) { continue; } IChart chart = (IChart) shape; IChartData chartData = chart.getChartData(); boolean isInternalWorkbook = chartData.getDataSourceType() == ChartDataSourceType.InternalWorkbook; boolean isBinaryMacro = chartData.getEmbeddedWorkbookType() == WorkbookType.WorkbookBinaryMacro; if (isInternalWorkbook && isBinaryMacro) { System.out.println("Skipping a chart with an unsupported .xlsb workbook."); continue; } // Read or modify supported chart workbook data here. } } finally { presentation.dispose(); } ``` ## **External Workbook** Aspose.Slides supports using external workbooks as a data source for charts. ### **Create an External Workbook** Use [readWorkbookStream](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#readWorkbookStream--) and [setExternalWorkbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#setExternalWorkbook-java.lang.String-) to export an embedded chart workbook to a file and link the chart to that external workbook. This example creates a pie chart with default data and exports its workbook. It completes the file write before assigning the external workbook as the chart data source, then saves the linked presentation. ```java import com.aspose.slides.*; import java.io.IOException; import java.io.File; import java.io.FileOutputStream; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Pie, 50, 50, 400, 600); File workbookFile = new File("externalWorkbook1.xlsx").getAbsoluteFile(); byte[] workbookData = chart.getChartData().readWorkbookStream(); try { try (FileOutputStream workbookStream = new FileOutputStream(workbookFile)) { workbookStream.write(workbookData); } chart.getChartData().setExternalWorkbook(workbookFile.getAbsolutePath()); presentation.save("externalWorkbook.pptx", SaveFormat.Pptx); } catch (IOException exception) { System.out.println("Could not write the external workbook: " + exception.getMessage()); } } finally { presentation.dispose(); } ``` ### **Set an External Workbook** Using the [setExternalWorkbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#setExternalWorkbook-java.lang.String-) method, you can assign an external workbook to a chart as its data source. This method can also be used to update a path to the external workbook (if the latter has been moved). While you cannot edit the data in workbooks stored in remote locations or resources, you can still use such workbooks as an external data source. If the relative path for an external workbook is provided, it gets converted to a full path automatically. This example uses an external workbook whose worksheet named `Sheet1` contains a series name in B1, category names in A2:A4, and numeric values in B2:B4. The example creates a pie chart, links the workbook, and uses [setRange](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#setRange-java.lang.String-) to map A1:B4 to one series and three categories. It saves the presentation with the linked chart. ```java import com.aspose.slides.*; import java.io.File; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Pie, 50, 50, 400, 600, true); IChartData chartData = chart.getChartData(); File workbookFile = new File("externalWorkbook.xlsx"); String workbookPath = workbookFile.getAbsolutePath(); chartData.setExternalWorkbook(workbookPath); chartData.setRange("Sheet1!$A$1:$B$4"); presentation.save("Presentation_with_externalWorkbook.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The `updateChartData` parameter of [setExternalWorkbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#setExternalWorkbook-java.lang.String-boolean-) controls whether the workbook is loaded. * When `updateChartData` is `false`, only the workbook path is updated. The chart data is not loaded or updated from the target workbook, so the workbook can be unavailable. * When `updateChartData` is `true`, the chart data is updated from the target workbook. The following example assigns a placeholder URL with `updateChartData` set to `false`. It retains the pie chart's default data and saves the presentation without loading the unavailable workbook. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.Pie, 50, 50, 400, 600, true); chart.getChartData().setExternalWorkbook("https://example.com/unavailable-workbook.xlsx", false); presentation.save("SetExternalWorkbookWithUpdateChartData.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ### **Get the External Data Source Workbook Path of a Chart** To identify the workbook linked to a chart, check whether the chart uses an external data source and retrieve its workbook path. This example inspects the first shape on the first slide of a presentation with a linked external workbook. If it is a chart linked to an external workbook, the example prints [getExternalWorkbookPath](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#getExternalWorkbookPath--) to the console. It then saves a copy of the presentation. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("externalWorkbook.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); if (slide.getShapes().size() > 0 && slide.getShapes().get_Item(0) instanceof IChart) { IChart chart = (IChart) slide.getShapes().get_Item(0); IChartData chartData = chart.getChartData(); if (chartData.getDataSourceType() == ChartDataSourceType.ExternalWorkbook) { System.out.println(chartData.getExternalWorkbookPath()); } else { System.out.println("The chart does not use an external workbook."); } } else { System.out.println("The first shape is not a chart."); } presentation.save("Result.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ### **Edit Chart Data** You can edit the data in external workbooks the same way you make changes to the contents of internal workbooks. When an external workbook cannot be loaded, an exception is thrown. This example uses a chart that is the first shape on the first slide and is linked to an accessible external workbook. It sets the cell-backed value of the first data point in the first series to 100 and saves the updated presentation. Editing cell values can update the linked external XLSX file, so use a copy if you need to preserve the original workbook. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("presentation.pptx"); try { ISlide slide = presentation.getSlides().get_Item(0); int shapeCount = slide.getShapes().size(); if (shapeCount > 0 && slide.getShapes().get_Item(0) instanceof IChart) { IChart chart = (IChart) slide.getShapes().get_Item(0); IChartSeriesCollection series = chart.getChartData().getSeries(); if (series.size() > 0 && series.get_Item(0).getDataPoints().size() > 0) { IChartDataCell valueCell = series.get_Item(0).getDataPoints().get_Item(0).getValue().getAsCell(); if (valueCell != null) { valueCell.setValue(100); presentation.save("presentation_out.pptx", SaveFormat.Pptx); } else { System.out.println("The first data point is not linked to a workbook cell."); } } else { System.out.println("The chart has no data points to edit."); } } else { System.out.println("The first shape is not a chart."); } } finally { presentation.dispose(); } ``` ### **Recover a Workbook from the Chart Cache** If a chart uses an external workbook that is missing or unavailable, Aspose.Slides can reconstruct the chart workbook from the data cached in the presentation. Create [LoadOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/loadoptions/), call [LoadOptions.setSpreadsheetOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/loadoptions/#setSpreadsheetOptions-com.aspose.slides.ISpreadsheetOptions-), and set [ISpreadsheetOptions.setRecoverWorkbookFromChartCache](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ispreadsheetoptions/#setRecoverWorkbookFromChartCache-boolean-) to `true` before opening the presentation. The following Java example recovers workbook data for a chart that is the first shape on the first slide and references an unavailable external workbook. It accesses the recovered data through [IChart.getChartData](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichart/#getChartData--) and [IChartData.getChartDataWorkbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdata/#getChartDataWorkbook--): ```java import com.aspose.slides.*; SpreadsheetOptions spreadsheetOptions = new SpreadsheetOptions(); spreadsheetOptions.setRecoverWorkbookFromChartCache(true); LoadOptions loadOptions = new LoadOptions(); loadOptions.setSpreadsheetOptions(spreadsheetOptions); Presentation presentation = new Presentation("presentation.pptx", loadOptions); try { ISlide slide = presentation.getSlides().get_Item(0); int shapeCount = slide.getShapes().size(); if (shapeCount > 0 && slide.getShapes().get_Item(0) instanceof IChart) { IChart chart = (IChart) slide.getShapes().get_Item(0); IChartDataWorkbook recoveredWorkbook = chart.getChartData().getChartDataWorkbook(); // Read or modify the recovered workbook data here. } else { System.out.println("The first shape is not a chart."); } } finally { presentation.dispose(); } ``` If the external workbook is unavailable and recovery is disabled, Aspose.Slides throws an exception. Enable recovery only when using the cached chart data is an acceptable fallback, because the cache may not contain changes made to the external workbook after the presentation was last updated. ## **FAQ** **Can I determine whether a specific chart is linked to an external or an embedded workbook?** Yes. A chart has a [data source type](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chartdata/#getDataSourceType--) and a [path to an external workbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chartdata/#getExternalWorkbookPath--); if the source is an external workbook, you can read the full path to make sure an external file is being used. **Are relative paths to external workbooks supported, and how are they stored?** Yes. If you specify a relative path, it is automatically converted to an absolute path. The presentation stores the absolute path in the PPTX file, so moving the workbook may require updating the link. **Can I use workbooks located on network resources/shares?** Yes, such workbooks can be used as an external data source. However, editing remote workbooks directly from Aspose.Slides is not supported—they can only be used as a source. **Does Aspose.Slides overwrite the external XLSX when saving the presentation?** The presentation stores a [link to the external file](https://reference.aspose.com/slides/androidjava/com.aspose.slides/chartdata/#getExternalWorkbookPath--). Editing cell-backed chart data can also update the linked local XLSX file. Use a copy of the workbook if the original must remain unchanged. **What should I do if the external file is password-protected?** Aspose.Slides does not accept a password when linking. A common approach is to remove protection in advance or prepare a decrypted copy (for example, using [Aspose.Cells](https://reference.aspose.com/cells/java/)) and link to that copy. **Can multiple charts reference the same external workbook?** Yes. Each chart stores its own link. If they all point to the same file, updating that file will be reflected in each chart the next time the data is loaded. # Apply Chart Worksheet Formulas in Presentations on Android > Apply Excel-style formulas in Aspose.Slides for Android via Java chart worksheets, recalculate values, and use the results in PowerPoint charts. Source: https://docs.aspose.com/slides/androidjava/chart-worksheet-formulas/ Updated: 2026-08-21 ## **Overview** PowerPoint charts usually store their source data in an embedded worksheet. In Aspose.Slides for Android via Java, you can access that worksheet through the chart data workbook, write input values, assign formulas to cells, calculate supported formulas, and use the calculated cells as chart data. This article explains the complete formula workflow: create a chart, populate its worksheet, assign A1-style or R1C1-style formulas, recalculate them, read the calculated values, connect those cells to a chart series, and save the presentation. It also describes the supported formula syntax, the built-in function subset, cached values, unsupported formulas, and spreadsheet-specific errors. ## **Chart Worksheets and Formulas** A chart worksheet contains the categories, series names, and values used by a chart. In PowerPoint, you can inspect the worksheet by opening the chart data editor: ![PowerPoint chart with its embedded worksheet open, showing category and series data](https://docs.aspose.com/slides/androidjava/chart-worksheet-formulas/chart-worksheet-formulas_1.png) In Aspose.Slides, the worksheet is exposed through the [IChartDataWorkbook](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/) interface. Use [IChartDataCell.setFormula](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setFormula-java.lang.String-) for A1-style formulas and [IChartDataCell.setR1C1Formula](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setR1C1Formula-java.lang.String-) for R1C1-style formulas. After changing input cells or formulas, call [IChartDataWorkbook.calculateFormulas](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/#calculateFormulas--) to recalculate supported formulas and update the corresponding cell values. A calculated cell still exposes its result through [IChartDataCell.getValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#getValue--). This is important when you need to inspect a formula result in code or use the cell as a chart data point. ## **Create a Chart and Calculate Worksheet Formulas** The following example demonstrates an end-to-end workflow. It creates a clustered column chart, clears the sample data, writes quarterly revenue and expense values, calculates profit with formulas, reads the results, uses the calculated cells as chart values, and saves the presentation. ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 600, 350); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); int worksheetIndex = 0; chart.getChartData().getSeries().clear(); chart.getChartData().getCategories().clear(); workbook.clear(worksheetIndex); IChartDataCell category1 = workbook.getCell(worksheetIndex, "A2", "Q1"); IChartDataCell category2 = workbook.getCell(worksheetIndex, "A3", "Q2"); IChartDataCell category3 = workbook.getCell(worksheetIndex, "A4", "Q3"); workbook.getCell(worksheetIndex, "B1", "Revenue"); workbook.getCell(worksheetIndex, "C1", "Expenses"); workbook.getCell(worksheetIndex, "D1", "Profit"); workbook.getCell(worksheetIndex, "B2").setValue(120.0); workbook.getCell(worksheetIndex, "C2").setValue(80.0); workbook.getCell(worksheetIndex, "B3").setValue(150.0); workbook.getCell(worksheetIndex, "C3").setValue(95.0); workbook.getCell(worksheetIndex, "B4").setValue(135.0); workbook.getCell(worksheetIndex, "C4").setValue(110.0); IChartDataCell profit1 = workbook.getCell(worksheetIndex, "D2"); IChartDataCell profit2 = workbook.getCell(worksheetIndex, "D3"); IChartDataCell profit3 = workbook.getCell(worksheetIndex, "D4"); profit1.setFormula("B2-C2"); profit2.setFormula("B3-C3"); profit3.setFormula("B4-C4"); workbook.calculateFormulas(); double q1Profit = ((Number) profit1.getValue()).doubleValue(); // 40 double q2Profit = ((Number) profit2.getValue()).doubleValue(); // 55 double q3Profit = ((Number) profit3.getValue()).doubleValue(); // 25 System.out.println("Q1 profit: " + q1Profit); System.out.println("Q2 profit: " + q2Profit); System.out.println("Q3 profit: " + q3Profit); chart.getChartData().getCategories().add(category1); chart.getChartData().getCategories().add(category2); chart.getChartData().getCategories().add(category3); IChartSeries profitSeries = chart.getChartData().getSeries().add(workbook.getCell(worksheetIndex, "D1"), chart.getType()); profitSeries.getDataPoints().addDataPointForBarSeries(profit1); profitSeries.getDataPoints().addDataPointForBarSeries(profit2); profitSeries.getDataPoints().addDataPointForBarSeries(profit3); profitSeries.getLabels().getDefaultDataLabelFormat().setShowValue(true); presentation.save("chart-formulas.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The chart data points reference `D2:D4`, so the chart uses the calculated profit values. There is no separate chart-refresh call in this workflow: recalculate the workbook first, then use or save the chart data that points to the calculated cells. ## **Use A1-Style Formulas** A1 notation identifies columns with letters and rows with numbers. Assign A1-style expressions through [IChartDataCell.setFormula](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setFormula-java.lang.String-). ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 500, 300); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); workbook.getCell(0, "C3").setValue(10); workbook.getCell(0, "F2").setValue(2); workbook.getCell(0, "G2").setValue(3); workbook.getCell(0, "H2").setValue(4); IChartDataCell cell = workbook.getCell(0, "A2"); cell.setFormula("C3+SUM(F2:H2)"); workbook.calculateFormulas(); Object value = cell.getValue(); // 19 } finally { presentation.dispose(); } ``` Common A1 reference forms are: | Reference | Relative | Absolute | Mixed | |---|---|---|---| | Cell | `A2` | `$A$2` | `A$2`, `$A2` | | Row | `2:2` | `$2:$2` | — | | Column | `A:A` | `$A:$A` | — | | Range | `A2:C4` | `$A$2:$C$4` | `A$2:$C4`, `$A2:C$4` | Relative references can change when a formula is moved or copied by a spreadsheet application. Absolute references keep both coordinates fixed, while mixed references fix only a row or a column. ## **Use R1C1-Style Formulas** R1C1 notation identifies both rows and columns numerically. Relative references use offsets in square brackets. Assign this syntax through [IChartDataCell.setR1C1Formula](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setR1C1Formula-java.lang.String-). ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 500, 300); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); workbook.getCell(0, "B2").setValue(12); workbook.getCell(0, "C2").setValue(5); IChartDataCell cell = workbook.getCell(0, "D2"); cell.setR1C1Formula("RC[-2]-RC[-1]"); workbook.calculateFormulas(); Object value = cell.getValue(); // 7 } finally { presentation.dispose(); } ``` Common R1C1 reference forms are: | Reference | Relative | Absolute | Mixed | |---|---|---|---| | Cell | `R[2]C[3]` | `R2C3` | `R2C[3]`, `R[2]C3` | | Row | `R[2]` | `R2` | — | | Column | `C[3]` | `C3` | — | | Range | `R[2]C[3]:R[5]C[7]` | `R2C3:R5C7` | `R2C3:R[5]C[7]`, `R[2]C3:R5C[7]` | For example, in cell `D2`, `RC[-2]` means the cell in the same row two columns to the left (`B2`). ## **Formula Constants and Operators** The built-in formula evaluator supports logical values, numeric literals, strings, spreadsheet error values, arithmetic operators, and comparison operators. ### **Constants and Literals** | Type | Examples | Notes | |---|---|---| | Logical | `TRUE`, `FALSE` | Can be used directly in logical expressions such as `A2=TRUE`. | | Numeric | `1`, `0.5`, `.3`, `1E-2` | Common and scientific notation are supported. | | String | `"abc"`, `"2/3/2020 12:00"` | Text literals are enclosed in double quotation marks inside the formula. | | Error result | `#DIV/0!`, `#N/A`, `#REF!` | A valid formula can evaluate to a spreadsheet error value instead of a normal result. | This example uses several constant types: ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 500, 300); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); workbook.getCell(0, "A2").setValue(false); workbook.getCell(0, "B2").setFormula("A2=TRUE"); workbook.getCell(0, "C2").setFormula("1+0.5"); workbook.getCell(0, "D2").setFormula(".3*1E-2"); workbook.getCell(0, "E2").setFormula("\"abc\""); workbook.getCell(0, "F2").setFormula("2/0"); workbook.calculateFormulas(); Object logicalValue = workbook.getCell(0, "B2").getValue(); // false Object numericValue = workbook.getCell(0, "C2").getValue(); // 1.5 Object scientificValue = workbook.getCell(0, "D2").getValue(); // 0.003 Object stringValue = workbook.getCell(0, "E2").getValue(); // abc Object errorValue = workbook.getCell(0, "F2").getValue(); // #DIV/0! } finally { presentation.dispose(); } ``` ### **Arithmetic Operators** | Operator | Meaning | Example | |---|---|---| | `+` | Addition or unary plus | `2+3` | | `-` | Subtraction or negation | `2-3`, `-3` | | `*` | Multiplication | `2*3` | | `/` | Division | `2/3` | | `%` | Percent | `30%` | | `^` | Exponentiation | `2^3` | Use parentheses to make evaluation order explicit, for example `(A2+B2)*C2`. ### **Comparison Operators** Comparison expressions return logical values. | Operator | Meaning | Example | |---|---|---| | `=` | Equal to | `A2=3` | | `<>` | Not equal to | `A2<>3` | | `>` | Greater than | `A2>3` | | `>=` | Greater than or equal to | `A2>=3` | | `<` | Less than | `A2<3` | | `<=` | Less than or equal to | `A2<=3` | ## **Supported Predefined Functions** Aspose.Slides includes a built-in formula evaluator for chart worksheets, but it is not a complete Excel calculation engine. The documented function set is limited to the functions below. Do not assume that an arbitrary Excel function can be recalculated by [IChartDataWorkbook.calculateFormulas](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/#calculateFormulas--). | Function | Purpose or supported form | Example | |---|---|---| | `ABS` | Absolute value | `ABS(A2)` | | `AVERAGE` | Arithmetic mean | `AVERAGE(B2:B5)` | | `CEILING` | Round a number upward to a multiple | `CEILING(A2,5)` | | `CHOOSE` | Select a value by index | `CHOOSE(A2,"Low","High")` | | `CONCAT` | Join text values | `CONCAT(A2,B2)` | | `CONCATENATE` | Join text values | `CONCATENATE(A2," ",B2)` | | `DATE` | Create a date value using the 1900 date system | `DATE(2026,8,19)` | | `DAYS` | Return the number of days between dates | `DAYS(B2,A2)` | | `FIND` | Find one text value inside another | `FIND("-",A2)` | | `FINDB` | Byte-oriented text search | `FINDB("a",A2)` | | `IF` | Conditional result | `IF(A2>0,A2,0)` | | `INDEX` | Reference form | `INDEX(A2:C4,2,3)` | | `LOOKUP` | Vector form | `LOOKUP(A2,B2:B5,C2:C5)` | | `MATCH` | Vector form | `MATCH(A2,B2:B5,0)` | | `MAX` | Maximum value | `MAX(B2:B5)` | | `SUM` | Sum values | `SUM(B2:B5)` | | `VLOOKUP` | Vertical lookup | `VLOOKUP(A2,B2:D10,3,FALSE)` | The restrictions shown in the table are significant: `INDEX` is documented in reference form, while `LOOKUP` and `MATCH` are documented in their vector forms. `DATE` uses the 1900 date system. Features and functions not listed here should be treated as unsupported by the Aspose.Slides formula evaluator unless they are documented separately. ## **Calculate Formulas with a Preferred Culture** Some chart workbook functions interpret text according to culture-specific rules. This is especially important for functions intended for languages that use double-byte character sets (DBCS). To calculate such formulas correctly, create [LoadOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/loadoptions/), set the preferred culture with [SpreadsheetOptions.setPreferredCulture](https://reference.aspose.com/slides/androidjava/com.aspose.slides/spreadsheetoptions/#setPreferredCulture-java.util.Locale-), assign the spreadsheet options through [LoadOptions.setSpreadsheetOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/loadoptions/#setSpreadsheetOptions-com.aspose.slides.ISpreadsheetOptions-), and then load the presentation. The following example selects the Japanese culture, opens a presentation with the configured load options, and calls [IChartDataWorkbook.calculateFormulas](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/#calculateFormulas--) for every chart workbook: ```java import com.aspose.slides.*; import java.util.Locale; Locale japaneseCulture = Locale.forLanguageTag("ja-JP"); ISpreadsheetOptions spreadsheetOptions = new SpreadsheetOptions(); spreadsheetOptions.setPreferredCulture(japaneseCulture); LoadOptions loadOptions = new LoadOptions(); loadOptions.setSpreadsheetOptions(spreadsheetOptions); Presentation presentation = new Presentation("presentation.pptx", loadOptions); try { for (ISlide slide : presentation.getSlides()) { for (IShape shape : slide.getShapes()) { if (shape instanceof IChart) { IChart chart = (IChart) shape; chart.getChartData().getChartDataWorkbook().calculateFormulas(); } } } } finally { presentation.dispose(); } ``` The preferred culture is part of the presentation loading configuration, so specify it before creating the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) instance. Use the culture expected by the workbook formulas; for example, use `ja-JP` for formulas that should follow Japanese DBCS calculation rules. ## **Recalculation and Cached Values** Spreadsheet files commonly store both a formula and its last calculated value. Aspose.Slides can therefore read a cached value from [IChartDataCell.getValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#getValue--) when a presentation is loaded and the relevant chart data has not been changed. After changing input cells or formulas, do not rely on an old cached result. Call [IChartDataWorkbook.calculateFormulas](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/#calculateFormulas--) before reading calculated values or saving chart data that depends on them. For formulas outside the supported subset, Aspose.Slides may be unable to parse the formula or establish its dependencies. If the workbook has been modified, the previous cached value can no longer be considered reliable. In that situation, reading the value of a cell with unsupported data can raise [CellUnsupportedDataException](https://reference.aspose.com/slides/androidjava/com.aspose.slides/cellunsupporteddataexception/). If your chart depends on Excel functions that Aspose.Slides does not evaluate, calculate those formulas with a spreadsheet engine that supports them and write the resulting values back to the chart workbook. Do not replace unsupported formulas with guessed values. ## **Handle Formula Errors** There are two different kinds of problems to distinguish. A formula can be valid but produce a spreadsheet error result such as `#DIV/0!`, `#N/A`, `#NAME?`, `#NULL!`, `#NUM!`, `#REF!`, or `#VALUE!`. In this case, the error token is a cell result and can be returned through [IChartDataCell.getValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#getValue--). A formula can also fail at the parsing, reference, dependency, or supported-data level. Aspose.Slides provides spreadsheet-specific exceptions for these cases: [CellInvalidFormulaException](https://reference.aspose.com/slides/androidjava/com.aspose.slides/cellinvalidformulaexception/), [CellInvalidReferenceException](https://reference.aspose.com/slides/androidjava/com.aspose.slides/cellinvalidreferenceexception/), [CellCircularReferenceException](https://reference.aspose.com/slides/androidjava/com.aspose.slides/cellcircularreferenceexception/), and [CellUnsupportedDataException](https://reference.aspose.com/slides/androidjava/com.aspose.slides/cellunsupporteddataexception/). When formulas come from templates or user input, handle these exceptions around recalculation and value access: ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 500, 300); IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook(); IChartDataCell cell = workbook.getCell(0, "A2"); cell.setFormula("SUM(B2:B5)"); try { workbook.calculateFormulas(); System.out.println(cell.getValue()); } catch (CellInvalidFormulaException ex) { System.err.println("Invalid formula: " + ex.getMessage()); } catch (CellInvalidReferenceException ex) { System.err.println("Invalid cell reference: " + ex.getMessage()); } catch (CellCircularReferenceException ex) { System.err.println("Circular reference: " + ex.getMessage()); } catch (CellUnsupportedDataException ex) { System.err.println("Unsupported spreadsheet data: " + ex.getMessage()); } } finally { presentation.dispose(); } ``` ## **Practical Limitations** The formula support in chart worksheets is intended for a defined subset of spreadsheet calculations, not for full Excel compatibility. Keep these constraints in mind when designing a reporting workflow: - Use only the documented constants, operators, references, and functions when you need Aspose.Slides to recalculate formulas. - Recalculate after changing cells that formula results depend on. - Treat cached values from loaded presentations as snapshots, not as a replacement for recalculation after edits. - Test formulas from existing templates before relying on their calculated values, especially when they use functions outside the documented list. - For formulas that require a full spreadsheet calculation engine, calculate them externally and then update the chart workbook with the resulting values. ## **FAQ** **What is the difference between [IChartDataCell.setFormula](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setFormula-java.lang.String-) and [IChartDataCell.setR1C1Formula](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setR1C1Formula-java.lang.String-)?** [IChartDataCell.setFormula](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setFormula-java.lang.String-) stores an A1-style expression such as `B2-C2`. [IChartDataCell.setR1C1Formula](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#setR1C1Formula-java.lang.String-) stores an R1C1-style expression such as `RC[-2]-RC[-1]`. Use the notation that best matches how you generate or copy formulas. **Do I need to read the cell itself or its value after calculation?** [IChartDataWorkbook.getCell](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/#getCell-int-java.lang.String-) returns an [IChartDataCell](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/). To obtain the calculated result, call that cell's [IChartDataCell.getValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdatacell/#getValue--) method after recalculation. **When should I call [IChartDataWorkbook.calculateFormulas](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/#calculateFormulas--)?** Call [IChartDataWorkbook.calculateFormulas](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/#calculateFormulas--) after changing input values or formulas and before you depend on the calculated results. This updates the values of formulas that the built-in evaluator supports. **Does Aspose.Slides support every Excel function?** No. The built-in evaluator supports a documented subset of functions. Functions outside that subset should not be assumed to recalculate correctly. If full Excel formula compatibility is required, perform the calculation with an appropriate spreadsheet engine and write the final values to the chart workbook. **What happens if a loaded presentation contains an unsupported formula?** If the chart data has not changed, the workbook may still contain a previously calculated cached value. After related data is modified, that cached value may no longer be valid. Accessing a cell whose formula cannot be handled can raise [CellUnsupportedDataException](https://reference.aspose.com/slides/androidjava/com.aspose.slides/cellunsupporteddataexception/). **Are formula error values the same as Java exceptions?** No. A result such as `#DIV/0!` is a spreadsheet value produced by a valid calculation. Exceptions such as [CellInvalidFormulaException](https://reference.aspose.com/slides/androidjava/com.aspose.slides/cellinvalidformulaexception/) or [CellCircularReferenceException](https://reference.aspose.com/slides/androidjava/com.aspose.slides/cellcircularreferenceexception/) indicate that the formula cannot be processed normally. **Does a chart update automatically when a formula cell changes?** A chart series can reference workbook cells. Recalculate the workbook first, then save or render the presentation. If the chart data points reference the calculated cells, the chart uses those updated cell values; no separate chart-refresh method is required for this workflow. **Can charts use an external Excel workbook?** Yes, chart data can be configured to use an external workbook through the chart data API. However, the formula calculation workflow described in this article concerns the chart data workbook and the formula subset evaluated by Aspose.Slides. Do not assume that [IChartDataWorkbook.calculateFormulas](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ichartdataworkbook/#calculateFormulas--) provides full recalculation of arbitrary formulas in an external XLSX file. **Can I use formulas that reference another worksheet or workbook?** Excel-style references may exist in chart workbooks, but formula evaluation is limited by the supported parser and function set. If a cross-sheet or external reference is essential, validate that exact formula with your target Aspose.Slides version. For workflows that require broad Excel reference compatibility, calculate the workbook externally and write the resolved values back to the chart data. **Should formula strings start with `=`?** The Aspose.Slides API examples assign expressions such as `B2-C2` or `SUM(B2:B5)` without a leading `=`. Using that form keeps generated formulas consistent with the documented API examples. # Clone Presentation Slides on Android > Duplicate PowerPoint slides with Aspose.Slides for Android. Follow our clear Java code examples to automate PPT creation in seconds and eliminate manual work. Source: https://docs.aspose.com/slides/androidjava/clone-slides/ Updated: 2026-11-08 ## **Introduction** Cloning is the process of making an exact copy or replica of something. Aspose.Slides for Android via Java also makes it possible to make a copy or clone of any slide and then insert that cloned slide to the current or any other opened presentation. The process of slide cloning creates a new slide that can be modified by developers without changing the original slide. There are several possible ways to clone a slide: - Clone at End within a Presentation. - Clone at Another Position within Presentation. - Clone at End in another Presentation. - Clone at Another Position in another Presentation. - Clone at a specific position in another Presentation. In Aspose.Slides for Android via Java, (a collection of [ISlide](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlide) objects) exposed by the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) object provides the [addClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-) and [insertClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#insertClone-int-com.aspose.slides.ISlide-) methods to perform the above types of slide cloning ## **Clone a Slide at the End of a Presentation** If you want to clone a slide and then use it within the same presentation file at the end of the existing slides, use the [addClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-) method according to the steps listed below: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class. 1. Instantiate the [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#getSlides--) class by referencing the Slides collection exposed by the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) object. 1. Call the [addClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-) method exposed by the [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#getSlides--) object and pass the slide to be cloned as a parameter to the [addClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-) method. 1. Write the modified presentation file. In the example given below, we have cloned a slide (lying at the first position – zero index – of the presentation) to the end of the presentation. ```java import com.aspose.slides.*; // Instantiate Presentation class that represents a presentation file Presentation pres = new Presentation("CloneWithinSamePresentationToEnd.pptx"); try { // Clone the desired slide to the end of the collection of slides in the same presentation ISlideCollection slds = pres.getSlides(); slds.addClone(pres.getSlides().get_Item(0)); // Write the modified presentation to disk pres.save("Aspose_CloneWithinSamePresentationToEnd_out.pptx", SaveFormat.Pptx); } finally { pres.dispose(); } ``` ## **Clone a Slide to Another Position within a Presentation** If you want to clone a slide and then use it within the same presentation file but at a different position, use the [insertClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#insertClone-int-com.aspose.slides.ISlide-) method: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class. 1. Instantiate the class by referencing the [**Slides**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#getSlides--) collection exposed by the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) object. 1. Call the [insertClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#insertClone-int-com.aspose.slides.ISlide-) method exposed by the [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#getSlides--) object and pass the slide to be cloned along with the index for the new position as a parameter to the [insertClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#insertClone-int-com.aspose.slides.ISlide-) method. 1. Write the modified presentation as a PPTX file. In the example given below, we have cloned a slide (lying at index 1 – position 2 – of the presentation) to index 2 – Position 3 – of the presentation. ```java import com.aspose.slides.*; // Instantiate Presentation class that represents a presentation file Presentation pres = new Presentation("CloneWithInSamePresentation.pptx"); try { // Get the collection of slides in the same presentation ISlideCollection slds = pres.getSlides(); // Clone the desired slide to the specified index in the same presentation slds.insertClone(2, pres.getSlides().get_Item(1)); // Write the modified presentation to disk pres.save("Aspose_CloneWithInSamePresentation_out.pptx", SaveFormat.Pptx); } finally { pres.dispose(); } ``` ## **Clone a Slide at the End of Another Presentation** If you need to clone a slide from one presentation and use it in another presentation file, at the end of the existing slides: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class containing the presentation the slide will be cloned from. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class containing the destination presentation that the slide will be added to. 1. Instantiate the [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection) class by referencing the [**Slides**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#getSlides--) collection exposed by the Presentation object of the destination presentation. 1. Call the [addClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-) method exposed by the [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#getSlides--) object and pass the slide from the source presentation as a parameter to the [addClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-) method. 1. Write the modified destination presentation file. In the example given below, we have cloned a slide (from the first index of the source presentation) to the end of the destination presentation. ```java import com.aspose.slides.*; // Instantiate Presentation class to load the source presentation file Presentation srcPres = new Presentation("CloneAtEndOfAnother.pptx"); try { // Instantiate Presentation class for destination PPTX (where slide is to be cloned) Presentation destPres = new Presentation(); try { // Clone the desired slide from the source presentation to the end of the collection of slides in destination presentation ISlideCollection slds = destPres.getSlides(); slds.addClone(srcPres.getSlides().get_Item(0)); // Write the destination presentation to disk destPres.save("Aspose2_out.pptx", SaveFormat.Pptx); } finally { destPres.dispose(); } } finally { srcPres.dispose(); } ``` ## **Clone a Slide to Another Position in Another Presentation** If you need to clone a slide from one presentation and use it in another presentation file, at a specific position: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class containing the source presentation the slide will be cloned from. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class containing the presentation the slide will be added to. 1. Instantiate the [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#getSlides--) class by referencing the Slides collection exposed by the Presentation object of the destination presentation. 1. Call the [insertClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#insertClone-int-com.aspose.slides.ISlide-) method exposed by the [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#getSlides--) object and pass the slide from the source presentation along with the desired position as a parameter to the [insertClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#insertClone-int-com.aspose.slides.ISlide-) method. 1. Write the modified destination presentation file. In the example given below, we have cloned a slide (from the zero index of the source presentation) to index 1 (position 2) of the destination presentation. ```java import com.aspose.slides.*; // Instantiate Presentation class to load the source presentation file Presentation srcPres = new Presentation("CloneAtEndOfAnother.pptx"); try { // Instantiate Presentation class for destination PPTX (where slide is to be cloned) Presentation destPres = new Presentation(); try { // Clone the desired slide from the source presentation to the specified index in the destination presentation ISlideCollection slds = destPres.getSlides(); slds.insertClone(1, srcPres.getSlides().get_Item(0)); // Write the destination presentation to disk destPres.save("Aspose2_out.pptx", SaveFormat.Pptx); } finally { destPres.dispose(); } } finally { srcPres.dispose(); } ``` ## **Clone a Slide at a Specific Position in Another Presentation** If you need to clone a slide with a master slide from one presentation from and use it in another presentation, you need to clone the desired master slide from source presentation to destination presentation first. Then you need to use that master slide for cloning slide with master slide. The [**addClone(ISlide, IMasterSlide, boolean)**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-com.aspose.slides.IMasterSlide-boolean-) expects a master slide from destination presentation rather than from source presentation. In order to clone the slide with a master, please follow the steps below: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class containing the source presentation the slide will be cloned from. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class containing the destination presentation the slide will be cloned to. 1. Access the slide to be cloned along with the master slide. 1. Instantiate the [IMasterSlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IMasterSlideCollection) class by referencing the Masters collection exposed by the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) object of the destination presentation. 1. Call the [addClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-) method exposed by the [IMasterSlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IMasterSlideCollection) object and pass the master from the source PPTX to be cloned as a parameter to the [addClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-) method. 1. Instantiate the [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#getSlides--) class by setting the reference to the Slides collection exposed by the [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) object of the destination presentation. 1. Call the [addClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-) method exposed by the [ISlideCollection](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#getSlides--) object and pass the slide from the source presentation to be cloned and master slide as a parameter to the [addClone](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-) method. 1. Write the modified destination presentation file. In the example given below, we have cloned a slide with a master (lying at the zero index of the source presentation) to the end of the destination presentation using a master from source slide. ```java import com.aspose.slides.*; // Instantiate Presentation class to load the source presentation file Presentation srcPres = new Presentation("CloneToAnotherPresentationWithMaster.pptx"); try { // Instantiate Presentation class for destination presentation (where slide is to be cloned) Presentation destPres = new Presentation(); try { // Instantiate ISlide from the collection of slides in source presentation along with // Master slide ISlide SourceSlide = srcPres.getSlides().get_Item(0); IMasterSlide SourceMaster = SourceSlide.getLayoutSlide().getMasterSlide(); // Clone the desired master slide from the source presentation to the collection of masters in the // Destination presentation IMasterSlideCollection masters = destPres.getMasters(); IMasterSlide iSlide = masters.addClone(SourceMaster); // Clone the desired slide from the source presentation with the desired master to the end of the // Collection of slides in the destination presentation ISlideCollection slds = destPres.getSlides(); slds.addClone(SourceSlide, iSlide, true); // Save the destination presentation to disk destPres.save("CloneToAnotherPresentationWithMaster_out.pptx", SaveFormat.Pptx); } finally { destPres.dispose(); } } finally { srcPres.dispose(); } ``` ## **Clone a Slide at the End of a Specified Section** If you want to clone a slide and then use it within the same presentation file but at a different section, then use the [**addClone**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection#addClone-com.aspose.slides.ISlide-com.aspose.slides.ISection-) method exposed by the [**ISlideCollection**](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ISlideCollection) interface. Aspose.Slides for Android via Java makes it possible to clone a slide from the first section and then insert that cloned slide to the second section of the same presentation. The following code snippet shows you how to clone a slide and insert the cloned slide into a specified section. ```java import com.aspose.slides.*; IPresentation presentation = new Presentation(); try { presentation.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 200, 50, 300, 100); presentation.getSections().addSection("Section 1", presentation.getSlides().get_Item(0)); ISection section2 = presentation.getSections().appendEmptySection("Section 2"); presentation.getSlides().addClone(presentation.getSlides().get_Item(0), section2); // Save the destination presentation to disk presentation.save("CloneSlideIntoSpecifiedSection.pptx", SaveFormat.Pptx); } finally { if (presentation != null) presentation.dispose(); } ``` ## **Ensure Matching Slide Size** When cloning slides into another presentation, make sure the destination presentation has the same slide size as the source. If the slide sizes differ, Aspose.Slides does not automatically rescale the cloned shapes—their original coordinates and dimensions are preserved, which may cause the content to appear misaligned or extend beyond the slide boundaries. You can set the destination presentation's slide size to match the source before cloning the master and slide: ```java Dimension2D sourceSize = sourcePresentation.getSlideSize().getSize(); targetPresentation.getSlideSize().setSize( sourceSize.getWidth(), sourceSize.getHeight(), SlideSizeScaleType.DoNotScale); ``` Do this before cloning the master and the slide. [![At the same scale, a source slide contains a rectangle, a smaller destination clips it, and a size-matched destination retains it.](https://docs.aspose.com/slides/androidjava/clone-slides/visual-clone-slides-1f4700a4b669.svg)](https://docs.aspose.com/slides/androidjava/clone-slides/visual-clone-slides-1f4700a4b669.svg) *Illustrative .NET 26.11 output at the same scale. The cloned frame stays at (500, 200), sized 160 × 100 points; the smaller canvas clips it. In the guide’s workflow, match the destination size first, copy the master, then clone against that destination master. The dashed outline marks off-canvas geometry, not exported pixels.* ## **FAQ** **Do speaker notes and reviewer comments get cloned?** Yes. The notes page and review comments are included in the clone. If you don’t want them, [remove them](https://docs.aspose.com/slides/androidjava/presentation-notes/) after insertion. **How are charts and their data sources handled?** The chart object, formatting, and embedded data are copied. If the chart was linked to an external source (e.g., an OLE-embedded workbook), that linkage is preserved as an [OLE object](https://docs.aspose.com/slides/androidjava/manage-ole/). After moving between files, verify data availability and refresh behavior. **Can I control the insertion position and sections for the clone?** Yes. You can insert the clone at a specific slide index and place it into a chosen [section](https://docs.aspose.com/slides/androidjava/slide-section/). If the target section doesn’t exist, create it first and then move the slide into it. # Compare Presentation Slides on Android > Compare PowerPoint and OpenDocument presentations programmatically with Aspose.Slides for Android. Identify slide differences in Java code quickly. Source: https://docs.aspose.com/slides/androidjava/compare-slides/ Updated: 2026-08-05 ## **Overview** Aspose.Slides allows you to compare slides, layout slides, and master slides using the `equals` method provided by the `IBaseSlide` interface and the `BaseSlide` class. This method returns `true` when the compared slides are identical in their structure and static content. ## **Compare Two Slides** Equals method has been added to [IBaseSlide](https://reference.aspose.com/slides/androidjava/com.aspose.slides/IBaseSlide) interface and [BaseSlide](https://reference.aspose.com/slides/androidjava/com.aspose.slides/BaseSlide) class. It returns true for the slides/layout and slides/master slides which identical by its structure and static content.  Two slides are equal if all shapes, styles, texts, animation and other settings. etc. are equal. The comparison doesn't take into account unique identifier values, e.g. SlideId and dynamic content, e.g. current date value in Date Placeholder. ```java import com.aspose.slides.*; Presentation presentation1 = new Presentation("AccessSlides.pptx"); try { Presentation presentation2 = new Presentation("HelloWorld.pptx"); try { for (int i = 0; i < presentation1.getMasters().size(); i++) { for (int j = 0; j < presentation2.getMasters().size(); j++) { if (presentation1.getMasters().get_Item(i).equals(presentation2.getMasters().get_Item(j))) System.out.println(String.format("SomePresentation1 MasterSlide#%d is equal to SomePresentation2 MasterSlide#%d", i, j)); } } } finally { presentation2.dispose(); } } finally { presentation1.dispose(); } ``` ## **FAQ** ### Does the fact that a slide is hidden affect the comparison of the slides themselves? [Hidden status](https://reference.aspose.com/slides/androidjava/com.aspose.slides/slide/#getHidden--) is a presentation/playback-level property, not visual content. The equality of two specific slides is determined by their structure and static content; the mere fact that a slide is hidden does not make the slides different. ### Are hyperlinks and their parameters taken into account? Yes. Links are part of a slide’s static content. If the URL or the hyperlink action differs, this is usually treated as a difference in static content. ### If a chart refers to an external Excel file, will the contents of that file be taken into account? No. The comparison is performed based on the slides themselves. External data sources are generally not read at comparison time; only what is present in the slide’s structure and static state is considered. # Manage Connectors in Presentations on Android > Learn how to add, attach, reroute, adjust, and inspect straight, bent, and curved PowerPoint connectors with Aspose.Slides for Android via Java. Source: https://docs.aspose.com/slides/androidjava/connector/ Updated: 2026-08-27 ## **Overview** A connector is a line that can remain attached to two shapes when either shape moves. Its ends attach to connection sites, represented by green dots in PowerPoint. Some bent and curved connectors also expose adjustment points, represented by orange dots, that control the position of individual connector segments. Aspose.Slides represents connectors through the [IConnector](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iconnector/) interface. You can create them, attach their ends to shapes, choose connection sites, reroute them, and modify the geometry of connectors that have adjustment points. ## **Connector Types** The [ShapeType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/shapetype/) class includes straight, bent, and curved connector presets. The following table shows the available connector geometries and the number of adjustment points defined by each preset. | Connector | Image | Number of adjustment points | |---|---|---| | `ShapeType.Line` | ![shapetype-lineconnector](https://docs.aspose.com/slides/androidjava/connector/shapetype-lineconnector.png) | 0 | | `ShapeType.StraightConnector1` | ![shapetype-straightconnector1](https://docs.aspose.com/slides/androidjava/connector/shapetype-straightconnector1.png) | 0 | | `ShapeType.BentConnector2` | ![shapetype-bent-connector2](https://docs.aspose.com/slides/androidjava/connector/shapetype-bent-connector2.png) | 0 | | `ShapeType.BentConnector3` | ![shapetype-bentconnector3](https://docs.aspose.com/slides/androidjava/connector/shapetype-bentconnector3.png) | 1 | | `ShapeType.BentConnector4` | ![shapetype-bentconnector4](https://docs.aspose.com/slides/androidjava/connector/shapetype-bentconnector4.png) | 2 | | `ShapeType.BentConnector5` | ![shapetype-bentconnector5](https://docs.aspose.com/slides/androidjava/connector/shapetype-bentconnector5.png) | 3 | | `ShapeType.CurvedConnector2` | ![shapetype-curvedconnector2](https://docs.aspose.com/slides/androidjava/connector/shapetype-curvedconnector2.png) | 0 | | `ShapeType.CurvedConnector3` | ![shapetype-curvedconnector3](https://docs.aspose.com/slides/androidjava/connector/shapetype-curvedconnector3.png) | 1 | | `ShapeType.CurvedConnector4` | ![shapetype-curvedconnector4](https://docs.aspose.com/slides/androidjava/connector/shapetype-curvedconnector4.png) | 2 | | `ShapeType.CurvedConnector5` | ![shapetype.curvedconnector5](https://docs.aspose.com/slides/androidjava/connector/shapetype.curvedconnector5.png) | 3 | The number and meaning of adjustment points are part of the selected connector preset. Do not assume that two different connector types expose the same collection layout. ## **Connect Two Shapes** Use [IShapeCollection.addConnector](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishapecollection/#addConnector-int-float-float-float-float-) to add a connector, and use [IConnector.setStartShapeConnectedTo](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iconnector/#setStartShapeConnectedTo-com.aspose.slides.IShape-) and [IConnector.setEndShapeConnectedTo](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iconnector/#setEndShapeConnectedTo-com.aspose.slides.IShape-) to attach its ends. After both ends are attached, [IConnector.reroute](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iconnector/#reroute--) selects a short route between the shapes. The following example connects an ellipse and a rectangle with a bent connector: ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape ellipse = slide.getShapes().addAutoShape(ShapeType.Ellipse, 40, 80, 120, 80); IAutoShape rectangle = slide.getShapes().addAutoShape(ShapeType.Rectangle, 320, 240, 140, 80); IConnector connector = slide.getShapes().addConnector(ShapeType.BentConnector2, 0, 0, 10, 10); connector.setStartShapeConnectedTo(ellipse); connector.setEndShapeConnectedTo(rectangle); connector.reroute(); presentation.save("connected-shapes.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` Calling `reroute` can change the [setStartShapeConnectionSiteIndex](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iconnector/#setStartShapeConnectionSiteIndex-long-) and [setEndShapeConnectionSiteIndex](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iconnector/#setEndShapeConnectionSiteIndex-long-) values. Assign specific connection sites after rerouting if those sites must remain fixed. ## **Choose a Connection Site** Each connectable shape reports its number of sites through [IShape.getConnectionSiteCount](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishape/#getConnectionSiteCount--). Validate a preferred zero-based site index before assigning it to a connector end; site counts vary by shape geometry. This example attaches the connector to a particular site on the ellipse when that site exists: ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape ellipse = slide.getShapes().addAutoShape(ShapeType.Ellipse, 40, 80, 120, 80); IAutoShape rectangle = slide.getShapes().addAutoShape(ShapeType.Rectangle, 320, 240, 140, 80); IConnector connector = slide.getShapes().addConnector(ShapeType.BentConnector3, 0, 0, 10, 10); connector.setStartShapeConnectedTo(ellipse); connector.setEndShapeConnectedTo(rectangle); long preferredSiteIndex = 2; if (preferredSiteIndex < ellipse.getConnectionSiteCount()) { connector.setStartShapeConnectionSiteIndex(preferredSiteIndex); } else { System.out.println("The ellipse has only " + ellipse.getConnectionSiteCount() + " connection sites."); } presentation.save("specific-connection-site.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` ## **Adjust a Connector Point** Connectors with adjustment points expose them through [IGeometryShape.getAdjustments](https://reference.aspose.com/slides/androidjava/com.aspose.slides/igeometryshape/#getAdjustments--). Inspect every [IAdjustValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iadjustvalue/) and check its [getType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iadjustvalue/#getType--) value before changing it with [setRawValue](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iadjustvalue/#setRawValue-long-). The general rules for identifying preset shape adjustments are described in [Shape Manipulation](https://docs.aspose.com/slides/androidjava/shape-manipulations/). The number, order, meaning, and valid value range of connector adjustments depend on the connector preset. The adjustment type is read-only, while the adjustment value is writable. The read-only [getName](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iadjustvalue/#getName--) method provides additional identification when a connector contains more than one adjustment of the same semantic type. ### **Route Around an Obstacle** In the following layout, a `BentConnector5` connector between two shapes passes through a third shape: ![connector-obstruction](https://docs.aspose.com/slides/androidjava/connector/connector-obstruction.png) This code creates the obstructed connector: ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); slide.getShapes().addAutoShape(ShapeType.Rectangle, 300, 150, 150, 75); IAutoShape sourceShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 500, 400, 100, 50); IAutoShape targetShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 70, 30); IConnector connector = slide.getShapes().addConnector(ShapeType.BentConnector5, 20, 20, 400, 300); connector.getLineFormat().setEndArrowheadStyle(LineArrowheadStyle.Triangle); connector.getLineFormat().getFillFormat().setFillType(FillType.Solid); connector.getLineFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK); connector.setStartShapeConnectedTo(sourceShape); connector.setEndShapeConnectedTo(targetShape); connector.setStartShapeConnectionSiteIndex(2); presentation.save("connector-obstruction.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` Moving the vertical bend changes the route so that the connector bypasses the obstacle: ![connector-obstruction-fixed](https://docs.aspose.com/slides/androidjava/connector/connector-obstruction-fixed.png) Instead of assuming that collection index `1` always represents the vertical bend, this example searches for `ConnectorBendPositionY` and changes it only when the expected semantic type is present: ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); slide.getShapes().addAutoShape(ShapeType.Rectangle, 300, 150, 150, 75); IAutoShape sourceShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 500, 400, 100, 50); IAutoShape targetShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 70, 30); IConnector connector = slide.getShapes().addConnector(ShapeType.BentConnector5, 20, 20, 400, 300); connector.getLineFormat().setEndArrowheadStyle(LineArrowheadStyle.Triangle); connector.getLineFormat().getFillFormat().setFillType(FillType.Solid); connector.getLineFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK); connector.setStartShapeConnectedTo(sourceShape); connector.setEndShapeConnectedTo(targetShape); connector.setStartShapeConnectionSiteIndex(2); IAdjustValue verticalBend = null; for (int adjustmentIndex = 0; adjustmentIndex < connector.getAdjustments().size(); adjustmentIndex++) { IAdjustValue adjustment = connector.getAdjustments().get_Item(adjustmentIndex); System.out.println(adjustment.getName() + ": " + adjustment.getType() + ", raw value = " + adjustment.getRawValue()); if (adjustment.getType() == ShapeAdjustmentType.ConnectorBendPositionY) { verticalBend = adjustment; break; } } if (verticalBend == null) { System.out.println("The connector does not expose a vertical bend adjustment."); } else { verticalBend.setRawValue(60000); presentation.save("connector-obstruction-fixed.pptx", SaveFormat.Pptx); } } finally { presentation.dispose(); } ``` A `BentConnector5` has two `ConnectorBendPositionX` adjustments and one `ConnectorBendPositionY` adjustment. If the type you need occurs more than once, inspect `getName` and the known geometry of that preset before selecting one. If an adjustment reports `ShapeAdjustmentType.Custom`, treat its meaning and range as preset-specific and do not change it until that contract is known. ## **Relate Adjustment Values to Connector Geometry** For bent connectors, adjustment values can be used to estimate the positions of individual segments. These calculations are specific to the connector preset: - `BentConnector4` normally exposes one `ConnectorBendPositionX` and one `ConnectorBendPositionY` adjustment. - For these bend positions, dividing the value returned by `getRawValue` by `100000f` produces the fraction of the connector frame width or height used by the examples below. - A connector frame can be rotated or flipped, so frame coordinates must be transformed before they are compared with slide coordinates. The following examples use `getType` to identify the adjustments first. They do not treat collection indexes as portable identifiers. ### **Unrotated Connector** The initial layout contains two text shapes connected by a `BentConnector4`: ![connector-shape-complex](https://docs.aspose.com/slides/androidjava/connector/connector-shape-complex.png) This example inspects the connector and obtains its horizontal and vertical bend adjustments: ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape sourceShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 60, 25); sourceShape.getTextFrame().setText("From"); IAutoShape targetShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 500, 100, 60, 25); targetShape.getTextFrame().setText("To"); IConnector connector = slide.getShapes().addConnector(ShapeType.BentConnector4, 20, 20, 400, 300); connector.getLineFormat().setEndArrowheadStyle(LineArrowheadStyle.Triangle); connector.getLineFormat().getFillFormat().setFillType(FillType.Solid); connector.getLineFormat().getFillFormat().getSolidFillColor().setColor(Color.RED); connector.getLineFormat().setWidth(3); connector.setStartShapeConnectedTo(sourceShape); connector.setStartShapeConnectionSiteIndex(3); connector.setEndShapeConnectedTo(targetShape); connector.setEndShapeConnectionSiteIndex(2); for (int adjustmentIndex = 0; adjustmentIndex < connector.getAdjustments().size(); adjustmentIndex++) { IAdjustValue adjustment = connector.getAdjustments().get_Item(adjustmentIndex); System.out.println(adjustment.getName() + ": " + adjustment.getType() + ", raw value = " + adjustment.getRawValue()); } } finally { presentation.dispose(); } ``` To change both bends, locate each expected type and modify the values only after both have been found: ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape sourceShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 60, 25); IAutoShape targetShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 500, 100, 60, 25); IConnector connector = slide.getShapes().addConnector(ShapeType.BentConnector4, 20, 20, 400, 300); connector.setStartShapeConnectedTo(sourceShape); connector.setStartShapeConnectionSiteIndex(3); connector.setEndShapeConnectedTo(targetShape); connector.setEndShapeConnectionSiteIndex(2); IAdjustValue horizontalBend = null; IAdjustValue verticalBend = null; for (int adjustmentIndex = 0; adjustmentIndex < connector.getAdjustments().size(); adjustmentIndex++) { IAdjustValue adjustment = connector.getAdjustments().get_Item(adjustmentIndex); if (adjustment.getType() == ShapeAdjustmentType.ConnectorBendPositionX) { horizontalBend = adjustment; } else if (adjustment.getType() == ShapeAdjustmentType.ConnectorBendPositionY) { verticalBend = adjustment; } } if (horizontalBend == null || verticalBend == null) { System.out.println("The connector does not expose the expected bend adjustments."); } else { horizontalBend.setRawValue(horizontalBend.getRawValue() + 20000); verticalBend.setRawValue(verticalBend.getRawValue() + 200000); presentation.save("connector-adjusted.pptx", SaveFormat.Pptx); } } finally { presentation.dispose(); } ``` The result is a connector whose horizontal and vertical segments have moved: ![connector-adjusted-1](https://docs.aspose.com/slides/androidjava/connector/connector-adjusted-1.png) Once the semantic types are known, their values can be converted into connector-frame coordinates. This example draws a thin rectangle over the vertical segment controlled by the two bend adjustments: ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape sourceShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 60, 25); IAutoShape targetShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 500, 100, 60, 25); IConnector connector = slide.getShapes().addConnector(ShapeType.BentConnector4, 20, 20, 400, 300); connector.setStartShapeConnectedTo(sourceShape); connector.setStartShapeConnectionSiteIndex(3); connector.setEndShapeConnectedTo(targetShape); connector.setEndShapeConnectionSiteIndex(2); IAdjustValue horizontalBend = null; IAdjustValue verticalBend = null; for (int adjustmentIndex = 0; adjustmentIndex < connector.getAdjustments().size(); adjustmentIndex++) { IAdjustValue adjustment = connector.getAdjustments().get_Item(adjustmentIndex); if (adjustment.getType() == ShapeAdjustmentType.ConnectorBendPositionX) { horizontalBend = adjustment; } else if (adjustment.getType() == ShapeAdjustmentType.ConnectorBendPositionY) { verticalBend = adjustment; } } if (horizontalBend == null || verticalBend == null) { System.out.println("The connector does not expose the expected bend adjustments."); } else { float x = connector.getX() + connector.getWidth() * horizontalBend.getRawValue() / 100000f; float y = connector.getY(); float height = connector.getHeight() * verticalBend.getRawValue() / 100000f; slide.getShapes().addAutoShape(ShapeType.Rectangle, x, y, 1, height); presentation.save("connector-segment-guide.pptx", SaveFormat.Pptx); } } finally { presentation.dispose(); } ``` The guide shape marks the calculated segment: ![connector-adjusted-2](https://docs.aspose.com/slides/androidjava/connector/connector-adjusted-2.png) ### **Rotated or Flipped Connector** When the same connector geometry is oriented vertically, its [IShape.getFrame](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishape/#getFrame--), [ShapeFrame.getFlipH](https://reference.aspose.com/slides/androidjava/com.aspose.slides/shapeframe/#getFlipH--), and [ShapeFrame.getFlipV](https://reference.aspose.com/slides/androidjava/com.aspose.slides/shapeframe/#getFlipV--) values affect the conversion from connector-frame coordinates to slide coordinates. This example creates and adjusts the vertically oriented connector: ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape sourceShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 60, 25); sourceShape.getTextFrame().setText("From"); IAutoShape targetShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 400, 60, 25); targetShape.getTextFrame().setText("To 1"); IConnector connector = slide.getShapes().addConnector(ShapeType.BentConnector4, 20, 20, 400, 300); connector.getLineFormat().setEndArrowheadStyle(LineArrowheadStyle.Triangle); connector.getLineFormat().getFillFormat().setFillType(FillType.Solid); int connectorColor = Color.rgb(102, 205, 170); connector.getLineFormat().getFillFormat().getSolidFillColor().setColor(connectorColor); connector.getLineFormat().setWidth(3); connector.setStartShapeConnectedTo(sourceShape); connector.setStartShapeConnectionSiteIndex(2); connector.setEndShapeConnectedTo(targetShape); connector.setEndShapeConnectionSiteIndex(3); for (int adjustmentIndex = 0; adjustmentIndex < connector.getAdjustments().size(); adjustmentIndex++) { IAdjustValue adjustment = connector.getAdjustments().get_Item(adjustmentIndex); if (adjustment.getType() == ShapeAdjustmentType.ConnectorBendPositionX) { adjustment.setRawValue(adjustment.getRawValue() + 20000); } else if (adjustment.getType() == ShapeAdjustmentType.ConnectorBendPositionY) { adjustment.setRawValue(adjustment.getRawValue() + 200000); } } presentation.save("vertical-connector-adjusted.pptx", SaveFormat.Pptx); } finally { presentation.dispose(); } ``` The adjusted connector appears vertically between the shapes: ![connector-adjusted-3](https://docs.aspose.com/slides/androidjava/connector/connector-adjusted-3.png) For an arbitrary rotation angle `alpha`, rotate a connector-frame point `(x, y)` around the frame center `(x0, y0)`: `X = (x - x0) * cos(alpha) - (y - y0) * sin(alpha) + x0` `Y = (x - x0) * sin(alpha) + (y - y0) * cos(alpha) + y0` The following code handles the 90-degree orientation used in this example and draws a red guide over the corresponding connector segment: ```java import com.aspose.slides.*; import android.graphics.Color; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IAutoShape sourceShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 60, 25); IAutoShape targetShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 400, 60, 25); IConnector connector = slide.getShapes().addConnector(ShapeType.BentConnector4, 20, 20, 400, 300); connector.setStartShapeConnectedTo(sourceShape); connector.setStartShapeConnectionSiteIndex(2); connector.setEndShapeConnectedTo(targetShape); connector.setEndShapeConnectionSiteIndex(3); IAdjustValue horizontalBend = null; IAdjustValue verticalBend = null; for (int adjustmentIndex = 0; adjustmentIndex < connector.getAdjustments().size(); adjustmentIndex++) { IAdjustValue adjustment = connector.getAdjustments().get_Item(adjustmentIndex); if (adjustment.getType() == ShapeAdjustmentType.ConnectorBendPositionX) { horizontalBend = adjustment; } else if (adjustment.getType() == ShapeAdjustmentType.ConnectorBendPositionY) { verticalBend = adjustment; } } if (horizontalBend == null || verticalBend == null) { System.out.println("The connector does not expose the expected bend adjustments."); } else { horizontalBend.setRawValue(horizontalBend.getRawValue() + 20000); verticalBend.setRawValue(verticalBend.getRawValue() + 200000); float x = connector.getX(); float y = connector.getY(); if (connector.getFrame().getFlipH() == NullableBool.True) { x += connector.getWidth(); } if (connector.getFrame().getFlipV() == NullableBool.True) { y += connector.getHeight(); } x += connector.getWidth() * horizontalBend.getRawValue() / 100000f; float rotatedX = connector.getFrame().getCenterX() - y + connector.getFrame().getCenterY(); float rotatedY = x - connector.getFrame().getCenterX() + connector.getFrame().getCenterY(); float segmentWidth = connector.getHeight() * verticalBend.getRawValue() / 100000f; IAutoShape guide = slide.getShapes().addAutoShape(ShapeType.Rectangle, rotatedX, rotatedY, segmentWidth, 1); guide.getLineFormat().getFillFormat().setFillType(FillType.Solid); guide.getLineFormat().getFillFormat().getSolidFillColor().setColor(Color.RED); presentation.save("rotated-connector-segment-guide.pptx", SaveFormat.Pptx); } } finally { presentation.dispose(); } ``` The red guide marks the calculated segment after the coordinate transformation: ![connector-adjusted-4](https://docs.aspose.com/slides/androidjava/connector/connector-adjusted-4.png) These formulas describe the presets used in the examples, not a universal connector model. Validate the adjustment types, frame orientation, and value ranges before applying the same calculation to a different preset. ## **Find a Connector Direction Angle** The direction of a straight connector can be calculated from its width and height, with horizontal and vertical flips applied. The following example reports the clockwise angle from the positive horizontal axis in slide coordinates: ```java import com.aspose.slides.*; Presentation presentation = new Presentation(); try { ISlide slide = presentation.getSlides().get_Item(0); IConnector connector = slide.getShapes().addConnector(ShapeType.StraightConnector1, 100, 100, 200, 100); boolean flipH = connector.getFrame().getFlipH() == NullableBool.True; boolean flipV = connector.getFrame().getFlipV() == NullableBool.True; float deltaX = connector.getWidth() * (flipH ? -1 : 1); float deltaY = connector.getHeight() * (flipV ? -1 : 1); double angle = Math.atan2(deltaY, deltaX) * 180.0 / Math.PI; if (angle < 0) { angle += 360; } System.out.printf("Connector direction: %.2f degrees%n", angle); } finally { presentation.dispose(); } ``` ## **FAQ** **How can I tell whether a connector can attach to a shape?** Check the shape's [getConnectionSiteCount](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ishape/#getConnectionSiteCount--) value. A positive count means the shape exposes connection sites. Validate the selected site index before assigning it to either connector end. **Can I identify a connector adjustment by its collection index?** An index is meaningful only for a known connector preset and collection layout. Check [IAdjustValue.getType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iadjustvalue/#getType--) before modifying a value, and use [IAdjustValue.getName](https://reference.aspose.com/slides/androidjava/com.aspose.slides/iadjustvalue/#getName--) as additional information when the same semantic type occurs more than once. **What happens when a connected shape is deleted?** The corresponding connector end becomes detached. The connector remains on the slide and can be deleted, positioned as a free line, or attached to another shape. **Are connector bindings preserved when a slide is copied?** Bindings are generally preserved when the connected shapes are copied with the slide. If a connector is copied without one of its target shapes, the affected end must be attached again. # Convert ODP to PPTX on Android > Convert ODP to PPTX with Aspose.Slides for Android. Clean Java code examples, batch tips, and high-quality results—no PowerPoint needed. Source: https://docs.aspose.com/slides/androidjava/convert-odp-to-pptx/ Updated: 2026-08-05 ## **Overview** This article explains how to convert an ODP presentation to PPTX format using Aspose.Slides. ## **Convert ODP to PPTX/PPT Presentation** Aspose.Slides for Android via Java offers [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class that represents a presentation file. [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation) class can now also access ODP through [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/Presentation#Presentation-java.lang.String-) constructor when the object is instantiated. The following example shows how to convert a ODP Presentation into PPTX Presentation. ```java import com.aspose.slides.*; // Open the ODP file Presentation pres = new Presentation("AccessOpenDoc.odp"); try { // Saving the ODP presentation to PPTX format pres.save("AccessOpenDoc_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); } ``` ## **Live Example** You can visit [**Aspose.Slides Conversion**](https://products.aspose.app/slides/conversion/) web app, which is built with **Aspose.Slides API.** The app demonstrates how ODP to PPTX conversion can be implemented with Aspose.Slides API. ## **FAQ** ### Do I need to install Microsoft PowerPoint or LibreOffice to convert ODP to PPTX? No. Aspose.Slides works standalone and does not require third-party applications to read or write ODP/PPTX. ### Are master slides, layouts, and themes preserved during conversion? Yes. The library uses a full presentation object model and retains structure, including master slides and layouts, so the design remains correct after conversion. ### Can I convert password-protected ODP files? Yes. Aspose.Slides supports detecting protection, opening and working with [protected presentations](https://docs.aspose.com/slides/androidjava/password-protected-presentation/) (including ODP) when you provide the password, as well as configuring encryption and access to document properties. ### Is Aspose.Slides suitable for cloud or REST-based conversion services? Yes. You can use the local library in your own backend or [Aspose.Slides Cloud](https://products.aspose.cloud/slides/family/) (REST API); both options support ODP → PPTX conversion. ## Related articles - [Convert PPT to PPTX on Android](https://docs.aspose.com/slides/androidjava/convert-ppt-to-pptx/) # Convert OpenDocument Presentations on Android > Aspose.Slides for Android lets you convert ODP to PDF, HTML, and image formats with ease. Boost your Java apps with fast and accurate presentation conversion. Source: https://docs.aspose.com/slides/androidjava/convert-openoffice-odp/ Updated: 2026-08-05 ## **Introduction** [**Aspose.Slides API**](https://products.aspose.com/slides/androidjava/) allows you to convert OpenDocument (ODP) presentations to many formats (HTML, PDF, TIFF, SWF, XPS, etc.). The API used to convert ODP files to other document formats is the same as the one used for PowerPoint (PPT and PPTX) conversion operations. For example, if you need to convert an ODP presentation to PDF, you can do it as follows: ```java import com.aspose.slides.*; Presentation presentation = null; try { presentation = new Presentation("pres.odp"); presentation.save("pres.pdf", SaveFormat.Pdf); } finally { if (presentation != null) { presentation.dispose(); } } ``` ## **FAQ** ### What if the formatting of my ODP file changes after conversion? ODP and PowerPoint use different presentation models, and some elements—like tables, custom fonts, or fill styles—may not render exactly the same. It is recommended to review the output and adjust layout or formatting in code if needed. ### Do I need OpenOffice or LibreOffice installed to use ODP conversion? No, Aspose.Slides is a standalone library and does not require OpenOffice or LibreOffice to be installed on your system. ### Can I customize the output format during ODP conversion (e.g., set PDF options)? Yes, Aspose.Slides provides rich options for customizing the output. For example, when saving to PDF, you can control compression, image quality, text rendering, and more through the [PdfOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/pdfoptions/) class. ### Is Aspose.Slides suitable for server-side or cloud-based ODP processing? Absolutely. Aspose.Slides is designed to work in both desktop and server environments, including cloud-based platforms like Azure, AWS, and Docker containers, without any UI dependencies. ## Related articles - [Convert PowerPoint Presentations on Android | HTML, PNG, PDF, Word, TIFF](https://docs.aspose.com/slides/androidjava/convert-powerpoint/) - [Convert Presentations to Multiple Formats on Android](https://docs.aspose.com/slides/androidjava/convert-presentation/) # Convert PowerPoint Presentations in Handout Mode on Android > Convert presentations to handouts in Java. Set slides per page, keep notes, export to PDF or images with Aspose.Slides for Android, with sample code. Try it free. Source: https://docs.aspose.com/slides/androidjava/convert-powerpoint-in-handout-mode/ Updated: 2026-11-08 ## **Introduction** Aspose.Slides provides the ability to convert presentations into various formats, including creating handouts for printing in Handout mode. This mode allows you to configure how multiple slides appear on a single page, making it useful for conferences, seminars, and other events. You can enable this mode by setting the `setSlidesLayoutOptions` method in the [IPdfOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ipdfoptions/), [IRenderingOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/irenderingoptions/), [IHtmlOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ihtmloptions/), and [ITiffOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/itiffoptions/) interfaces. To set the handout page dimensions and orientation before export, see [Notes Page Size](https://docs.aspose.com/slides/androidjava/notes-size/). ## **Handout Mode Export** To configure Handout mode, use the [HandoutLayoutingOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/handoutlayoutingoptions/) object, which determines how many slides are placed on a single page and other display parameters. Below is a code example showing how to convert a presentation to PDF in Handout mode. ```java import com.aspose.slides.*; // Load a presentation. Presentation presentation = new Presentation("sample.pptx"); try { // Set the export options. HandoutLayoutingOptions slidesLayoutOptions = new HandoutLayoutingOptions(); slidesLayoutOptions.setHandout(HandoutType.Handouts4Horizontal); // 4 slides on one page horizontally slidesLayoutOptions.setPrintSlideNumbers(true); // print slide numbers slidesLayoutOptions.setPrintFrameSlide(true); // print a frame around slides slidesLayoutOptions.setPrintComments(false); // no comments PdfOptions pdfOptions = new PdfOptions(); pdfOptions.setSlidesLayoutOptions(slidesLayoutOptions); // Export the presentation to PDF with the chosen layout. presentation.save("output.pdf", SaveFormat.Pdf, pdfOptions); } finally { if (presentation != null) presentation.dispose(); } ``` Keep in mind that the `setSlidesLayoutOptions` method is available only for certain output formats, such as PDF, HTML, TIFF, and when rendering as images. [![Four separately exported PDF pages are followed by one four-thumbnail handout. Slide 1 and Slide 2 are across the top, and Slide 3 and Slide 4 are across the bottom.](https://docs.aspose.com/slides/androidjava/convert-powerpoint-in-handout-mode/visual-convert-powerpoint-in-handout-mode-2d311e39d758.svg)](https://docs.aspose.com/slides/androidjava/convert-powerpoint-in-handout-mode/visual-convert-powerpoint-in-handout-mode-2d311e39d758.svg) *The same four numbered slides exported as one slide per PDF page and as a horizontal handout. The handout includes printed slide numbers and frames.* ## **FAQ** **What is the maximum number of slide thumbnails per page in Handout mode?** Aspose.Slides supports [presets](https://reference.aspose.com/slides/androidjava/com.aspose.slides/handouttype/) up to 9 thumbnails per page with horizontal or vertical ordering: 1, 2, 3, 4 (horizontal/vertical), 6 (horizontal/vertical), and 9 (horizontal/vertical). **Can I define a custom grid, such as 5 or 8 slides per page?** No. The number and ordering of thumbnails are controlled strictly by the [HandoutType](https://reference.aspose.com/slides/androidjava/com.aspose.slides/handouttype/) class; arbitrary layouts are not supported. **Can I include hidden slides in the Handout output?** Yes. Enable the hidden slides using the `setShowHiddenSlides` method in the export settings for the target format, such as [PdfOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/pdfoptions/), [HtmlOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/htmloptions/), or [TiffOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/tiffoptions/). # Convert PowerPoint Presentations to Animated GIFs on Android > Easily convert PowerPoint presentations (PPT, PPTX) to animated GIFs with Aspose.Slides for Android via Java. Fast, high-quality results. Source: https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-animated-gif/ Updated: 2026-08-13 ## **Overview** Aspose.Slides allows you to convert PowerPoint presentations to animated GIF files with just a few lines of code. This is useful when you need to share slide content in a lightweight, widely supported animated format that can be embedded in web pages, messengers, or documentation. This article explains how to export a presentation to GIF using default settings and how to customize the output by configuring options such as frame size, slide delay, and transition frame rate through [GifOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/gifoptions/). ## **Convert Presentations to Animated GIF Using Default Settings** This sample code in Java shows you how to convert a presentation to animated GIF using standard settings: ```java import com.aspose.slides.*; Presentation pres = new Presentation("pres.pptx"); try { pres.save("pres.gif", SaveFormat.Gif); } finally { if (pres != null) pres.dispose(); } ``` The animated GIF will be created with default parameters. If you prefer to customize the parameters for the GIF, you can use the [GifOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/GifOptions) class. See the sample code below. ## **Convert Presentations to Animated GIF Using Custom Settings** This sample code shows you how to convert a presentation to animated GIF using custom settings in Java: ```java import com.aspose.slides.*; import java.awt.Dimension; Presentation pres = new Presentation("pres.pptx"); try { GifOptions gifOptions = new GifOptions(); gifOptions.setFrameSize(new Dimension(960, 720)); // the size of the resulted GIF gifOptions.setDefaultDelay(2000); // how long each slide will be showed until it will be changed to the next one gifOptions.setTransitionFps(35); // increase FPS to better transition animation quality pres.save("pres.gif", SaveFormat.Gif, gifOptions); } finally { if (pres != null) pres.dispose(); } ``` You may want to check out a FREE [Text to GIF](https://products.aspose.app/slides/text-to-gif) converter developed by Aspose. ## **FAQ** ### What if the fonts used in the presentation aren’t installed on the system? Install the missing fonts or [configure fallback fonts](https://docs.aspose.com/slides/androidjava/powerpoint-fonts/). Aspose.Slides will substitute, but the appearance may differ. For branding, always ensure the required typefaces are explicitly available. ### Can I overlay a watermark on the GIF frames? Yes. [Add a semi-transparent object/logo](https://docs.aspose.com/slides/androidjava/watermark/) to the master slide or to individual slides before export — the watermark will appear on every frame. # Convert PowerPoint Presentations to HTML on Android > Convert PowerPoint presentations to HTML on Android. Use Aspose.Slides for Android via Java to export PPT and PPTX files, selected slides, notes, fonts, images, SVG, and media. Source: https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-html/ Updated: 2026-08-05 ## **Overview** Aspose.Slides for Android via Java can save PowerPoint presentations as HTML without Microsoft PowerPoint. The basic conversion is a single [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) load and a `save` call with [SaveFormat](https://reference.aspose.com/slides/androidjava/com.aspose.slides/saveformat/). Use [HtmlOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/htmloptions/) when you need to control the exported layout, fonts, images, notes, comments, SVG output, or linked resources. This guide focuses on practical HTML export scenarios: - Export a whole presentation or selected slides. - Generate fixed-layout, responsive, or SVG-based HTML. - Include speaker notes and comments. - Control image quality and cropped image data. - Embed fonts or save font files separately. - Choose how external resources and media files are written and referenced. By default, HTML export produces a self-contained HTML document where most resources are embedded. This is convenient for sharing one file, but it can increase output size. For web publishing, consider external resources, lower image DPI, and only embedding fonts that are not reliably available in the target environment. ## **Convert a Presentation to HTML** To export a presentation to HTML, load it with [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) and save it with [SaveFormat.Html](https://reference.aspose.com/slides/androidjava/com.aspose.slides/saveformat/). ```java import com.aspose.slides.*; Presentation presentation = new Presentation("presentation.pptx"); try { presentation.save("presentation.html", SaveFormat.Html); } finally { presentation.dispose(); } ``` This example writes one HTML file. The presentation object is disposed in the `finally` block, which releases file handles and rendering resources after export. ## **Use HtmlOptions** [HtmlOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/htmloptions/) is the main configuration class for HTML export. Common settings include: - `SlidesLayoutOptions`: adds notes, comments, handouts, or other layout information. - `HtmlFormatter`: changes the HTML document structure or delegates formatting to a controller. - `SlideImageFormat`: changes how slides are represented, for example as SVG. - `PicturesCompression`: controls image DPI and output size. - `DeletePicturesCroppedAreas`: keeps or removes cropped image data. - `SvgResponsiveLayout`: makes exported SVG content adapt to its container. - `ShowHiddenSlides`: includes hidden slides when required. The following sections show the most common options separately so you can combine only the ones your workflow needs. ## **Convert Selected Slides to HTML** The `Presentation.save` overload that accepts slide numbers uses 1-based slide positions. The loop below saves every slide to a separate HTML file. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("presentation.pptx"); try { int slideCount = presentation.getSlides().size(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { int slideNumber = slideIndex + 1; int[] slideNumbers = { slideNumber }; String htmlFileName = "slide-" + slideNumber + ".html"; presentation.save(htmlFileName, slideNumbers, SaveFormat.Html); } } finally { presentation.dispose(); } ``` Use this pattern when a website or application needs one HTML page per slide. If each slide should have the same layout, create one [HtmlOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/htmloptions/) instance and pass it to each `save` call. ## **Create Responsive HTML** [ResponsiveHtmlController](https://reference.aspose.com/slides/androidjava/com.aspose.slides/responsivehtmlcontroller/) provides responsive HTML output through [HtmlFormatter](https://reference.aspose.com/slides/androidjava/com.aspose.slides/htmlformatter/). Use it when the exported page should adapt better to browser width. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("presentation.pptx"); try { ResponsiveHtmlController controller = new ResponsiveHtmlController(); HtmlFormatter formatter = HtmlFormatter.createCustomFormatter(controller); HtmlOptions htmlOptions = new HtmlOptions(); htmlOptions.setHtmlFormatter(formatter); presentation.save("presentation-responsive.html", SaveFormat.Html, htmlOptions); } finally { presentation.dispose(); } ``` For SVG-based responsive layout, set `SvgResponsiveLayout` on [HtmlOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/htmloptions/). This is useful when the slide content is exported as scalable SVG markup. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("presentation.pptx"); try { HtmlOptions htmlOptions = new HtmlOptions(); htmlOptions.setSvgResponsiveLayout(true); presentation.save("presentation-svg-responsive.html", SaveFormat.Html, htmlOptions); } finally { presentation.dispose(); } ``` ## **Include Speaker Notes and Comments** Use [NotesCommentsLayoutingOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/notescommentslayoutingoptions/) through `HtmlOptions.SlidesLayoutOptions` to include speaker notes or comments. Notes and comments are hidden by default unless you choose their positions. Suppose the source presentation contains speaker notes: ![Slide with speaker notes in PowerPoint](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-html/slide_with_notes.png) The following code exports the slide content with speaker notes below the slide. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("presentation.pptx"); try { NotesCommentsLayoutingOptions layoutOptions = new NotesCommentsLayoutingOptions(); layoutOptions.setNotesPosition(NotesPositions.BottomFull); HtmlOptions htmlOptions = new HtmlOptions(); htmlOptions.setSlidesLayoutOptions(layoutOptions); presentation.save("presentation-with-notes.html", SaveFormat.Html, htmlOptions); } finally { presentation.dispose(); } ``` The exported HTML includes the notes area: ![HTML output with the slide and speaker notes](https://docs.aspose.com/slides/androidjava/convert-powerpoint-to-html/HTML_with_notes.png) To export comments, set `CommentsPosition`, for example to `CommentsPositions.Right` or `CommentsPositions.Bottom`. If you need only comments, omit `NotesPosition`. If you need both notes and comments, set both properties. ## **Control Image Quality and Cropped Areas** HTML export can compress slide images to reduce output size. Set `PicturesCompression` to a value from [PicturesCompression](https://reference.aspose.com/slides/androidjava/com.aspose.slides/picturescompression/) when you need higher image quality. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("presentation.pptx"); try { HtmlOptions htmlOptions = new HtmlOptions(); htmlOptions.setPicturesCompression(PicturesCompression.Dpi150); presentation.save("presentation-dpi-150.html", SaveFormat.Html, htmlOptions); } finally { presentation.dispose(); } ``` By default, cropped areas of images may be removed from the exported output. Keep cropped data only when users must be able to recover or inspect those hidden image parts. Keeping it can increase the HTML size. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("presentation.pptx"); try { HtmlOptions htmlOptions = new HtmlOptions(); htmlOptions.setDeletePicturesCroppedAreas(false); presentation.save("presentation-with-cropped-areas.html", SaveFormat.Html, htmlOptions); } finally { presentation.dispose(); } ``` ## **Add CSS** For simple styling, pass a CSS string to `HtmlFormatter.createDocumentFormatter`. This changes the surrounding HTML document while Aspose.Slides continues to render the slide content. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("presentation.pptx"); try { String cssRules = "body { margin: 0; background: #f7f7f7; } .slide { margin: 24px auto; }"; HtmlFormatter formatter = HtmlFormatter.createDocumentFormatter(cssRules, true); HtmlOptions htmlOptions = new HtmlOptions(); htmlOptions.setHtmlFormatter(formatter); presentation.save("presentation-styled.html", SaveFormat.Html, htmlOptions); } finally { presentation.dispose(); } ``` For a custom document header, a linked CSS file, or custom markup around slides and shapes, implement [IHtmlFormattingController](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ihtmlformattingcontroller/) and pass it to [HtmlFormatter](https://reference.aspose.com/slides/androidjava/com.aspose.slides/htmlformatter/) with `createCustomFormatter`. ## **Embed Fonts** If the target environment may not have the presentation fonts installed, embed fonts in the HTML with [EmbedAllFontsHtmlController](https://reference.aspose.com/slides/androidjava/com.aspose.slides/embedallfontshtmlcontroller/). Embedding improves visual fidelity but increases output size. ```java import com.aspose.slides.*; Presentation presentation = new Presentation("presentation.pptx"); try { String[] fontNamesToExclude = { "Arial", "Calibri" }; EmbedAllFontsHtmlController fontController = new EmbedAllFontsHtmlController(fontNamesToExclude); HtmlFormatter formatter = HtmlFormatter.createCustomFormatter(fontController); HtmlOptions htmlOptions = new HtmlOptions(); htmlOptions.setHtmlFormatter(formatter); presentation.save("presentation-embedded-fonts.html", SaveFormat.Html, htmlOptions); } finally { presentation.dispose(); } ``` Exclude fonts only when you are confident that the target browsers or systems already provide them. For brand fonts or less common fonts, embedding is usually safer. ## **Link Font Files Instead of Embedding Them** To reduce the HTML file size, you can write font data to separate WOFF files and add `@font-face` rules to the HTML. The helper below extends [EmbedAllFontsHtmlController](https://reference.aspose.com/slides/androidjava/com.aspose.slides/embedallfontshtmlcontroller/) and overrides `writeFont`. ```java import com.aspose.slides.*; import java.io.File; import java.io.FileOutputStream; class LinkedFontsHtmlController extends EmbedAllFontsHtmlController { private final String fontOutputDirectory; private final String fontUrlPrefix; LinkedFontsHtmlController( String fontOutputDirectory, String fontUrlPrefix) throws java.io.IOException { super(new String[0]); this.fontOutputDirectory = fontOutputDirectory; this.fontUrlPrefix = fontUrlPrefix.endsWith("/") ? fontUrlPrefix : fontUrlPrefix + "/"; File dirs = new File(fontOutputDirectory); dirs.mkdirs(); } @Override public void writeFont( IHtmlGenerator generator, IFontData originalFont, IFontData substitutedFont, String fontStyle, String fontWeight, byte[] fontData) { try { IFontData font = substitutedFont == null ? originalFont : substitutedFont; String safeFontName = makeSafeFileName(font.getFontName()); String safeFontStyle = fontStyle == null || fontStyle.trim().isEmpty() ? "normal" : fontStyle; String safeFontWeight = fontWeight == null || fontWeight.trim().isEmpty() ? "normal" : fontWeight; String fontFileName = safeFontName + "-" + safeFontStyle + "-" + safeFontWeight + ".woff"; String fontFilePath = fontOutputDirectory + "/" + fontFileName; FileOutputStream fos = new FileOutputStream(fontFilePath); fos.write(fontData); fos.close(); String encodedFontFileName = java.net.URLEncoder.encode(fontFileName, "UTF-8"); String fontUrl = fontUrlPrefix + encodedFontFileName.replace("+", "%20"); String escapedBackslashes = font.getFontName().replace("\\", "\\\\"); String fontFamily = escapedBackslashes.replace("'", "\\'"); generator.addHtml(""); } catch (java.io.IOException exception) { throw new RuntimeException("Unable to write an exported font.", exception); } } private String makeSafeFileName(String fileName) { String invalidCharacters = "\\/:*?\"<>|"; char[] safeCharacters = fileName.toCharArray(); for (int characterIndex = 0; characterIndex < safeCharacters.length; characterIndex++) { if (invalidCharacters.indexOf(safeCharacters[characterIndex]) >= 0) { safeCharacters[characterIndex] = '_'; } } return new String(safeCharacters); } } String outputDirectory = System.getProperty("user.dir") + "/html-output"; String fontsDirectory = outputDirectory + "/fonts"; Presentation presentation = new Presentation("presentation.pptx"); try { LinkedFontsHtmlController fontController = new LinkedFontsHtmlController(fontsDirectory, "fonts"); HtmlFormatter formatter = HtmlFormatter.createCustomFormatter(fontController); HtmlOptions htmlOptions = new HtmlOptions(); htmlOptions.setHtmlFormatter(formatter); String htmlFilePath = outputDirectory + "/presentation.html"; presentation.save(htmlFilePath, SaveFormat.Html, htmlOptions); } finally { presentation.dispose(); } ``` In this example, font files are saved to `html-output/fonts`, and the HTML references them with URLs such as `fonts/BrandFont-normal-400.woff`. If the HTML file and fonts are deployed to another location, choose `fontUrlPrefix` so that it matches the deployed URL path. ## **Save Resources Externally** Self-contained HTML is easy to move around, but embedded Base64 resources can make the file large. If your application needs external image files, implement [ILinkEmbedController](https://reference.aspose.com/slides/androidjava/com.aspose.slides/ilinkembedcontroller/) and pass it to the [HtmlOptions](https://reference.aspose.com/slides/androidjava/com.aspose.slides/htmloptions/) constructor. When you externalize resources, choose two paths deliberately: - The file system output path, where your application writes generated images, fonts, audio, or video. - The URL path, which is what the browser uses from the HTML document to load those files. ## **Export Media Files** [VideoPlayerHtmlController](https://reference.aspose.com/slides/androidjava/com.aspose.slides/videoplayerhtmlcontroller/) exports video and audio files and writes HTML that can play them in a browser. Its constructor takes: - `path`: the directory where generated media files will be written. - `fileName`: the HTML file name being generated. - `baseUri`: an absolute URI for the media directory. It must parse as a URI, so pass a `file:///` or `http(s)://` string, not a plain file system path. Exported media files are referenced in the generated HTML by file name only, relative to the HTML document. So `path` must be the directory that also holds the HTML file, otherwise the browser cannot resolve the links. For local preview, build the `file:///` URI with `Paths.get(mediaDirectory).toUri().toString()`. For a deployed application, use the absolute URL of the published media directory. ```java import com.aspose.slides.*; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; String outputDirectory = System.getProperty("user.dir") + "/html-output"; File outDir = new File(outputDirectory); outDir.mkdir(); String htmlFileName = "presentation.html"; // Media files are linked by name relative to the HTML document, so write them next to it. String mediaDirectory = outputDirectory; String mediaBaseUri = Paths.get(mediaDirectory).toUri().toString(); Presentation presentation = new Presentation(); try { byte[] videoData = Files.readAllBytes(Paths.get("intro.mp4")); IVideo video = presentation.getVideos().addVideo(videoData); ISlide slide = presentation.getSlides().get_Item(0); slide.getShapes().addVideoFrame(20, 20, 480, 270, video); String mediaDirectoryPath = mediaDirectory; VideoPlayerHtmlController controller = new VideoPlayerHtmlController(mediaDirectoryPath, htmlFileName, mediaBaseUri); HtmlFormatter formatter = HtmlFormatter.createCustomFormatter(controller); SVGOptions svgOptions = new SVGOptions(controller); SlideImageFormat slideImageFormat = SlideImageFormat.svg(svgOptions); HtmlOptions htmlOptions = new HtmlOptions(controller); htmlOptions.setHtmlFormatter(formatter); htmlOptions.setSlideImageFormat(slideImageFormat); String htmlFilePath = outputDirectory + "/" + htmlFileName; presentation.save(htmlFilePath, SaveFormat.Html, htmlOptions); } finally { presentation.dispose(); } ``` Use output directories that are unique per export job, especially in server applications. Shared output paths can cause files from different conversions to overwrite each other. ## **Performance and Resource Management** HTML conversion is a rendering operation, so processing time and memory use depend on slide count, image resolution, fonts, effects, charts, and embedded media. Higher `PicturesCompression` DPI values, embedded fonts, SVG output, and retained cropped image areas can improve fidelity but usually increase output size. For batch conversion: - Dispose every [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) instance promptly. - Use separate output directories for separate jobs. - Avoid embedding common fonts unless fidelity requires it. - Lower image DPI when the HTML is for preview or thumbnails. - Keep the source presentation, generated HTML, and external resources together until deployment paths are final. ## **FAQ** ### Are hyperlinks preserved in HTML output? Yes. Presentation hyperlinks are exported to HTML and remain clickable when the target URL is valid. ### Can I convert presentations to HTML in parallel? Yes, but do not share one [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) instance across threads. Process different files with separate presentation instances, separate streams, and separate output directories. See the [multithreading guidance](https://docs.aspose.com/slides/androidjava/multithreading/) for details. ### Is a Presentation object thread-safe? No. A single [Presentation](https://reference.aspose.com/slides/androidjava/com.aspose.slides/presentation/) instance should be loaded, modified, saved, and disposed on one thread. For parallel work, create an independent instance per thread or process. ### Why is the generated HTML file large? The default export can embed resources directly in the HTML. Embedded fonts, high-DPI images, media, SVG content, and retained cropped image areas also increase size. Use external resources, exclude common fonts from embedding, and lower `PicturesCompression` when smaller output is more important than maximum fidelity. ### Why does a PowerPoint font size such as 24 pt appear as 17.999819 pt in HTML? This can happen because PowerPoint and HTML use different DPI models. PowerPoint stores text sizes in typographic points based on 72 DPI, while HTML layout is based on CSS pixels in a 96 DPI model. When Aspose.Slides exports a presentation to HTML, the font size is translated between these systems, and the conversion may introduce small rounding differences. These values do not indicate a real visual font-size change. They are only a mathematical side effect of converting text metrics between PowerPoint and HTML. ### How should I choose baseUri for media export? Pass `baseUri` as an absolute URI. A plain file system path or a relative path raises a URI format error in the [VideoPlayerHtmlController](https://reference.aspose.com/slides/androidjava/com.aspose.slides/videoplayerhtmlcontroller/) constructor. For local preview, derive it from the output directory with `Paths.get(mediaDirectory).toUri().toString()`. For deployment, use the absolute URL of the published media directory. Note that the generated `