So fügen Sie eine Group-Form in ein Word-Dokument ein
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, mithilfe der GroupShape-Klasse einen group shape hinzuzufügen. Shape wird separat mit der Shape-Klasse erstellt und dann mit der AppendChild-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-.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); |
Nachfolgend sind einige der in Aspose.Words unterstützten Shape
-Typen aufgeführt:
- Rechteck
- RoundRectangle
- RoundRectangle
- Ellipse
- Diamant
- Dreieck
- Rechtwinkliges Dreieck
- Parallelogramm
- Trapez
- Sechseck
- Achteck
Eine vollständige Liste finden Sie in der ShapeType-Klasse.