public final class Slide extends BaseSlide implements ISlide
Represents a slide in a presentation.
| Modifier and Type | Method and Description |
|---|---|
ISlideHeaderFooterManager |
getHeaderFooterManager()
Returns HeaderFooter manager of the slide.
|
boolean |
getHidden()
Determines whether the specified slide is hidden during a slide show.
|
IImage |
getImage()
Returns a Thumbnail Image object (20% of real size).
|
IImage |
getImage(java.awt.Dimension imageSize)
Returns a Thumbnail Image object with specified size.
|
IImage |
getImage(float scaleX,
float scaleY)
Returns a Thumbnail Image object with custom scaling.
|
IImage |
getImage(IRenderingOptions options)
Returns a Thumbnail Image object.
|
IImage |
getImage(IRenderingOptions options,
java.awt.Dimension imageSize)
Returns a Thumbnail Image object with specified size.
|
IImage |
getImage(IRenderingOptions options,
float scaleX,
float scaleY)
Returns a Thumbnail Image object with custom scaling.
|
IImage |
getImage(ITiffOptions options)
Returns a Thumbnail tiff image object with specified parameters.
|
ILayoutSlide |
getLayoutSlide()
Returns or sets the layout slide for the current slide.
|
INotesSlideManager |
getNotesSlideManager()
Allow to access notes slide, add and remove it.
|
boolean |
getShowMasterShapes()
Specifies if shapes on the master slide should be shown on slides or not.
|
IComment[] |
getSlideComments(ICommentAuthor author)
Returns all slide comments added by specific author.
|
int |
getSlideNumber()
Returns a number of slide.
|
IOverrideThemeManager |
getThemeManager()
Returns the overriding theme manager.
|
java.awt.image.BufferedImage |
getThumbnail()
Deprecated.
Use GetImage method instead. The method will be removed after release of version 24.7.
|
java.awt.image.BufferedImage |
getThumbnail(java.awt.Dimension imageSize)
Deprecated.
Use GetImage(Size imageSize) method instead. The method will be removed after release of version 24.7.
|
java.awt.image.BufferedImage |
getThumbnail(float scaleX,
float scaleY)
Deprecated.
Use getImage(float scaleX, float scaleY) method instead. The method will be removed after release of version 24.7.
|
java.awt.image.BufferedImage |
getThumbnail(IRenderingOptions options)
Deprecated.
Use GetImage(IRenderingOptions options) method instead. The method will be removed after release of version 24.7.
|
java.awt.image.BufferedImage |
getThumbnail(IRenderingOptions options,
java.awt.Dimension imageSize)
Deprecated.
Use GetImage(IRenderingOptions options, Size imageSize) method instead. The method will be removed after release of version 24.7.
|
java.awt.image.BufferedImage |
getThumbnail(IRenderingOptions options,
float scaleX,
float scaleY)
Deprecated.
Use GetImage(IRenderingOptions options, float scaleX, float scaleY) method instead. The method will be removed after release of version 24.7.
|
java.awt.image.BufferedImage |
getThumbnail(ITiffOptions options)
Deprecated.
Use GetImage(ITiffOptions options) method instead. The method will be removed after release of version 24.7.
|
void |
joinPortionsWithSameFormatting()
Joins runs with same formatting in all paragraphs in all acceptable shapes.
|
void |
remove()
Removes slide from presentation.
|
void |
renderToGraphics(IRenderingOptions options,
java.awt.Graphics2D graphics)
Deprecated.
The method will be removed after release of version 24.7.
|
void |
renderToGraphics(IRenderingOptions options,
java.awt.Graphics2D graphics,
java.awt.Dimension renderingSize)
Deprecated.
The method will be removed after release of version 24.7.
|
void |
renderToGraphics(IRenderingOptions options,
java.awt.Graphics2D graphics,
float scaleX,
float scaleY)
Deprecated.
The method will be removed after release of version 24.7.
|
void |
reset()
Resets position, size and formatting of every shape that has a prototype on LayoutSlide.
|
void |
setHidden(boolean value)
Determines whether the specified slide is hidden during a slide show.
|
void |
setLayoutSlide(ILayoutSlide value)
Returns or sets the layout slide for the current slide.
|
void |
setShowMasterShapes(boolean value)
Specifies if shapes on the master slide should be shown on slides or not.
|
void |
setSlideNumber(int value)
Returns a number of slide.
|
void |
writeAsEmf(java.io.OutputStream stream)
Saves the slide content as an EMF file.
|
void |
writeAsSvg(java.io.OutputStream stream)
Saves the slide content as an SVG file.
|
void |
writeAsSvg(java.io.OutputStream stream,
ISVGOptions svgOptions)
Saves the slide content as an SVG file.
|
createThemeEffective, equals, findShapeByAltText, getBackground, getControls, getCustomData, getHyperlinkQueries, getName, getParent_Immediate, getPresentation, getShapes, getSlide, getSlideId, getSlideShowTransition, getTimeline, joinPortionsWithSameFormatting, setNameequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals, findShapeByAltText, getBackground, getControls, getCustomData, getHyperlinkQueries, getName, getShapes, getSlideId, getSlideShowTransition, getTimeline, setNamecreateThemeEffectivegetSlidegetPresentationpublic final ISlideHeaderFooterManager getHeaderFooterManager()
Returns HeaderFooter manager of the slide.
Read-only ISlideHeaderFooterManager.
getHeaderFooterManager in interface ISlidepublic final IOverrideThemeManager getThemeManager()
Returns the overriding theme manager.
Read-only IOverrideThemeManager.
getThemeManager in interface IOverrideThemeablepublic 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.
getSlideNumber in interface ISlidepublic 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.
setSlideNumber in interface ISlidepublic final boolean getHidden()
Determines whether the specified slide is hidden during a slide show. Read/write boolean.
public final void setHidden(boolean value)
Determines whether the specified slide is hidden during a slide show. Read/write boolean.
public boolean getShowMasterShapes()
Specifies if shapes on the master slide should be shown on slides or not. Read/write boolean.
getShowMasterShapes in interface IBaseSlidegetShowMasterShapes in class BaseSlidepublic void setShowMasterShapes(boolean value)
Specifies if shapes on the master slide should be shown on slides or not. Read/write boolean.
setShowMasterShapes in interface IBaseSlidesetShowMasterShapes in class BaseSlide@Deprecated
public final java.awt.image.BufferedImage getThumbnail(float scaleX,
float scaleY)
Returns a Thumbnail Bitmap object with custom scaling.
The following example shows how to generate thumbnails from PowerPoint Presentation.// Instantiate a Presentation class that represents the presentation file Presentation pres = new Presentation("ThumbnailFromSlide.pptx"); try { // Access the first slide ISlide sld = pres.getSlides().get_Item(0); // Create a full scale image BufferedImage bmp = sld.getThumbnail(1f, 1f); // Save the image to disk in PNG format ImageIO.write(bmp, "PNG", new File("Thumbnail_out.png")); } catch(IOException e) { } finally { if (pres != null) 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 { for (ISlide slide : pres.getSlides()) { // Converts the slide in the presentation to a Bitmap object BufferedImage bmp = slide.getThumbnail(); // Saves the image in the PNG format ImageIO.write(bmp, "PNG", new File("Thumbnail_out_" + slide.getSlideNumber() + ".png")); } } catch(IOException e) { } finally { if (pres != null) pres.dispose(); }The following example shows how to convert PowerPoint PPT/PPTX to JPG.Presentation pres = new Presentation("Presentation.pptx"); try { for (ISlide slide : pres.getSlides()) { // Converts the slide in the presentation to a Bitmap object BufferedImage bmp = slide.getThumbnail(); // Saves the image in the JPG format ImageIO.write(bmp, "JPG", new File("Thumbnail_out" + slide.getSlideNumber() + ".jpg")); } } catch(IOException e) { } finally { if (pres != null) pres.dispose(); }The following example shows how to convert PowerPoint PPT/PPTX to JPG with customized dimensions.Presentation pres = new Presentation("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 slide : pres.getSlides()) { // Converts the first slide in the presentation to a Bitmap object BufferedImage bmp = slide.getThumbnail(ScaleX, ScaleY); // Saves the image in the JPG format ImageIO.write(bmp, "JPG", new File("Slide_" + slide.getSlideNumber() + ".jpg")); } } catch(IOException e) { } finally { if (pres != null) pres.dispose(); }
getThumbnail in interface ISlidescaleX - The value by which to scale this Thumbnail in the x-axis direction.scaleY - The value by which to scale this Thumbnail in the y-axis direction.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(); }
@Deprecated public final java.awt.image.BufferedImage getThumbnail()
Returns a Thumbnail Image object (20% of real size).
getThumbnail in interface ISlideBufferedImagepublic final IImage getImage()
Returns a Thumbnail Image object (20% of real size).
@Deprecated public final java.awt.image.BufferedImage getThumbnail(IRenderingOptions options)
Returns a Thumbnail Bitmap object.
getThumbnail in interface ISlideoptions - Rendering options.com.aspose.ms.System.InvalidOperationException - Thrown when notesCommentsLayouting.NotesPosition takes the value NotesPositions.BottomFull@Deprecated public final java.awt.image.BufferedImage getThumbnail(java.awt.Dimension imageSize)
Returns a Thumbnail Image object with specified size.
The following example shows how to converting slides to images with custom sizes using Java.Presentation pres = new Presentation("Presentation.pptx"); try { // Converts the first slide in the presentation to a Bitmap with the specified size IImage image = pres.getSlides().get_Item(0).getImage(new Dimension(1820, 1040)); // Saves the image in the JPEG format image.save("Slide_0.jpg", ImageFormat.Jpeg); } finally { if (pres != null) pres.dispose(); }
getThumbnail in interface ISlideimageSize - Size of the image to create.public final IImage getImage(java.awt.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(); }
@Deprecated public final java.awt.image.BufferedImage getThumbnail(ITiffOptions options)
Returns a Thumbnail tiff image object with specified parameters.
getThumbnail in interface ISlideoptions - Tiff options.com.aspose.ms.System.InvalidOperationException - Thrown when options.SlideLayoutOption is NotesCommentsLayoutingOptions and its property NotesPosition takes the value NotesPositions.BottomFull.public final IImage getImage(ITiffOptions options)
Returns a Thumbnail tiff image object with specified parameters.
getImage in interface ISlideoptions - Tiff options.com.aspose.ms.System.InvalidOperationException - Thrown when options.SlideLayoutOption is NotesCommentsLayoutingOptions and its property NotesPosition takes the value NotesPositions.BottomFull.public final IImage getImage(IRenderingOptions options)
Returns a Thumbnail Image object.
@Deprecated public final java.awt.image.BufferedImage getThumbnail(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 using Java.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(); }
getThumbnail in interface ISlideoptions - Rendering options.scaleX - The value by which to scale this Thumbnail in the x-axis direction.scaleY - The value by which to scale this Thumbnail in the y-axis direction.com.aspose.ms.System.InvalidOperationException - Thrown when notesCommentsLayouting.NotesPosition takes the value NotesPositions.BottomFullpublic 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 using C#.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 IImage 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(); }
getImage in interface ISlideoptions - Rendering options.scaleX - The value by which to scale this Thumbnail in the x-axis direction.scaleY - The value by which to scale this Thumbnail in the y-axis direction.com.aspose.ms.System.InvalidOperationException - Thrown when notesCommentsLayouting.NotesPosition takes the value NotesPositions.BottomFull@Deprecated public final java.awt.image.BufferedImage getThumbnail(IRenderingOptions options, java.awt.Dimension imageSize)
Returns a Thumbnail BufferedImage object with specified size.
getThumbnail in interface ISlideoptions - Rendering options.imageSize - Size of the image to create.com.aspose.ms.System.InvalidOperationException - Thrown when options.SlideLayoutOption is NotesCommentsLayoutingOptions and its property NotesPosition takes the value NotesPositions.BottomFull.public final IImage getImage(IRenderingOptions options, java.awt.Dimension imageSize)
Returns a Thumbnail Image object with specified size.
getImage in interface ISlideoptions - Rendering options.imageSize - Size of the image to create.com.aspose.ms.System.InvalidOperationException - Thrown when options.SlideLayoutOption is NotesCommentsLayoutingOptions and its property NotesPosition takes the value NotesPositions.BottomFull.@Deprecated public final void renderToGraphics(IRenderingOptions options, java.awt.Graphics2D graphics)
Renders certain slide to a Graphics object.
renderToGraphics in interface ISlideoptions - Rendering options.graphics - The object where to render to.com.aspose.ms.System.InvalidOperationException - Thrown when notesCommentsLayouting.NotesPosition takes the value NotesPositions.BottomFull@Deprecated public final void renderToGraphics(IRenderingOptions options, java.awt.Graphics2D graphics, float scaleX, float scaleY)
Renders certain slide to a Graphics object with custom scaling.
renderToGraphics in interface ISlideoptions - Rendering options.graphics - The object where to render to.scaleX - The scale for rendering the slide (1.0 is 100%) in the x-axis direction.scaleY - The scale for rendering the slide (1.0 is 100%) in the y-axis direction.com.aspose.ms.System.InvalidOperationException - Thrown when notesCommentsLayouting.NotesPosition takes the value NotesPositions.BottomFull@Deprecated public final void renderToGraphics(IRenderingOptions options, java.awt.Graphics2D graphics, java.awt.Dimension renderingSize)
Renders certain slide to a Graphics object using specified size.
The following example shows how to convert the first slide to the framed image with the RenderToGraphics method.Presentation pres = new Presentation("Presentation.pptx"); try { // Gets the presentation slide size Dimension slideSize = new Dimension(1820, 1040); // Creates a Bitmap with the slide size BufferedImage image = new BufferedImage((int)slideSize.getWidth() + 50, (int)slideSize.getHeight() + 50, BufferedImage.TYPE_INT_ARGB); java.awt.Graphics graphics = image.createGraphics(); try { graphics.setColor(Color.RED); graphics.fillRect(0, 0, (int)pres.getSlideSize().getSize().getWidth(), (int)pres.getSlideSize().getSize().getHeight()); graphics.translate(25, 25); pres.getSlides().get_Item(0).renderToGraphics(new RenderingOptions(), (Graphics2D) graphics); } finally { if (graphics != null) graphics.dispose(); } ImageIO.write(image, "PNG", new File("Slide_0.png")); } catch(IOException e) { } finally { if (pres != null) pres.dispose(); }The following example shows how to conversion process for a slide with notes using the RenderToGraphics.Presentation pres = new Presentation("Presentation.pptx"); try { // Gets the presentation slide size Dimension notesSize = new Dimension((int)pres.getNotesSize().getSize().getWidth(), (int)pres.getNotesSize().getSize().getHeight()); IRenderingOptions options = new RenderingOptions(); // Sets the position of the notes options.getNotesCommentsLayouting().setNotesPosition(NotesPositions.BottomTruncated); // Creates a Bitmap with the slide size BufferedImage image = new BufferedImage((int)notesSize.getWidth(), (int)notesSize.getHeight(), BufferedImage.TYPE_INT_ARGB); java.awt.Graphics graphics = image.createGraphics(); try { graphics.setColor(Color.RED); graphics.fillRect(0, 0, (int)pres.getSlideSize().getSize().getWidth(), (int)pres.getSlideSize().getSize().getHeight()); graphics.translate(25, 25); pres.getSlides().get_Item(0).renderToGraphics(options, (Graphics2D) graphics, notesSize); } finally { if (graphics != null) graphics.dispose(); } ImageIO.write(image, "PNG", new File("Slide_0.png")); } catch(IOException e) { } finally { if (pres != null) pres.dispose(); }
renderToGraphics in interface ISlideoptions - Rendering options.graphics - The object where to render to.renderingSize - The maximum dimensions (in pixels) that can be occupied by the rendered slide.com.aspose.ms.System.InvalidOperationException - Thrown when notesCommentsLayouting.NotesPosition takes the value NotesPositions.BottomFullpublic final void writeAsSvg(java.io.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(); }
writeAsSvg in interface ISlidestream - Target streampublic final void writeAsSvg(java.io.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(); }
writeAsSvg in interface ISlidestream - Target streamsvgOptions - SVG generation optionspublic final void writeAsEmf(java.io.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(); }
writeAsEmf in interface ISlidestream - Target streamcom.aspose.ms.System.ArgumentNullException - Target stream is nullpublic final void remove()
Removes slide from presentation.
remove in interface ISlidePptxEditException - Thrown if slide is already removed from presentation.public final ILayoutSlide getLayoutSlide()
Returns or sets the layout slide for the current slide.
Read/write ILayoutSlide.
getLayoutSlide in interface ISlidepublic final void setLayoutSlide(ILayoutSlide value)
Returns or sets the layout slide for the current slide.
Read/write ILayoutSlide.
setLayoutSlide in interface ISlidepublic final void reset()
Resets position, size and formatting of every shape that has a prototype on LayoutSlide.
public final INotesSlideManager getNotesSlideManager()
Allow to access notes slide, add and remove it.
Read-only INotesSlideManager.
getNotesSlideManager in interface ISlidepublic final IComment[] getSlideComments(ICommentAuthor author)
Returns all slide comments added by specific author.
getSlideComments in interface ISlideauthor - Author of comments to find or null to return all comments.Comment.public void joinPortionsWithSameFormatting()
Joins runs with same formatting in all paragraphs in all acceptable shapes.
joinPortionsWithSameFormatting in interface IBaseSlidejoinPortionsWithSameFormatting in class BaseSlideCopyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.