We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to right justify output of this code

I’m adding a footer and inserting text with the following code:

Dim footer As New HeaderFooter(doc, HeaderFooterType.FooterPrimary)
doc.FirstSection.HeadersFooters.Add(footer)
Dim para As New Paragraph(doc)
footer.Paragraphs.Add(para)
Dim run As New Run(doc, “[some text]”)
para.Runs.Add(run)

I have two questions:

1) How can I right justify this inside the footer?
2) Is there anyway to reduce the amount of code above? Seems like too much code just to insert a footer and some text.

Thanks!

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. In your case you should use ParagraphAlignment property, please see the following link for more information:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.paragraphalignment.html

Regarding the code, you should note that MS Word document consists of Sections, each Section can have three types of Headers/Footers – First Page, Primary and Even Pages. Please see the following link to learn more about Aspose.Words Document Object Model (DOM) and its relationships.

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose-words-document-object-model.html

Please let me know in case of any issues I will be glad to help you.

Best regards,