Lavorare con la forma Group nei documenti di Word
A volte è necessario aggiungere un group shape in un documento Word. Tale group shape è costituito da più forme.
In Microsoft Word, puoi aggiungere rapidamente un group shape utilizzando il comando/pulsante Group. Una forma individuale in un gruppo può essere spostata separatamente.
In Aspose.Words è molto semplice aggiungere un group shape utilizzando la classe GroupShape. La forma viene creata separatamente utilizzando la classe Shape e quindi aggiunta nell’oggetto GroupShape utilizzando il metodo append_child.
L’esempio di codice seguente mostra come aggiungere un group shape in un documento Word:
# 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") |
Di seguito sono riportati alcuni dei tipi Shape
supportati in Aspose.Words. Per l’elenco completo, vedere l’enumerazione aspose.words.drawing.ShapeType