Skip to content

Instantly share code, notes, and snippets.

@openize-com-gists
Created June 16, 2025 07:04
Show Gist options
  • Select an option

  • Save openize-com-gists/cac539056f1de6c3bab3b800e11e9bcb to your computer and use it in GitHub Desktop.

Select an option

Save openize-com-gists/cac539056f1de6c3bab3b800e11e9bcb to your computer and use it in GitHub Desktop.
Modify Word Group Shapes

Modify Word Group Shapes

using System;
namespace OpenizeGroupShapesModificationExample
{
class Program
{
static void Main(string[] args)
{
// Prerequisite: Install Openize.Words NuGet package
// Install-Package Openize.Words
// Load the Word Document
var doc = new Openize.Words.Document($"WordGroupShapes.docx");
// Initialize the body with the loaded document.
var body = new Openize.Words.Body(doc);
// Load all group shapes
var groupShapes = body.GroupShapes;
// Traverse through each shape, change the shape type to hexagone and update document.
foreach (var groupShape in groupShapes)
{
groupShape.Shape1.Type = Openize.Words.IElements.ShapeType.Hexagone;
groupShape.Shape2.Type = Openize.Words.IElements.ShapeType.Hexagone;
doc.Update(groupShape);
}
// Save the modified Word Document
doc.Save($"ModifiedWordGroupShapes.docx");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment