ShapeBaseGetShapeRenderer Method |
Namespace: Aspose.Words.Drawing
This method just invokes the ShapeRenderer constructor and passes this object as a parameter.
// Open a document that contains shapes and get its shape collection Document doc = new Document(MyDir + "Various shapes.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.RenderAllShapes.{shape.Name}.png", options); }