Come aggiungere una forma Group in un documento 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. Shape viene creato separatamente utilizzando la classe Shape e quindi aggiunto all’oggetto GroupShape utilizzando il metodo AppendChild.
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-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_WorkingWithDocument(); | |
Document doc = new Document(); | |
doc.EnsureMinimum(); | |
GroupShape gs = new GroupShape(doc); | |
Shape shape = new Shape(doc, Drawing.ShapeType.AccentBorderCallout1); | |
shape.Width = 100; | |
shape.Height = 100; | |
gs.AppendChild(shape); | |
Shape shape1 = new Shape(doc, Drawing.ShapeType.ActionButtonBeginning); | |
shape1.Left = 100; | |
shape1.Width = 100; | |
shape1.Height = 200; | |
gs.AppendChild(shape1); | |
gs.Width = 200; | |
gs.Height = 200; | |
gs.CoordSize = new System.Drawing.Size(200, 200); | |
DocumentBuilder builder = new DocumentBuilder(doc); | |
builder.InsertNode(gs); | |
dataDir = dataDir + "groupshape-doc_out.doc"; | |
// Save the document to disk. | |
doc.Save(dataDir); |
Di seguito sono riportati alcuni dei tipi Shape
supportati in Aspose.Words:
- Rettangolo
- Rettangolo rotondo
- Rettangolo rotondo
- Ellisse
- Diamante
- Triangolo
- Triangolo rettangolo
- Parallelogramma
- Trapezio
- Esagono
- Ottagono
Per l’elenco completo, consultare la classe ShapeType.