ParagraphFormat Class
Represents all the formatting for a paragraph.
Inheritance Hierarchy
SystemObject
  Aspose.WordsParagraphFormat

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
Syntax
public class ParagraphFormat

The ParagraphFormat type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleAddSpaceBetweenFarEastAndAlpha
Gets or sets a flag indicating whether inter-character spacing is automatically adjusted between regions of Latin text and regions of East Asian text in the current paragraph.
Public propertyCode exampleAddSpaceBetweenFarEastAndDigit
Gets or sets a flag indicating whether inter-character spacing is automatically adjusted between regions of numbers and regions of East Asian text in the current paragraph.
Public propertyCode exampleAlignment
Gets or sets text alignment for the paragraph.
Public propertyCode exampleBidi
Gets or sets whether this is a right-to-left paragraph.
Public propertyCode exampleBorders
Gets collection of borders of the paragraph.
Public propertyCode exampleDropCapPosition
Gets or sets the position for a drop cap text.
Public propertyCode exampleFarEastLineBreakControl
Gets or sets a flag indicating whether East Asian line-breaking rules are applied to the current paragraph.
Public propertyCode exampleFirstLineIndent
Gets or sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent.
Public propertyCode exampleHangingPunctuation
Gets or sets a flag indicating whether hanging punctuation is enabled for the current paragraph.
Public propertyCode exampleIsHeading
True when the paragraph style is one of the built-in Heading styles.
Public propertyCode exampleIsListItem
True when the paragraph is an item in a bulleted or numbered list.
Public propertyCode exampleKeepTogether
True if all lines in the paragraph are to remain on the same page.
Public propertyCode exampleKeepWithNext
True if the paragraph is to remains on the same page as the paragraph that follows it.
Public propertyCode exampleLeftIndent
Gets or sets the value (in points) that represents the left indent for paragraph.
Public propertyCode exampleLineSpacing
Gets or sets the line spacing (in points) for the paragraph.
Public propertyCode exampleLineSpacingRule
Gets or sets the line spacing for the paragraph.
Public propertyCode exampleLinesToDrop
Gets or sets the number of lines of the paragraph text used to calculate the drop cap height.
Public propertyCode exampleNoSpaceBetweenParagraphsOfSameStyle
When true, SpaceBefore and SpaceAfter will be ignored between the paragraphs of the same style.
Public propertyCode exampleOutlineLevel
Specifies the outline level of the paragraph in the document.
Public propertyCode examplePageBreakBefore
True if a page break is forced before the paragraph.
Public propertyCode exampleRightIndent
Gets or sets the value (in points) that represents the right indent for paragraph.
Public propertyCode exampleShading
Returns a Shading object that refers to the shading formatting for the paragraph.
Public propertyCode exampleSpaceAfter
Gets or sets the amount of spacing (in points) after the paragraph.
Public propertyCode exampleSpaceAfterAuto
True if the amount of spacing after the paragraph is set automatically.
Public propertyCode exampleSpaceBefore
Gets or sets the amount of spacing (in points) before the paragraph.
Public propertyCode exampleSpaceBeforeAuto
True if the amount of spacing before the paragraph is set automatically.
Public propertyCode exampleStyle
Gets or sets the paragraph style applied to this formatting.
Public propertyCode exampleStyleIdentifier
Gets or sets the locale independent style identifier of the paragraph style applied to this formatting.
Public propertyCode exampleStyleName
Gets or sets the name of the paragraph style applied to this formatting.
Public propertyCode exampleSuppressAutoHyphens
Specifies whether the current paragraph should be exempted from any hyphenation which is applied in the document settings.
Public propertyCode exampleSuppressLineNumbers
Specifies whether the current paragraph's lines should be exempted from line numbering which is applied in the parent section.
Public propertyCode exampleTabStops
Gets the collection of custom tab stops defined for this object.
Public propertyCode exampleWidowControl
True if the first and last lines in the paragraph are to remain on the same page as the rest of the paragraph.
Public propertyCode exampleWordWrap
If this property is false, Latin text in the middle of a word can be wrapped for the current paragraph. Otherwise Latin text is wrapped by whole words.
Methods
  NameDescription
Public methodCode exampleClearFormatting
Resets to default paragraph formatting.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
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