How to insert textbox at given position

Hi,to all,
I want to insert one or more textbox at given position in the main document,but it doesn’t work. the code based on VB.net 2008 and aspose.words.dll version 14.2 is as follow:

    Dim doc As New Aspose.Words.Document(filename)
    Dim textbox As New Aspose.Words.Drawing.Shape(doc, Aspose.Words.Drawing.ShapeType.TextBox)

'Dim sp as new shape(doc,NodeType.Textbox) this is error
textbox.Width = 200
textbox.Height = 200
textbox.Left = 100
textbox.Top = 100
Dim paragraph = New Aspose.Words.Paragraph(doc)
paragraph.AppendChild(New Run(doc, Text))
textbox.AppendChild(paragraph)
doc.FirstSection.Body.FirstParagraph.AppendChild(textbox)
textbox.Left = 1024
textbox.Top = 100
paragraph.AppendChild(New Run(doc, Text))
doc.FirstSection.Body.Paragraphs(10).AppendChild(textbox)
doc.Save(dFile)

However, there is no textboxs added. How to implement this objective?

Thanks in advance!

Ducaisoft

@ducaisoft

Thanks for your inquiry. Please ZIP and attach your input, problematic output and expected output documents here for our reference. We will then provide you more information about your query.

Thank you for your reply. Please refer to the demo files for check.
DemoFiles.zip (23.7 KB)
One file is the input file for inserting textbox into its main body.
one file is the correct output file after inserting textbox into its main body.
one file is the incorrect output file after inserting textbox into its main body by aspose.words.dll version 14.2

@ducaisoft

Thanks for sharing the detail. Please use the following code example to get the desired output.

Dim doc As Document = New Aspose.Words.Document((MyDir + "Input File.docx"))
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
Dim textbox As Shape = New Shape(doc, Aspose.Words.Drawing.ShapeType.TextBox)
textbox.Width = 200
textbox.Height = 100
textbox.Left = 100
textbox.Top = 100
Dim paragraph As Paragraph = New Paragraph(doc)
paragraph.AppendChild(New Run(doc, "Text in textbox!"))
textbox.AppendChild(paragraph)
doc.FirstSection.Body.FirstParagraph.AppendChild(textbox)
Dim textbox2 As Shape = CType(textbox.Clone(true),Shape)
textbox2.Left = 100
textbox2.Top = 200
textbox2.Width = 200
textbox2.Height = 100
doc.FirstSection.Body.Paragraphs(10).AppendChild(textbox2)
doc.Save((MyDir + "18.11.docx"))

It works! Thank you very much.