Slide
Inheritance: java.lang.Object, com.aspose.slides.BaseSlide
All Implemented Interfaces: com.aspose.slides.ISlide
public final class Slide extends BaseSlide implements ISlide
Represents a slide in a presentation.
Methods
| Method | Description |
|---|---|
| getHeaderFooterManager() | Returns HeaderFooter manager of the slide. |
| getThemeManager() | Returns the overriding theme manager. |
| getSlideNumber() | Returns a number of slide. |
| setSlideNumber(int value) | Returns a number of slide. |
| getHidden() | Determines whether the specified slide is hidden during a slide show. |
| setHidden(boolean value) | Determines whether the specified slide is hidden during a slide show. |
| getShowMasterShapes() | Specifies if shapes on the master slide should be shown on slides or not. |
| setShowMasterShapes(boolean value) | Specifies if shapes on the master slide should be shown on slides or not. |
| getImage(float scaleX, float scaleY) | Returns a Thumbnail Image object with custom scaling. |
| getImage() | Returns a Thumbnail Image object (20% of real size). |
| getImage(Dimension imageSize) | Returns a Thumbnail Image object with specified size. |
| getImage(ITiffOptions options) | Returns a Thumbnail tiff image object with specified parameters. |
| getImage(IRenderingOptions options) | Returns a Thumbnail Image object. |
| getImage(IRenderingOptions options, float scaleX, float scaleY) | Returns a Thumbnail Image object with custom scaling. |
| getImage(IRenderingOptions options, Dimension imageSize) | Returns a Thumbnail Image object with specified size. |
| writeAsSvg(OutputStream stream) | Saves the slide content as an SVG file. |
| writeAsSvg(OutputStream stream, ISVGOptions svgOptions) | Saves the slide content as an SVG file. |
| writeAsEmf(OutputStream stream) | Saves the slide content as an EMF file. |
| remove() | Removes slide from presentation. |
| getLayoutSlide() | Returns or sets the layout slide for the current slide. |
| setLayoutSlide(ILayoutSlide value) | Returns or sets the layout slide for the current slide. |
| reset() | Resets position, size and formatting of every shape that has a prototype on LayoutSlide. |
| getNotesSlideManager() | Allow to access notes slide, add and remove it. |
| getSlideComments(ICommentAuthor author) | Returns all slide comments added by specific author. |
| joinPortionsWithSameFormatting() | Joins runs with same formatting in all paragraphs in all acceptable shapes. |
getHeaderFooterManager()
public final ISlideHeaderFooterManager getHeaderFooterManager()
Returns HeaderFooter manager of the slide. Read-only ISlideHeaderFooterManager.
Returns: ISlideHeaderFooterManager
getThemeManager()
public final IOverrideThemeManager getThemeManager()
Returns the overriding theme manager. Read-only IOverrideThemeManager.
Returns: IOverrideThemeManager
getSlideNumber()
public final int getSlideNumber()
Returns a number of slide. Index of slide in Presentation.getSlides collection is always equal to SlideNumber - Presentation.FirstSlideNumber. Read/write int.
Returns: int
setSlideNumber(int value)
public final void setSlideNumber(int value)
Returns a number of slide. Index of slide in Presentation.getSlides collection is always equal to SlideNumber - Presentation.FirstSlideNumber. Read/write int.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | int |
getHidden()
public final boolean getHidden()
Determines whether the specified slide is hidden during a slide show. Read/write boolean.
Returns: boolean
setHidden(boolean value)
public final void setHidden(boolean value)
Determines whether the specified slide is hidden during a slide show. Read/write boolean.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean |
getShowMasterShapes()
public boolean getShowMasterShapes()
Specifies if shapes on the master slide should be shown on slides or not. Read/write boolean.
Returns: boolean
setShowMasterShapes(boolean value)
public void setShowMasterShapes(boolean value)
Specifies if shapes on the master slide should be shown on slides or not. Read/write boolean.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean |
getImage(float scaleX, float scaleY)
public final IImage getImage(float scaleX, float scaleY)
Returns a Thumbnail Image object with custom scaling.
The following example shows how to generate thumbnails from PowerPoint Presentation. Presentation pres = new Presentation("ThumbnailFromSlide.pptx"); try { // Access the first slide ISlide sld = pres.getSlides().get_Item(0); // Create a full scale image IImage bmp = sld.getImage(1f, 1f); // Save the image to disk in JPEG format bmp.save("Thumbnail_out.jpg", ImageFormat.Jpeg); } finally { pres.dispose(); } The following example shows how to converting slides to bitmap and saving the images in PNG. Presentation pres = new Presentation("Presentation.pptx"); try { // Converts the first slide in the presentation to a Bitmap object IImage bmp = pres.getSlides().get_Item(0).getImage(); // Saves the image in the PNG format bmp.save("Slide_0.png", ImageFormat.Png); } finally { pres.dispose(); } The following example shows how to convert PowerPoint PPT/PPTX to JPG. Presentation pres = new Presentation("PowerPoint-Presentation.ppt"); try { for (ISlide sld : pres.getSlides()) { // Create a full scale image IImage bmp = sld.getImage(1f, 1f); // Save the image to disk in JPEG format bmp.save("Slide_"+sld.getSlideNumber()+"0.jpg", ImageFormat.Jpeg); } } finally { pres.dispose(); } The following example shows how to convert PowerPoint PPT/PPTX to JPG with customized dimensions. Presentation pres = new Presentation("PowerPoint-Presentation.pptx"); try { // Define dimensions int desiredX = 1200; int desiredY = 800; // Get scaled values of X and Y float ScaleX = (float)(1.0 / pres.getSlideSize().getSize().getWidth()) * desiredX; float ScaleY = (float)(1.0 / pres.getSlideSize().getSize().getHeight()) * desiredY; for (ISlide sld : pres.getSlides()) { // Create a full scale image IImage bmp = sld.getImage(ScaleX, ScaleY); // Save the image to disk in JPEG format bmp.save("Slide.jpg", ImageFormat.Jpeg); } } finally { pres.dispose(); }
Parameters:
| Parameter | Type | Description |
|---|---|---|
| scaleX | float | The value by which to scale this Thumbnail in the x-axis direction. |
| scaleY | float | The value by which to scale this Thumbnail in the y-axis direction. |
Returns: IImage - IImage object.
getImage()
public final IImage getImage()
Returns a Thumbnail Image object (20% of real size).
Returns: IImage
getImage(Dimension imageSize)
public final IImage getImage(Dimension imageSize)
Returns a Thumbnail Image object with specified size.
The following example shows how to converting slides to images with custom sizes using C#. Presentation pres = new Presentation("Presentation.pptx"); try { // Converts the first slide in the presentation to a Bitmap with the specified size IImage bmp = pres.getSlides().get_Item(0).getImage(new Dimension(1820, 1040)); // Saves the image in the JPEG format bmp.save("Slide_0.jpg", ImageFormat.Jpeg); } finally { pres.dispose(); }
Parameters:
| Parameter | Type | Description |
|---|---|---|
| imageSize | java.awt.Dimension | Size of the image to create. |
Returns: IImage - Image object.
getImage(ITiffOptions options)
public final IImage getImage(ITiffOptions options)
Returns a Thumbnail tiff image object with specified parameters.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| options | ITiffOptions | Tiff options. |
Returns: IImage - Image object.
getImage(IRenderingOptions options)
public final IImage getImage(IRenderingOptions options)
Returns a Thumbnail Image object.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| options | IRenderingOptions | Rendering options. |
Returns: IImage - Image object.
getImage(IRenderingOptions options, float scaleX, float scaleY)
public final IImage getImage(IRenderingOptions options, float scaleX, float scaleY)
Returns a Thumbnail Image object with custom scaling.
The following example shows how to converting slides With notes and comments to Images. Presentation pres = new Presentation("PresentationNotesComments.pptx"); try { // Create the rendering options IRenderingOptions options = new RenderingOptions(); // Create notes and comments layouting options NotesCommentsLayoutingOptions notesCommentsLayouting = new NotesCommentsLayoutingOptions(); // Sets the position of the notes on the page notesCommentsLayouting.setNotesPosition(NotesPositions.BottomTruncated); // Sets the position of the comments on the page notesCommentsLayouting.setCommentsPosition(CommentsPositions.Right); // Sets the width of the comment output area notesCommentsLayouting.setCommentsAreaWidth(500); // Sets the color for the comments area notesCommentsLayouting.setCommentsAreaColor(Color.WHITE); // Set layout options for rendering options.setSlidesLayoutOptions(notesCommentsLayouting); // Converts the first slide of the presentation to a BufferedImage object IImage image = pres.getSlides().get_Item(0).getImage(options, 2f, 2f); // Saves the image in the GIF format image.save("Slide_Notes_Comments_0.gif", ImageFormat.Gif); } finally { if (pres != null) pres.dispose(); }
Parameters:
| Parameter | Type | Description |
|---|---|---|
| options | IRenderingOptions | Rendering options. |
| scaleX | float | The value by which to scale this Thumbnail in the x-axis direction. |
| scaleY | float | The value by which to scale this Thumbnail in the y-axis direction. |
Returns: IImage - Bitmap objects.
getImage(IRenderingOptions options, Dimension imageSize)
public final IImage getImage(IRenderingOptions options, Dimension imageSize)
Returns a Thumbnail Image object with specified size.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| options | IRenderingOptions | Rendering options. |
| imageSize | java.awt.Dimension | Size of the image to create. |
Returns: IImage - Image object.
writeAsSvg(OutputStream stream)
public final void writeAsSvg(OutputStream stream)
Saves the slide content as an SVG file.
The following code example demonstrates how to convert the first slide from a PowerPoint presentation into an SVG file. Presentation pres = new Presentation("pres.pptx"); try { FileOutputStream fileStream = new FileOutputStream("slide_1.svg"); { // Saves the first slide as an SVG file pres.getSlides().get_Item(0).writeAsSvg(fileStream); } } finally { if (pres != null) pres.dispose(); }
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.OutputStream | Target stream |
writeAsSvg(OutputStream stream, ISVGOptions svgOptions)
public final void writeAsSvg(OutputStream stream, ISVGOptions svgOptions)
Saves the slide content as an SVG file.
The following code example demonstrates how to convert the first slide from a PowerPoint presentation into an SVG file with options. Presentation pres = new Presentation("pres.pptx"); try { FileOutputStream fileStream = new FileOutputStream("slide1.svg"); SVGOptions options = new SVGOptions(); options.setVectorizeText(true); // Saves the first slide as an SVG file pres.getSlides().get_Item(0).writeAsSvg(fileStream, options); } finally { if (pres != null) pres.dispose(); }
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.OutputStream | Target stream |
| svgOptions | ISVGOptions | SVG generation options |
writeAsEmf(OutputStream stream)
public final void writeAsEmf(OutputStream stream)
Saves the slide content as an EMF file.
The following code example demonstrates how to convert the first slide from a PowerPoint presentation into a metafile. Presentation pres = new Presentation("pres.pptx"); try { FileOutputStream fileStream = new FileOutputStream("slide_1.emf"); { // Saves the first slide as a metafille pres.getSlides().get_Item(0).writeAsEmf(fileStream); } } finally { if (pres != null) pres.dispose(); }
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.OutputStream | Target stream |
remove()
public final void remove()
Removes slide from presentation.
getLayoutSlide()
public final ILayoutSlide getLayoutSlide()
Returns or sets the layout slide for the current slide. Read/write ILayoutSlide.
Returns: ILayoutSlide
setLayoutSlide(ILayoutSlide value)
public final void setLayoutSlide(ILayoutSlide value)
Returns or sets the layout slide for the current slide. Read/write ILayoutSlide.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | ILayoutSlide |
reset()
public final void reset()
Resets position, size and formatting of every shape that has a prototype on LayoutSlide.
getNotesSlideManager()
public final INotesSlideManager getNotesSlideManager()
Allow to access notes slide, add and remove it. Read-only INotesSlideManager.
Returns: INotesSlideManager
getSlideComments(ICommentAuthor author)
public final IComment[] getSlideComments(ICommentAuthor author)
Returns all slide comments added by specific author.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| author | ICommentAuthor | Author of comments to find or null to return all comments. |
Returns: com.aspose.slides.IComment[] - Array of Comment.
joinPortionsWithSameFormatting()
public void joinPortionsWithSameFormatting()
Joins runs with same formatting in all paragraphs in all acceptable shapes.