ShapeBaseGetShapeRenderer Method
Creates and returns an object that can be used to render this shape into an image.

Namespace: Aspose.Words.Drawing
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.12
Syntax
public ShapeRenderer GetShapeRenderer()

Return Value

Type: ShapeRenderer
The renderer object for this shape.
Remarks

This method just invokes the ShapeRenderer constructor and passes this object as a parameter.

Examples
Shows how to export shapes to files in the local file system using a shape renderer.
// Open a document that contains shapes and get its shape collection
Document doc = new Document(MyDir + "Shape.VarietyOfShapes.docx");
List<Shape> shapes = doc.GetChildNodes(NodeType.Shape, true).Cast<Shape>().ToList();
Assert.AreEqual(7, shapes.Count);

// There are 7 shapes in the document, with one group shape with 2 child shapes
// The child shapes will be rendered but their parent group shape will be skipped, so we will see 6 output files
foreach (Shape shape in doc.GetChildNodes(NodeType.Shape, true).OfType<Shape>())
{
    ShapeRenderer renderer = shape.GetShapeRenderer();
    ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);
    renderer.Save(ArtifactsDir + $"Shape.ShapeRenderer {shape.Name}.png", options);
}
See Also