ParagraphFormat Class

Represents all the formatting for a paragraph.

ExpandedInheritance Hierarchy

SystemObject
  Aspose.WordsParagraphFormat

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 21.5.0

ExpandedSyntax

public class ParagraphFormat

The ParagraphFormat type exposes the following members.

ExpandedProperties

  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 exampleCharacterUnitFirstLineIndent
Gets or sets the value (in characters) for the first-line or hanging indent.

Use positive values to set the first-line indent, and negative values to set the hanging indent.

Public propertyCode exampleCharacterUnitLeftIndent
Gets or sets the left indent value (in characters) for the specified paragraphs.
Public propertyCode exampleCharacterUnitRightIndent
Gets or sets the right indent value (in characters) for the specified paragraphs.
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 positive values to set the first-line indent, and negative values to set the 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 exampleLineUnitAfter
Gets or sets the amount of spacing (in gridlines) after the paragraphs.
Public propertyCode exampleLineUnitBefore
Gets or sets the amount of spacing (in gridlines) before the paragraphs.
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 exampleSnapToGrid
Specifies whether the current paragraph should use the document grid lines per page settings when laying out the contents in 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.

ExpandedMethods

  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.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

ExpandedExamples

Shows how to construct an Aspose.Words document by hand.
Document doc = new 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.
doc.RemoveAllChildren();

// 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 section = new Section(doc);
doc.AppendChild(section);

// Set some page setup properties for the section.
section.PageSetup.SectionStart = SectionStart.NewPage;
section.PageSetup.PaperSize = 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 body = new Body(doc);
section.AppendChild(body);

// Create a paragraph, set some formatting properties, and then append it as a child to the body.
Paragraph para = new Paragraph(doc);

para.ParagraphFormat.StyleName = "Heading 1";
para.ParagraphFormat.Alignment = ParagraphAlignment.Center;

body.AppendChild(para);

// 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 run = new Run(doc);
run.Text = "Hello World!";
run.Font.Color = Color.Red;
para.AppendChild(run);

Assert.AreEqual("Hello World!", doc.GetText().Trim());

doc.Save(ArtifactsDir + "Section.CreateManually.docx");

ExpandedSee Also