Create Word Group Shapes
Created
June 16, 2025 07:04
-
-
Save openize-com-gists/1705c914f26a6ada2f0c3ab9c85a3ce4 to your computer and use it in GitHub Desktop.
Create Word Group Shapes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace OpenizeGroupShapesCreationExample | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| // Prerequisite: Install Openize.Words NuGet package | |
| // Install-Package Openize.Words | |
| // Initialize a new word document with the default template | |
| var doc = new Openize.Words.Document(); | |
| System.Console.WriteLine("Word Document with default template initialized"); | |
| // Initialize the body with the new document | |
| var body = new Openize.Words.Body(doc); | |
| System.Console.WriteLine("Body of the Word Document initialized"); | |
| // Instantiate shape element with diamond and coordinates/size. | |
| var diamond = new Openize.Words.IElements.Shape(0, 0, 200, 200, | |
| Openize.Words.IElements.ShapeType.Diamond); | |
| System.Console.WriteLine("Diamond shape created"); | |
| // Instantiate shape element with oval and coordinates/size. | |
| var oval = new Openize.Words.IElements.Shape(300, 0, 200, 200, | |
| Openize.Words.IElements.ShapeType.Ellipse); | |
| System.Console.WriteLine("Oval shape created"); | |
| // Group diamond and oval shapes | |
| var groupShape = new Openize.Words.IElements.GroupShape(diamond, oval); | |
| body.AppendChild(groupShape); | |
| System.Console.WriteLine("Diamond and Oval shapes grouped and added to the document"); | |
| // Save word document | |
| doc.Save($"WordGroupShapes.docx"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment