Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Documents.Word Alighting image in header
posted

Just started looking at the Infragistics.Documents.Word stuff to create a word document.

How do I align an image in the header to the right? It aligns fine to the top but only as far as the margin to the right.

Dim doc As Document = New Document()

Dim documentName As String = Application.StartupPath & "\SampleWordDocument.docx"
Dim sec As Section = doc.Sections.Add(para)

' Header
Dim headerPara As Paragraph = sec.HeaderAllPages.ContentBlocks.AddParagraph()
' The header text alignment is set to right
headerPara.Properties.Alignment = ParagraphAlignment.Right

' Get Image
Dim img As Image = Image.FromFile(Application.StartupPath & "\header.png")
' Create an Anchored Image to display in the Header
Dim anchPic As AnchoredPicture = doc.CreateAnchoredPicture(img)

' Display Anchored Image in Header
headerPara.Anchors.AddAnchoredPicture(anchPic)

anchPic.VerticalAlignment = AnchorVerticalAlignment.Top
anchPic.HorizontalAlignment = AnchorHorizontalAlignment.Right