DsWord allows you to add predefined geometrical shapes which are visual figures with filling and outline. A few examples of shapes include rectangle, arrow, ellipse, hexagon etc. A shape can be added in a document by using Add and Insert methods of ShapeCollection class. You can also access the previous or next shapes, apply fill format, line format, group fill, shape style etc. by using methods provided by Shape class.
DsWord supports 188 geometrical shapes which can be viewed by downloading the Word document.
To add shape in a document:
C# |
Copy Code |
---|---|
var doc = new GcWordDocument(); //Create a Run element var run = doc.Body.Paragraphs.Add().GetRange().Runs.Add(); //Add an arc shape var shape = run.GetRange().Shapes.Add(200, 300, GeometryType.Arc); shape.Line.Fill.Type = FillType.Solid; shape.Line.Fill.SolidFill.ThemeColor = ThemeColorId.Accent4; doc.Save("shape.docx"); |
Limitations
Effects and derived classes (EffectsDAG, EffectsList) are not supported.