کار با Group Shapes در اسناد ورد
گاهی اوقات شما نیاز به اضافه کردن یک group shape به یک سند ورد دارید. چنین group shape از اشکال مختلف تشکیل شده است.
در Microsoft Word، شما می توانید به سرعت یک group shape با استفاده از دستور/دکمه گروه اضافه کنید. شکل فردی در یک گروه را می توان به طور جداگانه جابجا کرد.
در Aspose.Words اضافه کردن group shape با استفاده از کلاس GroupShape بسیار آسان است. شکل به طور جداگانه با استفاده از کلاس Shape ایجاد می شود و سپس با استفاده از روش AppendChild به شی GroupShape اضافه می شود.
مثال کد زیر نشان می دهد که چگونه یک group shape را به یک سند ورد اضافه کنید:
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); |
در زیر برخی از انواع Shape
پشتیبانی شده در Aspose.Words آورده شده است. برای لیست کامل، لطفا به ShapeTypeمراجعه کنید:
- مستطیل
- RoundRectangle
- RoundRectangle
- بیضوی
- الماس
- مثلث
- RightTriangle
- موازی
- ذوزنقه
- شش ضلعی
- هشت ضلعی