AlignShapes

AlignShapes(ShapesAlignmentType, bool, IBaseSlide)

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

public static void AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, 
    IBaseSlide slide)
Parameter Type Description
alignmentType ShapesAlignmentType Determines which type of alignment will be applied.
alignToSlide Boolean If true, shapes will be aligned relative to the slide edges.
slide IBaseSlide Parent slide.

Examples

Example:

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
   SlideUtil.AlignShapes(ShapesAlignmentType.AlignBottom, true, pres.Slides);
}

See Also


AlignShapes(ShapesAlignmentType, bool, IBaseSlide, int[])

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.

public static void AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, 
    IBaseSlide slide, int[] shapeIndexes)
Parameter Type Description
alignmentType ShapesAlignmentType Determines which type of alignment will be applied.
alignToSlide Boolean If true, shapes will be aligned relative to the slide edges.
slide IBaseSlide Parent slide.
shapeIndexes Int32[] Indexes of shapes to be aligned.

Examples

Example:

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
   ISlide slide = pres.Slides[0];
   IShape shape1 = slide.Shapes[0];
   IShape shape2 = slide.Shapes[1]; 

   SlideUtil.AlignShapes(ShapesAlignmentType.AlignBottom, false, pres.Slides[0], new int[]
   {
      slide.Shapes.IndexOf(shape1),
      slide.Shapes.IndexOf(shape2)
   });
}

See Also


AlignShapes(ShapesAlignmentType, bool, IGroupShape)

Changes the placement of all shapes within group shape. Aligns shapes to the margins or the edge of the slide or align them relative to each other.

public static void AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, 
    IGroupShape groupShape)
Parameter Type Description
alignmentType ShapesAlignmentType Determines which type of alignment will be applied.
alignToSlide Boolean If true, shapes will be aligned relative to the slide edges.
groupShape IGroupShape Parent group shape.

Examples

Example:

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
   SlideUtil.AlignShapes(ShapesAlignmentType.AlignLeft, false, (GroupShape)slide.Shapes[0]);
}

See Also


AlignShapes(ShapesAlignmentType, bool, IGroupShape, int[])

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

public static void AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, 
    IGroupShape groupShape, int[] shapeIndexes)
Parameter Type Description
alignmentType ShapesAlignmentType Determines which type of alignment will be applied.
alignToSlide Boolean If true, shapes will be aligned relative to the slide edges.
groupShape IGroupShape Parent group shape.
shapeIndexes Int32[] Indexes of shapes to be aligned.

Examples

Example:

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
   SlideUtil.AlignShapes(ShapesAlignmentType.AlignLeft, false, (GroupShape)slide.Shapes[0], new int[] { 0, 2 });
}

See Also