Arbeiten mit Group Shape in Word-Dokumenten
Manchmal müssen Sie ein group shape in ein Word-Dokument einfügen. Ein solches group shape besteht aus mehreren Formen.
In Microsoft Word können Sie mit dem Group-Befehl/der Group-Schaltfläche schnell einen group shape hinzufügen. Eine einzelne Form in einer Gruppe kann separat verschoben werden.
In Aspose.Words ist es sehr einfach, einen group shape mithilfe der GroupShape-Klasse hinzuzufügen. Die Form wird separat mithilfe der Shape-Klasse erstellt und dann mithilfe der append_child-Methode zum GroupShape-Objekt hinzugefügt.
Das folgende Codebeispiel zeigt, wie man ein group shape in ein Word-Dokument einfügt:
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Python-via-.NET | |
doc = aw.Document() | |
doc.ensure_minimum() | |
groupShape = aw.drawing.GroupShape(doc) | |
accentBorderShape = aw.drawing.Shape(doc, aw.drawing.ShapeType.ACCENT_BORDER_CALLOUT1) | |
accentBorderShape.width = 100 | |
accentBorderShape.height = 100 | |
groupShape.append_child(accentBorderShape) | |
actionButtonShape = aw.drawing.Shape(doc, aw.drawing.ShapeType.ACTION_BUTTON_BEGINNING) | |
actionButtonShape.left = 100 | |
actionButtonShape.width = 100 | |
actionButtonShape.height = 200 | |
groupShape.append_child(actionButtonShape) | |
groupShape.width = 200 | |
groupShape.height = 200 | |
groupShape.coord_size = drawing.Size(200, 200) | |
builder = aw.DocumentBuilder(doc) | |
builder.insert_node(groupShape) | |
doc.save(docs_base.artifacts_dir + "WorkingWithShapes.add_group_shape.docx") |
Nachfolgend sind einige der in Aspose.Words unterstützten Shape
-Typen aufgeführt. Eine vollständige Liste finden Sie unter aspose.words.drawing.ShapeType-Enumeration