GrapeCity’s Documents for Word library, referred to as GcWord, is an API that helps developers programmatically create, modify, and save Word documents. With an object model based on Microsoft Office API, Word JavaScript API, and Open XML SDK, users can create, load, edit, save, and convert Word documents with zero dependencies on Microsoft Word. It enables developers to generate Word documents with formatted text, images, tables, hyperlinks, comments, headers, footers, footnotes, endnotes, etc. GcWord helps make documents even more interactive and meaningful.

Word documents can contain more than just text. Developers might want to add shapes to highlight essential items or emphasize ideas on the document. Bringing attention to those items helps readers better understand the content. With the advent of the v3.2 release of GrapeCity Documents for Word, it is now possible to add various shapes in Word documents. The base class for the following varieties is ShapeBase.

Adding Shapes to Word Document

Shapes are drawing elements, such as rectangles, circles, polygons, and lines. A shape can be filled and/or outlined. It is also possible to format and position the shape. Additionally, it can contain a description.

Here is the code snippet to draw a yellow diamond shape:

GcWordDocument doc = new GcWordDocument();
Paragraph para = doc.Body.Paragraphs.Add();
  //Define a run object to add the shapes
Run run = para.GetRange().Runs.Add();
  var shape = run.GetRange().Shapes.Add(200, 300, GeometryType.Diamond);
shape.Line.Fill.Type = FillType.Solid;
shape.Line.Fill.SolidFill.ThemeCOlor = ThemeColorId.Accent4;

Add Shapes to Word Documents in .NET

#web #.net #desktop #document apis #.net reporting #.net core

Add Shapes to Word Documents in .NET
1.40 GEEK