Documents for Word .NET Edition
Features / Shapes / Shape
In This Topic
    Shape
    In This Topic

    GcWord 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.

    GcWord supports 188 geometrical shapes which can be viewed by downloading the Word document.

    To add shape in a document:

    1. Create a new Word document by instantiating GcWordDocument class.
    2. Add a run to a newly added paragraph by using Add method of RunCollection class.
    3. Add an arc shape by using Add method of ShapeCollection class and pass GeometryType.Arc as its parameter.
    4. Set its fill formatting property and theme color by using FillType and ThemeColorId enumeration.
      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");
    Back to Top

    Limitations

    Effects and derived classes (EffectsDAG, EffectsList) are not supported.