Groepvorm
Contents
[
Hide
]
Voorbeelden voor het maken van groepen vormen, het benaderen ervan, het loskoppelen en verwijderen met Aspose.Slides for Android via Java.
Groepvorm toevoegen
Maak een groep die twee basisvormen bevat.
static void addGroupShape() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IGroupShape group = slide.getShapes().addGroupShape();
group.getShapes().addAutoShape(ShapeType.Rectangle, 0, 0, 50, 50);
group.getShapes().addAutoShape(ShapeType.Ellipse, 60, 0, 50, 50);
} finally {
presentation.dispose();
}
}
Groepvorm benaderen
Haal de eerste groepvorm op van een dia.
static void accessGroupShape() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IGroupShape group = slide.getShapes().addGroupShape();
group.getShapes().addAutoShape(ShapeType.Rectangle, 0, 0, 50, 50);
IGroupShape firstGroup = null;
for (IShape shape : slide.getShapes()) {
if (shape instanceof IGroupShape) {
firstGroup = (IGroupShape) shape;
break;
}
}
} finally {
presentation.dispose();
}
}
Groepvorm verwijderen
Verwijder een groepvorm van de dia.
static void removeGroupShape() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IGroupShape group = slide.getShapes().addGroupShape();
slide.getShapes().remove(group);
} finally {
presentation.dispose();
}
}
Vormen loskoppelen
Verplaats vormen uit een groepscontainer.
static void ungroupShapes() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IGroupShape group = slide.getShapes().addGroupShape();
IAutoShape rect = group.getShapes().addAutoShape(ShapeType.Rectangle, 0, 0, 50, 50);
// Verplaats vorm uit de groep.
slide.getShapes().addClone(rect);
group.getShapes().remove(rect);
} finally {
presentation.dispose();
}
}