Features and Capabilities
Features and Capabilities
Aspose.Slides FOSS for Java provides a broad set of capabilities for working with PowerPoint .pptx files programmatically. This page lists all supported feature areas with representative code examples.
Presentation I/O
Open an existing .pptx file or create a new one, then save back to PPTX format.
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.export.SaveFormat;
// Open an existing presentation
try (Presentation prs = new Presentation("input.pptx")) {
System.out.println("Slide count: " + prs.getSlides().size());
prs.save("output.pptx", SaveFormat.PPTX);
}
// Create a new presentation (starts with one blank slide)
try (Presentation prs = new Presentation()) {
prs.save("new.pptx", SaveFormat.PPTX);
}Note: PPTX is the only supported save format in this FOSS edition. The save call serializes the full presentation object graph to the OOXML container.
Unknown XML parts in the source file are preserved verbatim on save, so opening and re-saving a .pptx will never strip content the library does not yet understand.
Slides Management
Use prs.getSlides() to add empty slides with addEmptySlide(), remove existing ones, or check the total slide count:
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.export.SaveFormat;
try (Presentation prs = new Presentation()) {
// Access the first slide
var slide = prs.getSlides().get(0);
// Add an additional blank slide at the end
prs.getSlides().addEmptySlide(prs.getLayoutSlides().get(0));
System.out.println("Total slides: " + prs.getSlides().size());
prs.save("multi-slide.pptx", SaveFormat.PPTX);
}Shapes
Add AutoShapes, PictureFrames, Tables, and Connectors to a slide.
AutoShapes
Call slide.getShapes().addAutoShape() with a ShapeType, position, and size, then call addTextFrame() to set the text content:
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.ShapeType;
import org.aspose.slides.foss.export.SaveFormat;
try (Presentation prs = new Presentation()) {
var slide = prs.getSlides().get(0);
// Add a rectangle at (x=50, y=50) with width=300, height=100
var shape = slide.getShapes().addAutoShape(ShapeType.RECTANGLE, 50, 50, 300, 100);
shape.addTextFrame("Aspose.Slides FOSS");
prs.save("shapes.pptx", SaveFormat.PPTX);
}Tables
Use slide.getShapes().addTable() with column widths and row heights, then access cells via table.getRows().get(row).get(col):
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.export.SaveFormat;
try (Presentation prs = new Presentation()) {
var slide = prs.getSlides().get(0);
// Column widths and row heights in points
double[] colWidths = {120.0, 120.0, 120.0};
double[] rowHeights = {40.0, 40.0, 40.0};
var table = slide.getShapes().addTable(50, 50, colWidths, rowHeights);
table.getRows().get(0).get(0).getTextFrame().setText("Product");
table.getRows().get(0).get(1).getTextFrame().setText("Quantity");
table.getRows().get(0).get(2).getTextFrame().setText("Price");
prs.save("table.pptx", SaveFormat.PPTX);
}Connectors
Call slide.getShapes().addConnector() and set setStartShapeConnectedTo() and setEndShapeConnectedTo() to link two shapes with a connector line:
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.ShapeType;
import org.aspose.slides.foss.export.SaveFormat;
try (Presentation prs = new Presentation()) {
var slide = prs.getSlides().get(0);
var box1 = slide.getShapes().addAutoShape(ShapeType.RECTANGLE, 50, 100, 150, 60);
var box2 = slide.getShapes().addAutoShape(ShapeType.RECTANGLE, 350, 100, 150, 60);
var conn = slide.getShapes().addConnector(ShapeType.BENT_CONNECTOR3, 0, 0, 10, 10);
conn.setStartShapeConnectedTo(box1);
conn.setStartShapeConnectionSiteIndex(3); // right side
conn.setEndShapeConnectedTo(box2);
conn.setEndShapeConnectionSiteIndex(1); // left side
prs.save("connector.pptx", SaveFormat.PPTX);
}Text Formatting
Access getPortionFormat() on each Portion to set font height, bold, italic, and fill color at the character level:
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.ShapeType;
import org.aspose.slides.foss.NullableBool;
import org.aspose.slides.foss.FillType;
import org.aspose.slides.foss.drawing.Color;
import org.aspose.slides.foss.export.SaveFormat;
try (Presentation prs = new Presentation()) {
var slide = prs.getSlides().get(0);
var shape = slide.getShapes().addAutoShape(ShapeType.RECTANGLE, 50, 50, 500, 150);
var tf = shape.addTextFrame("Bold blue heading");
var fmt = tf.getParagraphs().get(0).getPortions().get(0).getPortionFormat();
fmt.setFontHeight(28);
fmt.setFontBold(NullableBool.TRUE);
fmt.getFillFormat().setFillType(FillType.SOLID);
fmt.getFillFormat().getSolidFillColor().setColor(Color.fromArgb(255, 0, 70, 127));
prs.save("text.pptx", SaveFormat.PPTX);
}NullableBool.TRUE sets the property explicitly; NullableBool.NOT_DEFINED inherits from the slide master.
Fill Types
Set shape.getFillFormat().setFillType() to FillType.SOLID and configure the fill color via getSolidFillColor().setColor() using ARGB values:
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.ShapeType;
import org.aspose.slides.foss.FillType;
import org.aspose.slides.foss.drawing.Color;
import org.aspose.slides.foss.export.SaveFormat;
try (Presentation prs = new Presentation()) {
var slide = prs.getSlides().get(0);
var shape = slide.getShapes().addAutoShape(ShapeType.RECTANGLE, 50, 50, 300, 150);
// Solid fill
shape.getFillFormat().setFillType(FillType.SOLID);
shape.getFillFormat().getSolidFillColor().setColor(Color.fromArgb(255, 30, 120, 200));
prs.save("fill.pptx", SaveFormat.PPTX);
}Visual Effects
Apply outer shadow, glow, soft edge, blur, reflection, and inner shadow to shapes.
The effect properties are accessible through shape.getEffectFormat(). Call enableOuterShadowEffect(), enableGlowEffect(), enableSoftEdgeEffect(), setBlurEffect(radius, grow), enableReflectionEffect(), or enableInnerShadowEffect() to configure each independently.
3D Formatting
Apply 3D bevel, camera, light rig, material, and extrusion depth via shape.getThreeDFormat(). This controls the visual depth and lighting model for shape rendering in PPTX viewers that support 3D effects.
Speaker Notes
Access getNotesSlideManager() on any slide and call addNotesSlide() to create a notes page, then set the notes text directly:
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.export.SaveFormat;
try (Presentation prs = new Presentation()) {
var notes = prs.getSlides().get(0).getNotesSlideManager().addNotesSlide();
notes.getNotesTextFrame().setText("Key talking point: emphasize the ROI benefit.");
prs.save("notes.pptx", SaveFormat.PPTX);
}Comments
Create a comment author with prs.getCommentAuthors().addAuthor(), then call author.getComments().addComment() with the slide and position coordinates:
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.drawing.PointF;
import org.aspose.slides.foss.export.SaveFormat;
import java.time.LocalDateTime;
try (Presentation prs = new Presentation()) {
var author = prs.getCommentAuthors().addAuthor("Jane Smith", "JS");
var slide = prs.getSlides().get(0);
author.getComments().addComment(
"Please verify this data before the presentation.",
slide,
new PointF(2.0f, 2.0f),
LocalDateTime.now()
);
prs.save("comments.pptx", SaveFormat.PPTX);
}Embedded Images
Embed an image from a file into the presentation and add it to a slide as a PictureFrame.
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.ShapeType;
import org.aspose.slides.foss.export.SaveFormat;
import java.nio.file.Files;
import java.nio.file.Path;
try (Presentation prs = new Presentation()) {
byte[] imageData = Files.readAllBytes(Path.of("logo.png"));
var image = prs.getImages().addImage(imageData);
var slide = prs.getSlides().get(0);
slide.getShapes().addPictureFrame(ShapeType.RECTANGLE, 50, 50, 200, 150, image);
prs.save("with-image.pptx", SaveFormat.PPTX);
}Document Properties
Access prs.getDocumentProperties() to read or write standard properties such as title, author, and subject, plus custom key-value pairs:
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.export.SaveFormat;
try (Presentation prs = new Presentation()) {
var props = prs.getDocumentProperties();
// Core properties
props.setTitle("Q1 Results");
props.setAuthor("Finance Team");
props.setSubject("Quarterly Review");
props.setKeywords("Q1, finance, results");
// Custom property
props.setCustomPropertyValue("ReviewedBy", "Legal Team");
prs.save("deck.pptx", SaveFormat.PPTX);
}Known Limitations
The following areas raise UnsupportedOperationException and are not available in this edition:
| Area | Status |
|---|---|
| Charts | Not implemented |
| SmartArt | Not implemented |
| Animations and transitions | Not implemented |
| PDF / HTML / SVG / image export | Not implemented (PPTX only) |
| VBA macros | Not implemented |
| Digital signatures | Not implemented |
| Hyperlinks and action settings | Not implemented |
| OLE objects | Not implemented |
| Mathematical text | Not implemented |
See Also
- Getting Started: Installation and first program
- API Reference: Class and method reference
- How-To Guides: Task-oriented articles
- Aspose.Slides for Java — Enterprise Documentation