幻灯片中有重叠图形时,我们可以更改图形的位置来决定哪个图形位于哪个图形的上方或下方。本文展示如何使用Spire.Presentation将一个图形调整到另一个图形的上方,您也可以将图形调整到下方、最前及最后。
C#
//加载一个PowerPoint文档
Presentation presentation = new Presentation();
presentation.LoadFromFile(@"C:\Users\Administrator\Desktop\input.pptx");
//获取指定的图形
IShape shape = presentation.Slides[0].Shapes[1];
//使用SetShapeArrange方法将图形向上方提升一级
shape.SetShapeArrange(ShapeArrange.BringForward);
//保存文档
presentation.SaveToFile("output.pptx", FileFormat.Pptx2013);
VB.NET
'加载一个PowerPoint文档
Dim presentation As New Presentation()
presentation.LoadFromFile("C:\Users\Administrator\Desktop\input.pptx")
'获取指定的图形
Dim shape As IShape = presentation.Slides(0).Shapes(1)
'使用SetShapeArrange方法将图形向上方提升一级
shape.SetShapeArrange(ShapeArrange.BringForward)
'保存文档
presentation.SaveToFile("output.pptx", FileFormat.Pptx2013)