AlignShapes

AlignShapes(ShapesAlignmentType, bool, IBaseSlide)

更改幻灯片上所有形状的位置。将形状与幻灯片的边距或边缘对齐 或将它们相对于彼此对齐。

public static void AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, 
    IBaseSlide slide)
范围类型描述
alignmentTypeShapesAlignmentType确定将应用哪种对齐类型。
alignToSlideBoolean如果为真,则形状将相对于幻灯片边缘对齐。
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如果为真,则形状将相对于幻灯片边缘对齐。
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如果为真,则形状将相对于幻灯片边缘对齐。
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如果为真,则形状将相对于幻灯片边缘对齐。
groupShapeIGroupShape父组形状。
shapeIndexesInt32[]要对齐的形状的索引。

例子

示例:

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

也可以看看