Add Shapes to Word Documents in .NET

Add Shapes to Word Documents in .NET

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.

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

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

jQuery Ajax CRUD in ASP.NET Core MVC with Modal Popup

In this article, we’ll discuss how to use jQuery Ajax for ASP.NET Core MVC CRUD Operations using Bootstrap Modal. With jQuery Ajax, we can make HTTP request to controller action methods without reloading the entire page, like a single page application.

Swagger Web API Versioning with Group By | ASP.NET Core Web API

Swagger Web API Version. Swagger Web API Versioning. Swashbuckle API Version. Swagger ASP.NET Core WEB API Versioning Example. API Version using Swagger. API

Create Asp Net Web API for CRUD operation | CRUD Using Asp Net Api

LIKE | COMMENT | SHARE | SUBSCRIBE Web API CRUD Operations Using Asp Net MVC and Entity Framework Contents * Web API Project For CRUD Operations - Insert Upd...

Consume Web API Post method in ASP NET MVC | Calling Web API | Rest API Bangla Tutorial

LIKE | COMMENT | SHARE | SUBSCRIBE In this tutorial, I will discussed about how to consume Web API Get method and display records in the ASP.NET View. Here, ...

Consume Web API Get method in ASP NET MVC | Calling Web API | Rest API Bangla Tutorial

LIKE | COMMENT | SHARE | SUBSCRIBE In this tutorial, I will discussed about How to Consume Web API Get method in ASP NET MVC. Blog : http://aspdotnetexplorer...