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
Hello madlan and welcome to our forums!
Please take a look at the following link:
http://help.infragistics.com/Help/NetAdvantage/jQuery/2012.2/CLR4.0/html/Word_Create_a_Word_Document.html.
Could you please review the sample attached to this post and see if it meets your requirements. Please feel free to let me know if I misunderstood you or if you have any other questions.
Hi,
That is the link I used to build my example - unfortunately I cannot see any method to align the image to the right fully. (Must be possible?!)Thanks.
I see what you mean now.
Please try the following code for this:
anchPic.RelativeHorizontalPosition = AnchorRelativeHorizontalPosition.RightMargin;
Please let me know if it helps.
That's the one! :)