Hi Jeevan,
Thanks for your inquiry.
Sure, using the Shape class you can create or modify shapes in a Microsoft Word document. A Shape represents an object in the drawing layer, such as an AutoShape, textbox, freeform, OLE object, ActiveX control, or picture. You can place a floating Shape anywahere inside the page. For example, the following code layout an image at the centre of first page:
Dim doc As New Document()
Dim builder As New DocumentBuilder(doc)
Dim shape As Shape = builder.InsertImage("C:\Temp\Aspose Logo.png")
shape.WrapType = WrapType.None
shape.BehindText = True
shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page
shape.HorizontalAlignment = Aspose.Words.Drawing.HorizontalAlignment.Center
shape.RelativeVerticalPosition = RelativeVerticalPosition.Page
shape.VerticalAlignment = VerticalAlignment.Center
doc.Save("c:\temp\out.docx")
Similarly, you can use the following code snippet to insert a TextBox Shape in your document:
Dim doc As New Document()
Dim textBox As New Shape(doc, ShapeType.TextBox)
textBox.WrapType = WrapType.None
textBox.HorizontalAlignment = Aspose.Words.Drawing.HorizontalAlignment.Center
textBox.VerticalAlignment = VerticalAlignment.Top
textBox.Height = 50
textBox.Width = 200
textBox.ZOrder = 2
textBox.AppendChild(New Paragraph(doc))
Dim para As Paragraph = textBox.FirstParagraph
para.ParagraphFormat.Alignment = ParagraphAlignment.Center
Dim run As New Run(doc)
run.Text = "Content in textbox"
para.AppendChild(run)
doc.FirstSection.Body.FirstParagraph.AppendChild(textBox)
doc.Save("C:\Temp\out.docx")
You should also not that there is no page concept in Microsoft Word documents; pages are created by Microsoft Word on the fly. In your case, to be able to keep different margin settings for the first page to those specified for the rest of the pages in your document, you need to add two Sections in your document such that the first Section contains the content of your first page and the second Section contains the content for the remaining pages. You can then use Section.PageSetup class to set margins as follows:
Dim doc As New Document()
Dim firstPageSetup As PageSetup = doc.FirstSection.PageSetup
Dim otherPagesSetup As PageSetup = doc.LastSection.PageSetup
firstPageSetup.LeftMargin = ConvertUtil.InchToPoint(1.25)
firstPageSetup.RightMargin = 0
otherPagesSetup.LeftMargin = ConvertUtil.InchToPoint(1.25)
otherPagesSetup.RightMargin = ConvertUtil.InchToPoint(1.25)
Moreover, to be able to insert dynamic data into your document, I would suggest you visit the following link to learn about the Mail Merge capabilities of Aspose.Words:
https://docs.aspose.com/words/net/mail-merge-and-reporting/
If we can help you with anything else, please feel free to ask.
Best regards,