How to place one shape in another shapes?

Hi.

How to place the shape over another shape ?

Unfortunately, I don’t see any code samples for understanding it.

Thanks

Hi,

Please try the following example:

var document = new DocumentModel();

var section = new Section(document);
document.Sections.Add(section);

var paragraph = new Paragraph(document);
section.Blocks.Add(paragraph);

var shape1 = new Shape(document, ShapeType.Rectangle,
    new FloatingLayout(
        new HorizontalPosition(100, LengthUnit.Point, HorizontalPositionAnchor.Page),
        new VerticalPosition(100, LengthUnit.Point, VerticalPositionAnchor.Page),
        new Size(100, 100, LengthUnit.Point))
    { WrappingStyle = TextWrappingStyle.InFrontOfText });
paragraph.Inlines.Add(shape1);

var shape2 = new Shape(document, ShapeType.Oval,
    new FloatingLayout(
        new HorizontalPosition(125, LengthUnit.Point, HorizontalPositionAnchor.Page),
        new VerticalPosition(125, LengthUnit.Point, VerticalPositionAnchor.Page),
        new Size(50, 50, LengthUnit.Point))
    { WrappingStyle = TextWrappingStyle.InFrontOfText });
shape2.Fill.SetSolid(Color.Red);
shape2.Outline.Fill.SetSolid(Color.DarkRed);
paragraph.Inlines.Add(shape2);

document.Save("Shapes.docx");

Also, please check our Shapes example.

I hope this helps.

Regards,
Mario

thanks. I’ll try to do this