Trabajar con Group Shapes en Documentos de Word
A veces es necesario agregar un group shape en un documento de Word. Tal group shape consta de múltiples formas.
En Microsoft Word, puede agregar rápidamente un group shape usando el comando/botón de Grupo. Una forma individual en un grupo se puede mover por separado.
En Aspose.Words es muy fácil agregar un group shape usando la clase GroupShape. La forma se crea por separado usando la clase Shape y luego se agrega al objeto GroupShape usando el método AppendChild.
El siguiente ejemplo de código muestra cómo agregar un group shape en un documento de 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); |
A continuación se muestran algunos de los Shape
tipos admitidos en Aspose.Words. Para ver la lista completa, visite ShapeType:
- Rectángulo
- RoundRectangle
- RoundRectangle
- Elipse
- Diamante
- Triángulo
- RightTriangle
- Paralelogramo
- Trapecio
- Hexágono
- Octágono