Click or drag to resize
ParagraphAlignment Enumeration
Specifies text alignment in a paragraph.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.4
Syntax
public enum ParagraphAlignment
Members
  Member nameValueDescription
Left0 Text is aligned to the left.
Center1 Text is centered horizontally.
Right2 Text is aligned to the right.
Justify3 Text is aligned to both left and right.
Distributed4 Text is evenly distributed.
ArabicMediumKashida5 Arabic only. Kashida length for text is extended to a medium length determined by the consumer.
ArabicHighKashida7 Arabic only. Kashida length for text is extended to its widest possible length.
ArabicLowKashida8 Arabic only. Kashida length for text is extended to a slightly longer length.
ThaiDistributed9 Thai only. Text is justified with an optimization for Thai.
Examples
Creates a simple document from scratch using the Aspose.Words object model.
[C#]

// Create an "empty" document. Note that like in Microsoft Word, 
// the empty document has one section, body and one paragraph in it.
Document doc = new Document();

// This truly makes the document empty. No sections (not possible in Microsoft Word).
doc.RemoveAllChildren();

// Create a new section node. 
// Note that the section has not yet been added to the document, 
// but we have to specify the parent document.
Section section = new Section(doc);

// Append the section to the document.
doc.AppendChild(section);

// Lets set some properties for the section.
section.PageSetup.SectionStart = SectionStart.NewPage;
section.PageSetup.PaperSize = PaperSize.Letter;

// The section that we created is empty, lets populate it. The section needs at least the Body node.
Body body = new Body(doc);
section.AppendChild(body);

// The body needs to have at least one paragraph.
// Note that the paragraph has not yet been added to the document, 
// but we have to specify the parent document.
// The parent document is needed so the paragraph can correctly work
// with styles and other document-wide information.
Paragraph para = new Paragraph(doc);
body.AppendChild(para);

// We can set some formatting for the paragraph
para.ParagraphFormat.StyleName = "Heading 1";
para.ParagraphFormat.Alignment = ParagraphAlignment.Center;

// So far we have one empty paragraph in the document.
// The document is valid and can be saved, but lets add some text before saving.
// Create a new run of text and add it to our paragraph.
Run run = new Run(doc);
run.Text = "Hello World!";
run.Font.Color = Color.Red;
para.AppendChild(run);

// As a matter of interest, you can retrieve text of the whole document and
// see that \x000c is automatically appended. \x000c is the end of section character.
Console.WriteLine("Hello World!\x000c");

// Save the document.
doc.Save(ArtifactsDir + "Section.CreateFromScratch.doc");
See Also