AlignShapes

AlignShapes(ShapesAlignmentType, bool, IBaseSlide)

改变幻灯片上所有形状的放置。将形状对齐到幻灯片的边缘或边缘,或使它们相互对齐。

public static void AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, 
    IBaseSlide slide)
参数类型描述
alignmentTypeShapesAlignmentType确定将应用哪种对齐类型。
alignToSlideBoolean如果为 true,形状将相对于幻灯片边缘对齐。
slideIBaseSlide父幻灯片。

示例

示例:

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

另见


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

改变幻灯片上所选形状的放置。将形状对齐到幻灯片的边缘或边缘,或使它们相互对齐。

public static void AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, 
    IBaseSlide slide, int[] shapeIndexes)
参数类型描述
alignmentTypeShapesAlignmentType确定将应用哪种对齐类型。
alignToSlideBoolean如果为 true,形状将相对于幻灯片边缘对齐。
slideIBaseSlide父幻灯片。
shapeIndexesInt32[]要对齐的形状索引。

示例

示例:

[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)
   });
}

另见


AlignShapes(ShapesAlignmentType, bool, IGroupShape)

改变组形状内所有形状的放置。将形状对齐到幻灯片的边缘或边缘,或使它们相互对齐。

public static void AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, 
    IGroupShape groupShape)
参数类型描述
alignmentTypeShapesAlignmentType确定将应用哪种对齐类型。
alignToSlideBoolean如果为 true,形状将相对于幻灯片边缘对齐。
groupShapeIGroupShape父组形状。

示例

示例:

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

另见


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

改变组形状内所选形状的放置。将形状对齐到幻灯片的边缘或边缘,或使它们相互对齐。

public static void AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, 
    IGroupShape groupShape, int[] shapeIndexes)
参数类型描述
alignmentTypeShapesAlignmentType确定将应用哪种对齐类型。
alignToSlideBoolean如果为 true,形状将相对于幻灯片边缘对齐。
groupShapeIGroupShape父组形状。
shapeIndexesInt32[]要对齐的形状索引。

示例

示例:

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

另见