com.aspose.slides

Interfaces

Classes

Exceptions

com.aspose.slides

Class SlideUtil

  • java.lang.Object
    • com.aspose.slides.SlideUtil


  • public class SlideUtil
    extends java.lang.Object

    Offer methods which help to search shapes and text in a presentation.

    • Constructor Summary

      Constructors 
      Constructor and Description
      SlideUtil() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void alignShapes(int alignmentType, boolean alignToSlide, IBaseSlide slide, int[] shapeIndexes)
      Changes the placement of selected shapes on the slide.
      static void alignShapes(int alignmentType, boolean alignToSlide, IShapeCollection shapes)
      Changes the placement of selected shapes on the slide.
      static IShape findShape(IBaseSlide slide, java.lang.String altText)
      Find shape by alternative text on a slide in a PPTX presentation.
      static IShape findShape(IPresentation pres, java.lang.String altText)
      Find shape by alternative text in a PPTX presentation.
      static ITextFrame[] getAllTextBoxes(IBaseSlide slide)
      Returns all text frames on a slide in a PPTX presentation.
      static ITextFrame[] getAllTextFrames(IPresentation pres, boolean withMasters)
      Returns all text frames in a PPTX presentation.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SlideUtil

        public SlideUtil()
    • Method Detail

      • findShape

        public static IShape findShape(IPresentation pres,
                                       java.lang.String altText)

        Find shape by alternative text in a PPTX presentation.

        Parameters:
        pres - Scanned presentation.
        altText - Alternative text of a shape.
        Returns:
        Shape or null.
      • findShape

        public static IShape findShape(IBaseSlide slide,
                                       java.lang.String altText)

        Find shape by alternative text on a slide in a PPTX presentation.

        Parameters:
        slide - Scanned slide.
        altText - Alternative text of a shape.
        Returns:
        Shape or null.
      • alignShapes

        public static void alignShapes(int alignmentType,
                                       boolean alignToSlide,
                                       IShapeCollection shapes)

        Changes the placement of selected shapes on the slide. Aligns shapes to the margins or the edge of the slide or align them relative to each other.


        Example:
         
         Presentation pres = new Presentation("pres.pptx");
         try {
             SlideUtil.alignShapes(ShapesAlignmentType.AlignBottom, true, pres.getSlides().get_Item(0).getShapes());
         } finally {
             if (pres != null) pres.dispose();
         }
         
        Parameters:
        alignmentType - Determines which type of alignment will be applied.
        alignToSlide - If true, shapes will be aligned relative to the slide edges
        shapes - Shapes collection to be aligned
      • alignShapes

        public static void alignShapes(int alignmentType,
                                       boolean alignToSlide,
                                       IBaseSlide slide,
                                       int[] shapeIndexes)

        Changes the placement of selected shapes on the slide. Aligns shapes to the margins or the edge of the slide or align them relative to each other.


        Example:
          
          Presentation pres = new Presentation("pres.pptx");
          try {
             ISlide slide = pres.getSlides().get_Item(0);
             IShape shape1 = slide.getShapes().get_Item(0);
             IShape shape2 = slide.getShapes().get_Item(1);
             SlideUtil.alignShapes(ShapesAlignmentType.AlignBottom, false, pres.getSlides().get_Item(0), new int[]
             {
                 slide.getShapes().indexOf(shape1),
                 slide.getShapes().indexOf(shape2)
             });
          } finally {
             if (pres != null) pres.dispose();
          }
          
        Parameters:
        alignmentType - Determines which type of alignment will be applied.
        alignToSlide - If true, shapes will be aligned relative to the slide edges
        slide - Parent slide.
        shapeIndexes - Indexes of shapes to be aligned.
      • getAllTextBoxes

        public static ITextFrame[] getAllTextBoxes(IBaseSlide slide)

        Returns all text frames on a slide in a PPTX presentation.

        Parameters:
        slide - Scanned slide.
        Returns:
        Array of TextFrame objects.
      • getAllTextFrames

        public static ITextFrame[] getAllTextFrames(IPresentation pres,
                                                    boolean withMasters)

        Returns all text frames in a PPTX presentation.

        Parameters:
        pres - Scanned presentation.
        withMasters - Determines whether master slides should be scanned.
        Returns:
        Array of TextFrame objects.