How to create a textbox with visual effect box

i add a textbox using the following code, it works, but the textbox has no visual box when activated on which i can rotate or set the layout options.
var document = new Document();
document.FirstSection.Body.AppendChild(new Paragraph(document));
var shape = new Shape(document, ShapeType.TextBox);
shape.Width = 100;
shape.Height = 50;
document.FirstSection.Body.FirstParagraph.AppendChild(shape);
shape.AppendChild(new Paragraph(document));
shape.FirstParagraph.Runs.Add(new Run(document, “Test”));
document.Save(“D:\test.docx”);

the attachment is a document with textbox created by MS word.
textbox.zip (15.9 KB)

how can i output a document with same effect as textbox.docx with aspose.words

@qingyuan.ni,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 17.10 and have not found the shared issue. Please use Aspose.Words for .NET 17.10. Please check the attached screenshot.
output.png (14.1 KB)

You may also use Shape.Stroke property to define stroke for a shape. Please check following code snippet. Hope this helps you.

shape.Stroke.Color = Color.Black;
shape.Stroke.LineStyle = ShapeLineStyle.Single;
shape.Stroke.Weight = 2;

@tahir.manzoor

not the stroke, please check the attached screenshot, it’s the effect when the textbox activated in MS word

image.png (5.7 KB)

@qingyuan.ni,

Thanks for sharing the detail. The OoxmlSaveOptions.Compliance property specifies the OOXML version for the output document. The default value is Ecma376_2006. Please use the value of this property as OoxmlCompliance.Iso29500_2008_Strict to get the desired output.

var document = new Document();
document.FirstSection.Body.AppendChild(new Paragraph(document));
var shape = new Shape(document, ShapeType.TextBox);
shape.Width = 100;
shape.Height = 50;

shape.Stroke.Color = Color.Black;
shape.Stroke.LineStyle = ShapeLineStyle.Single;
shape.Stroke.Weight = 2;

document.FirstSection.Body.FirstParagraph.AppendChild(shape);
shape.AppendChild(new Paragraph(document));
shape.FirstParagraph.Runs.Add(new Run(document, "Test"));

OoxmlSaveOptions options = new OoxmlSaveOptions();
options.Compliance = OoxmlCompliance.Iso29500_2008_Strict;
document.Save(MyDir + "17.10.docx", options);

thanks a lot, it works!