Praca z Group Shapes W dokumentach Word
Czasami musisz dodać group shape do dokumentu Word. Taki group shape składa się z wielu kształtów.
W Microsoft Word możesz szybko dodać group shape za pomocą polecenia/przycisku grupy. Indywidualny kształt w grupie można przenosić osobno.
W Aspose.Words bardzo łatwo jest dodać group shape za pomocą klasy GroupShape. Kształt jest tworzony osobno przy użyciu klasy Shape, a następnie dodawany do obiektu GroupShape przy użyciu metody AppendChild.
Poniższy przykład kodu pokazuje, jak dodać group shape do dokumentu 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); |
Poniżej znajdują się niektóre typy Shape
obsługiwane w Aspose.Words. Aby uzyskać pełną listę, odwiedź ShapeType:
- Prostokąt
- RoundRectangle
- RoundRectangle
- Elipsa
- Diament
- Trójkąt
- RightTriangle
- Równoległobok
- Trapez
- Hexagon
- Octagon