ParagraphAlignment enumeration

ParagraphAlignment enumeration

Specifies text alignment in a paragraph.


LEFTText is aligned to the left.
CENTERText is centered horizontally.
RIGHTText is aligned to the right.
JUSTIFYText is aligned to both left and right.
DISTRIBUTEDText is evenly distributed.
ARABIC_MEDIUM_KASHIDAArabic only. Kashida length for text is extended to a medium length determined by the consumer.
ARABIC_HIGH_KASHIDAArabic only. Kashida length for text is extended to its widest possible length.
ARABIC_LOW_KASHIDAArabic only. Kashida length for text is extended to a slightly longer length.
THAI_DISTRIBUTEDThai only. Text is justified with an optimization for Thai.
MATH_ELEMENT_CENTER_AS_GROUPThe only Math element in a line, aligned as ‘Centered As Group’.


Shows how to construct an Aspose.Words document by hand.

doc = aw.Document()
# A blank document contains one section, one body and one paragraph.
# Call the "RemoveAllChildren" method to remove all those nodes,
# and end up with a document node with no children.
# This document now has no composite child nodes that we can add content to.
# If we wish to edit it, we will need to repopulate its node collection.
# First, create a new section, and then append it as a child to the root document node.
section = aw.Section(doc)
# Set some page setup properties for the section.
section.page_setup.section_start = aw.SectionStart.NEW_PAGE
section.page_setup.paper_size = aw.PaperSize.LETTER
# A section needs a body, which will contain and display all its contents
# on the page between the section's header and footer.
body = aw.Body(doc)
# Create a paragraph, set some formatting properties, and then append it as a child to the body.
para = aw.Paragraph(doc)
para.paragraph_format.style_name = 'Heading 1'
para.paragraph_format.alignment = aw.ParagraphAlignment.CENTER
# Finally, add some content to do the document. Create a run,
# set its appearance and contents, and then append it as a child to the paragraph.
run = aw.Run(doc=doc)
run.text = 'Hello World!'
run.font.color =
self.assertEqual('Hello World!', doc.get_text().strip()) + 'Section.CreateManually.docx')

See Also