Lucrul cu Group Shapes în documente Word
Uneori trebuie să adăugați un group shape într-un document Word. Un astfel de group shape este format din mai multe forme.
În Microsoft Word, puteți adăuga rapid un group shape Folosind comanda/butonul de grup. O formă individuală dintr-un grup poate fi mutată separat.
În Aspose.Words este foarte ușor să adăugați un group shape folosind clasa GroupShape. Forma este creată separat folosind clasa Shape și apoi adăugată la obiectul GroupShape folosind metoda AppendChild.
Următorul exemplu de cod arată cum să adăugați un group shape într-un document Word:
For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C | |
// The path to the documents directory. | |
System::String outputDataDir = GetOutputDataDir_WorkingWithDocument(); | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(); | |
doc->EnsureMinimum(); | |
System::SharedPtr<GroupShape> gs = System::MakeObject<GroupShape>(doc); | |
System::SharedPtr<Shape> shape = System::MakeObject<Shape>(doc, ShapeType::AccentBorderCallout1); | |
shape->set_Width(100); | |
shape->set_Height(100); | |
gs->AppendChild(shape); | |
System::SharedPtr<Shape> shape1 = System::MakeObject<Shape>(doc, ShapeType::ActionButtonBeginning); | |
shape1->set_Left(100); | |
shape1->set_Width(100); | |
shape1->set_Height(200); | |
gs->AppendChild(shape1); | |
gs->set_Width(200); | |
gs->set_Height(200); | |
gs->set_CoordSize(System::Drawing::Size(200, 200)); | |
System::SharedPtr<DocumentBuilder> builder = System::MakeObject<DocumentBuilder>(doc); | |
builder->InsertNode(gs); | |
System::String outputPath = outputDataDir + u"AddGroupShapeToDocument.doc"; | |
// Save the document to disk. | |
doc->Save(outputPath); |
Mai jos sunt câteva dintre tipurile Shape
acceptate în Aspose.Words. Pentru lista completă, vă rugăm să vizitați ShapeType:
- Dreptunghi
- RoundRectangle
- RoundRectangle
- Elipsă
- Diamant
- Triunghi
- RightTriangle
- Paralelogram
- Trapezoid
- Hexagon
- Octagon