Class GroupShape
Represents the group shape in the Word document.
Inheritance
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.UWP.dll
Syntax
public class GroupShape : ShapeBase, IXDLSSerializable, IWidget, IParagraphItem, IOfficeRun, IEntity
Constructors
GroupShape(IWordDocument)
Initializes a new instance of GroupShape class with the specified IWordDocument instance.
Declaration
public GroupShape(IWordDocument document)
Parameters
Type | Name | Description |
---|---|---|
IWordDocument | document | The IWordDocument instance. |
GroupShape(IWordDocument, ParagraphItem[])
Initializes a new instance of GroupShape class with the specified IWordDocument instance.
Declaration
public GroupShape(IWordDocument document, ParagraphItem[] childShapes)
Parameters
Type | Name | Description |
---|---|---|
IWordDocument | document | The IWordDocument instance. |
ParagraphItem[] | childShapes | The ParagraphItem collection within the GroupShape. |
Properties
EntityType
Gets the Entity Type
Declaration
public override EntityType EntityType { get; }
Property Value
Type |
---|
EntityType |
Overrides
FlipHorizontal
Gets or sets a Horizontal flipping of GroupShape.
Declaration
public bool FlipHorizontal { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This property returns True if the specified groupshape is flipped around the horizontal axis, and False if not.
Examples
The following code example demonstrates how to gets or sets the horizontal flip to group shape.
//Creates a new Word document
WordDocument document = new WordDocument();
//Adds new section to the document
IWSection section = document.AddSection();
//Adds new paragraph to the section
WParagraph paragraph = section.AddParagraph() as WParagraph;
//Creates new group shape
GroupShape groupShape = new GroupShape(document);
//Adds group shape to the paragraph.
paragraph.ChildEntities.Add(groupShape);
//Creates new shape
Shape shape = new Shape(document, AutoShapeType.RoundedRectangle);
//Sets height and width for shape
shape.Height = 100;
shape.Width = 150;
//Sets horizontal and vertical position
shape.HorizontalPosition = 72;
shape.VerticalPosition = 72;
//Set wrapping style for shape
shape.WrapFormat.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
//Sets horizontal and vertical origin
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
//Adds the specified shape to group shape
groupShape.Add(shape);
//Creates new picture
WPicture picture = new WPicture(document);
picture.LoadImage(Image.FromFile("Image.png"));
//Sets wrapping style for picture
picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
//Sets height and width for the image
picture.Height = 100;
picture.Width = 100;
//Sets horizontal and vertical position
picture.HorizontalPosition = 400;
picture.VerticalPosition = 150;
//Sets horizontal and vertical origin
picture.HorizontalOrigin = HorizontalOrigin.Page;
picture.VerticalOrigin = VerticalOrigin.Page;
//Adds the specified picture to group shape
groupShape.Add(picture);
//Sets horizontal flip to the group shape
groupShape.FlipHorizontal = true;
//Saves the Word document
document.Save("Sample.docx", FormatType.Docx);
//Closes the document
document.Close();
'Creates a new Word document
Dim document As WordDocument = New WordDocument
'Adds new section to the document
Dim section As IWSection = document.AddSection
'Adds new paragraph to the section
Dim paragraph As WParagraph = CType(section.AddParagraph, WParagraph)
'Creates new group shape
Dim groupShape As GroupShape = New GroupShape(document)
'Adds group shape to the paragraph.
paragraph.ChildEntities.Add(groupShape)
Dim shape As Shape = New Shape(document, AutoShapeType.RoundedRectangle)
'Sets height and width for shape
shape.Height = 100
shape.Width = 150
'Sets horizontal and vertical position
shape.HorizontalPosition = 72
shape.VerticalPosition = 72
'Set wrapping style for shape
shape.WrapFormat.TextWrappingStyle = TextWrappingStyle.InFrontOfText
'Sets horizontal and vertical origin
shape.HorizontalOrigin = HorizontalOrigin.Page
shape.VerticalOrigin = VerticalOrigin.Page
'Adds the specified shape to group shape
groupShape.Add(shape)
Dim picture As WPicture = New WPicture(document)
picture.LoadImage(Image.FromFile("Image.png"))
'Sets wrapping style for picture
picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText
'Sets height and width for the image
picture.Height = 100
picture.Width = 100
'Sets horizontal and vertical position
picture.HorizontalPosition = 400
picture.VerticalPosition = 150
'Sets horizontal and vertical origin
picture.HorizontalOrigin = HorizontalOrigin.Page
picture.VerticalOrigin = VerticalOrigin.Page
'Adds the specified picture to group shape
groupShape.Add(picture)
'Sets horizontal flip to the group shape
groupShape.FlipHorizontal = True
'Saves the Word document
document.Save("Sample.docx", FormatType.Docx)
'Closes the document
document.Close()
FlipVertical
Gets or sets a Vertical flipping of GroupShape.
Declaration
public bool FlipVertical { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This property returns True if the specified groupshape is flipped around the vertical axis, and False if not.
Examples
The following code example demonstrates how to gets or sets the vertical flip to group shape.
//Creates a new Word document
WordDocument document = new WordDocument();
//Adds new section to the document
IWSection section = document.AddSection();
//Adds new paragraph to the section
WParagraph paragraph = section.AddParagraph() as WParagraph;
//Creates new group shape
GroupShape groupShape = new GroupShape(document);
//Adds group shape to the paragraph.
paragraph.ChildEntities.Add(groupShape);
//Creates new shape
Shape shape = new Shape(document, AutoShapeType.RoundedRectangle);
//Sets height and width for shape
shape.Height = 100;
shape.Width = 150;
//Sets horizontal and vertical position
shape.HorizontalPosition = 72;
shape.VerticalPosition = 72;
//Set wrapping style for shape
shape.WrapFormat.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
//Sets horizontal and vertical origin
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
//Adds the specified shape to group shape
groupShape.Add(shape);
//Creates new picture
WPicture picture = new WPicture(document);
picture.LoadImage(Image.FromFile("Image.png"));
//Sets wrapping style for picture
picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
//Sets height and width for the image
picture.Height = 100;
picture.Width = 100;
//Sets horizontal and vertical position
picture.HorizontalPosition = 400;
picture.VerticalPosition = 150;
//Sets horizontal and vertical origin
picture.HorizontalOrigin = HorizontalOrigin.Page;
picture.VerticalOrigin = VerticalOrigin.Page;
//Adds the specified picture to group shape
groupShape.Add(picture);
//Sets vertical flip to the group shape
groupShape.FlipVertical = true;
//Saves the Word document
document.Save("Sample.docx", FormatType.Docx);
//Closes the document
document.Close();
'Creates a new Word document
Dim document As WordDocument = New WordDocument
'Adds new section to the document
Dim section As IWSection = document.AddSection
'Adds new paragraph to the section
Dim paragraph As WParagraph = CType(section.AddParagraph, WParagraph)
'Creates new group shape
Dim groupShape As GroupShape = New GroupShape(document)
'Adds group shape to the paragraph.
paragraph.ChildEntities.Add(groupShape)
Dim shape As Shape = New Shape(document, AutoShapeType.RoundedRectangle)
'Sets height and width for shape
shape.Height = 100
shape.Width = 150
'Sets horizontal and vertical position
shape.HorizontalPosition = 72
shape.VerticalPosition = 72
'Set wrapping style for shape
shape.WrapFormat.TextWrappingStyle = TextWrappingStyle.InFrontOfText
'Sets horizontal and vertical origin
shape.HorizontalOrigin = HorizontalOrigin.Page
shape.VerticalOrigin = VerticalOrigin.Page
'Adds the specified shape to group shape
groupShape.Add(shape)
Dim picture As WPicture = New WPicture(document)
picture.LoadImage(Image.FromFile("Image.png"))
'Sets wrapping style for picture
picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText
'Sets height and width for the image
picture.Height = 100
picture.Width = 100
'Sets horizontal and vertical position
picture.HorizontalPosition = 400
picture.VerticalPosition = 150
'Sets horizontal and vertical origin
picture.HorizontalOrigin = HorizontalOrigin.Page
picture.VerticalOrigin = VerticalOrigin.Page
'Adds the specified picture to group shape
groupShape.Add(picture)
'Sets vertical flip to the group shape
groupShape.FlipVertical = True
'Saves the Word document
document.Save("Sample.docx", FormatType.Docx)
'Closes the document
document.Close()
Rotation
Gets or sets the group shape rotation in degree.
Declaration
public float Rotation { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The float that specifies the rotation value of the group shape. |
Remarks
A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation.
Examples
The following code example demonstrates how to gets or sets the rotation value of group shape in degree.
//Creates a new Word document
WordDocument document = new WordDocument();
//Adds new section to the document
IWSection section = document.AddSection();
//Adds new paragraph to the section
WParagraph paragraph = section.AddParagraph() as WParagraph;
//Creates new group shape
GroupShape groupShape = new GroupShape(document);
//Adds group shape to the paragraph.
paragraph.ChildEntities.Add(groupShape);
//Creates new shape
Shape shape = new Shape(document, AutoShapeType.RoundedRectangle);
//Sets height and width for shape
shape.Height = 100;
shape.Width = 150;
//Sets horizontal and vertical position
shape.HorizontalPosition = 72;
shape.VerticalPosition = 72;
//Set wrapping style for shape
shape.WrapFormat.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
//Sets horizontal and vertical origin
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
//Adds the specified shape to group shape
groupShape.Add(shape);
//Creates new picture
WPicture picture = new WPicture(document);
picture.LoadImage(Image.FromFile("Image.png"));
//Sets wrapping style for picture
picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
//Sets height and width for the image
picture.Height = 100;
picture.Width = 100;
//Sets horizontal and vertical position
picture.HorizontalPosition = 400;
picture.VerticalPosition = 150;
//Sets horizontal and vertical origin
picture.HorizontalOrigin = HorizontalOrigin.Page;
picture.VerticalOrigin = VerticalOrigin.Page;
//Adds the specified picture to group shape
groupShape.Add(picture);
//Sets group shape rotation in degree
groupShape.Rotation = 90;
//Saves the Word document
document.Save("Sample.docx", FormatType.Docx);
//Closes the document
document.Close();
'Creates a new Word document
Dim document As WordDocument = New WordDocument
'Adds new section to the document
Dim section As IWSection = document.AddSection
'Adds new paragraph to the section
Dim paragraph As WParagraph = CType(section.AddParagraph, WParagraph)
'Creates new group shape
Dim groupShape As GroupShape = New GroupShape(document)
'Adds group shape to the paragraph.
paragraph.ChildEntities.Add(groupShape)
Dim shape As Shape = New Shape(document, AutoShapeType.RoundedRectangle)
'Sets height and width for shape
shape.Height = 100
shape.Width = 150
'Sets horizontal and vertical position
shape.HorizontalPosition = 72
shape.VerticalPosition = 72
'Set wrapping style for shape
shape.WrapFormat.TextWrappingStyle = TextWrappingStyle.InFrontOfText
'Sets horizontal and vertical origin
shape.HorizontalOrigin = HorizontalOrigin.Page
shape.VerticalOrigin = VerticalOrigin.Page
'Adds the specified shape to group shape
groupShape.Add(shape)
Dim picture As WPicture = New WPicture(document)
picture.LoadImage(Image.FromFile("Image.png"))
'Sets wrapping style for picture
picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText
'Sets height and width for the image
picture.Height = 100
picture.Width = 100
'Sets horizontal and vertical position
picture.HorizontalPosition = 400
picture.VerticalPosition = 150
'Sets horizontal and vertical origin
picture.HorizontalOrigin = HorizontalOrigin.Page
picture.VerticalOrigin = VerticalOrigin.Page
'Adds the specified picture to group shape
groupShape.Add(picture)
'Sets group shape rotation in degree
groupShape.Rotation = 90
'Saves the Word document
document.Save("Sample.docx", FormatType.Docx)
'Closes the document
document.Close()
Methods
Add(ParagraphItem)
Adds the specified shape (picture, shape, group shape) to the group shape.
Declaration
public void Add(ParagraphItem childShape)
Parameters
Type | Name | Description |
---|---|---|
ParagraphItem | childShape | The ParagraphItem instance |
CloneImpl()
Creates a duplicate copy of this GroupShape object.
Declaration
protected override object CloneImpl()
Returns
Type | Description |
---|---|
System.Object | The reference of the newly created GroupShape. |
Overrides
Ungroup()
Ungroups the child shapes in the group shape
Declaration
public ParagraphItem[] Ungroup()
Returns
Type | Description |
---|---|
ParagraphItem[] | Returns the ungrouped items as paragraph item array. |