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)
ParameterTypeDescription
alignmentTypeShapesAlignmentTypeDetermines which type of alignment will be applied.
alignToSlideBooleanIf true, shapes will be aligned relative to the slide edges.
slideIBaseSlideParent 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)
ParameterTypeDescription
alignmentTypeShapesAlignmentTypeDetermines which type of alignment will be applied.
alignToSlideBooleanIf true, shapes will be aligned relative to the slide edges.
slideIBaseSlideParent slide.
shapeIndexesInt32[]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)
ParameterTypeDescription
alignmentTypeShapesAlignmentTypeDetermines which type of alignment will be applied.
alignToSlideBooleanIf true, shapes will be aligned relative to the slide edges.
groupShapeIGroupShapeParent 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)
ParameterTypeDescription
alignmentTypeShapesAlignmentTypeDetermines which type of alignment will be applied.
alignToSlideBooleanIf true, shapes will be aligned relative to the slide edges.
groupShapeIGroupShapeParent group shape.
shapeIndexesInt32[]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