Ok, some how got it done using & Text Box & below code; but how do we change font & color?
Dim txtSrNo As IWTextBox = (wordDocument.LastParagraph.AppendTextBox(300, 25))
'Set the alignment positions for text box using TextBoxFormat instance.
txtSrNo.TextBoxFormat.VerticalOrigin = VerticalOrigin.Page
txtSrNo.TextBoxFormat.VerticalPosition = 100
txtSrNo.TextBoxFormat.HorizontalOrigin = HorizontalOrigin.Page
txtSrNo.TextBoxFormat.HorizontalPosition = 100
txtSrNo.TextBoxFormat.TextWrappingStyle = TextWrappingStyle.InFrontOfText
txtSrNo.TextBoxFormat.NoLine = True
'Add the text inside the textbox textbody.
Dim textRange As IWTextRange = txtSrNo.TextBoxBody.AddParagraph().AppendText(x_SerialNo)
Ok, Got it done! Just posting solution in case for someone similar problem
'Add the text box in particular size.
This works well if one Page, but how to do in case of multiple pages :( This code is inserting on the last page.
I need it to insert only on First Page. Please Help.
Best Regards,
' Sets DifferentFirstPage as true for inserting header and footer text. wordDocument.Sections(0).PageSetup.DifferentFirstPage = True ' Inserts the text box in first page header. Dim txtSrNo As IWTextBox = wordDocument.Sections(0).HeadersFooters.FirstPageHeader.AddParagraph().AppendTextBox(240, 25) |
Thanks. It has been resolved.