Aspose::Words::ParagraphFormat class
Contents
[
Hide
]ParagraphFormat class
Represents all the formatting for a paragraph. To learn more, visit the Working with Paragraphs documentation article.
class ParagraphFormat : public Aspose::Words::IBorderAttrSource,
public Aspose::Words::IShadingAttrSource
Methods
| Method | Description |
|---|---|
| ClearFormatting() | Resets to default paragraph formatting. |
| get_AddSpaceBetweenFarEastAndAlpha() | 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. |
| get_AddSpaceBetweenFarEastAndDigit() | 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. |
| get_Alignment() | Gets or sets text alignment for the paragraph. |
| get_BaselineAlignment() | Gets or sets fonts vertical position on a line. |
| get_Bidi() | Gets or sets whether this is a right-to-left paragraph. |
| get_Borders() | Gets collection of borders of the paragraph. |
| get_CharacterUnitFirstLineIndent() | 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. |
| get_CharacterUnitLeftIndent() | Gets or sets the left indent value (in characters) for the specified paragraphs. |
| get_CharacterUnitRightIndent() | Gets or sets the right indent value (in characters) for the specified paragraphs. |
| get_DropCapPosition() | Gets or sets the position for a drop cap text. |
| get_FarEastLineBreakControl() | Gets or sets a flag indicating whether East Asian line-breaking rules are applied to the current paragraph. |
| get_FirstLineIndent() | 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. |
| get_HangingPunctuation() | Gets or sets a flag indicating whether hanging punctuation is enabled for the current paragraph. |
| get_IsHeading() | True when the paragraph style is one of the built-in Heading styles. |
| get_IsListItem() | True when the paragraph is an item in a bulleted or numbered list. |
| get_KeepTogether() | True if all lines in the paragraph are to remain on the same page. |
| get_KeepWithNext() | True if the paragraph is to remains on the same page as the paragraph that follows it. |
| get_LeftIndent() | Gets or sets the value (in points) that represents the left indent for paragraph. |
| get_LineSpacing() | Gets or sets the line spacing (in points) for the paragraph. |
| get_LineSpacingRule() | Gets or sets the line spacing for the paragraph. |
| get_LinesToDrop() | Gets or sets the number of lines of the paragraph text used to calculate the drop cap height. |
| get_LineUnitAfter() | Gets or sets the amount of spacing (in gridlines) after the paragraphs. |
| get_LineUnitBefore() | Gets or sets the amount of spacing (in gridlines) before the paragraphs. |
| get_MirrorIndents() | Gets or sets a flag indicating whether the left and right indents are of the same width. |
| get_NoSpaceBetweenParagraphsOfSameStyle() | When true, SpaceBefore and SpaceAfter will be ignored between the paragraphs of the same style. |
| get_OutlineLevel() | Specifies the outline level of the paragraph in the document. |
| get_PageBreakBefore() | True if a page break is forced before the paragraph. |
| get_RightIndent() | Gets or sets the value (in points) that represents the right indent for paragraph. |
| get_Shading() | Returns a Shading object that refers to the shading formatting for the paragraph. |
| get_SnapToGrid() | Specifies whether the current paragraph should use the document grid lines per page settings when laying out the contents in the paragraph. |
| get_SpaceAfter() | Gets or sets the amount of spacing (in points) after the paragraph. |
| get_SpaceAfterAuto() | True if the amount of spacing after the paragraph is set automatically. |
| get_SpaceBefore() | Gets or sets the amount of spacing (in points) before the paragraph. |
| get_SpaceBeforeAuto() | True if the amount of spacing before the paragraph is set automatically. |
| get_Style() | Gets or sets the paragraph style applied to this formatting. |
| get_StyleIdentifier() | Gets or sets the locale independent style identifier of the paragraph style applied to this formatting. |
| get_StyleName() | Gets or sets the name of the paragraph style applied to this formatting. |
| get_SuppressAutoHyphens() | Specifies whether the current paragraph should be exempted from any hyphenation which is applied in the document settings. |
| get_SuppressLineNumbers() | Specifies whether the current paragraph’s lines should be exempted from line numbering which is applied in the parent section. |
| get_TabStops() | Gets the collection of custom tab stops defined for this object. |
| get_WidowControl() | True if the first and last lines in the paragraph are to remain on the same page as the rest of the paragraph. |
| get_WordWrap() | 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. |
| GetType() const override | |
| Is(const System::TypeInfo&) const override | |
| set_AddSpaceBetweenFarEastAndAlpha(bool) | Setter for Aspose::Words::ParagraphFormat::get_AddSpaceBetweenFarEastAndAlpha. |
| set_AddSpaceBetweenFarEastAndDigit(bool) | Setter for Aspose::Words::ParagraphFormat::get_AddSpaceBetweenFarEastAndDigit. |
| set_Alignment(Aspose::Words::ParagraphAlignment) | Setter for Aspose::Words::ParagraphFormat::get_Alignment. |
| set_BaselineAlignment(Aspose::Words::BaselineAlignment) | Setter for Aspose::Words::ParagraphFormat::get_BaselineAlignment. |
| set_Bidi(bool) | Setter for Aspose::Words::ParagraphFormat::get_Bidi. |
| set_CharacterUnitFirstLineIndent(double) | Setter for Aspose::Words::ParagraphFormat::get_CharacterUnitFirstLineIndent. |
| set_CharacterUnitLeftIndent(double) | Setter for Aspose::Words::ParagraphFormat::get_CharacterUnitLeftIndent. |
| set_CharacterUnitRightIndent(double) | Setter for Aspose::Words::ParagraphFormat::get_CharacterUnitRightIndent. |
| set_DropCapPosition(Aspose::Words::DropCapPosition) | Setter for Aspose::Words::ParagraphFormat::get_DropCapPosition. |
| set_FarEastLineBreakControl(bool) | Setter for Aspose::Words::ParagraphFormat::get_FarEastLineBreakControl. |
| set_FirstLineIndent(double) | Setter for Aspose::Words::ParagraphFormat::get_FirstLineIndent. |
| set_HangingPunctuation(bool) | Setter for Aspose::Words::ParagraphFormat::get_HangingPunctuation. |
| set_KeepTogether(bool) | Setter for Aspose::Words::ParagraphFormat::get_KeepTogether. |
| set_KeepWithNext(bool) | Setter for Aspose::Words::ParagraphFormat::get_KeepWithNext. |
| set_LeftIndent(double) | Setter for Aspose::Words::ParagraphFormat::get_LeftIndent. |
| set_LineSpacing(double) | Setter for Aspose::Words::ParagraphFormat::get_LineSpacing. |
| set_LineSpacingRule(Aspose::Words::LineSpacingRule) | Setter for Aspose::Words::ParagraphFormat::get_LineSpacingRule. |
| set_LinesToDrop(int32_t) | Setter for Aspose::Words::ParagraphFormat::get_LinesToDrop. |
| set_LineUnitAfter(double) | Setter for Aspose::Words::ParagraphFormat::get_LineUnitAfter. |
| set_LineUnitBefore(double) | Setter for Aspose::Words::ParagraphFormat::get_LineUnitBefore. |
| set_MirrorIndents(bool) | Setter for Aspose::Words::ParagraphFormat::get_MirrorIndents. |
| set_NoSpaceBetweenParagraphsOfSameStyle(bool) | Setter for Aspose::Words::ParagraphFormat::get_NoSpaceBetweenParagraphsOfSameStyle. |
| set_OutlineLevel(Aspose::Words::OutlineLevel) | Setter for Aspose::Words::ParagraphFormat::get_OutlineLevel. |
| set_PageBreakBefore(bool) | Setter for Aspose::Words::ParagraphFormat::get_PageBreakBefore. |
| set_RightIndent(double) | Setter for Aspose::Words::ParagraphFormat::get_RightIndent. |
| set_SnapToGrid(bool) | Setter for Aspose::Words::ParagraphFormat::get_SnapToGrid. |
| set_SpaceAfter(double) | Setter for Aspose::Words::ParagraphFormat::get_SpaceAfter. |
| set_SpaceAfterAuto(bool) | Setter for Aspose::Words::ParagraphFormat::get_SpaceAfterAuto. |
| set_SpaceBefore(double) | Setter for Aspose::Words::ParagraphFormat::get_SpaceBefore. |
| set_SpaceBeforeAuto(bool) | Setter for Aspose::Words::ParagraphFormat::get_SpaceBeforeAuto. |
| set_Style(const System::SharedPtr<Aspose::Words::Style>&) | Setter for Aspose::Words::ParagraphFormat::get_Style. |
| set_StyleIdentifier(Aspose::Words::StyleIdentifier) | Setter for Aspose::Words::ParagraphFormat::get_StyleIdentifier. |
| set_StyleName(const System::String&) | Setter for Aspose::Words::ParagraphFormat::get_StyleName. |
| set_SuppressAutoHyphens(bool) | Setter for Aspose::Words::ParagraphFormat::get_SuppressAutoHyphens. |
| set_SuppressLineNumbers(bool) | Setter for Aspose::Words::ParagraphFormat::get_SuppressLineNumbers. |
| set_WidowControl(bool) | Setter for Aspose::Words::ParagraphFormat::get_WidowControl. |
| set_WordWrap(bool) | Setter for Aspose::Words::ParagraphFormat::get_WordWrap. |
| static Type() |
Examples
Shows how to construct an Aspose.Words document by hand.
auto doc = System::MakeObject<Aspose::Words::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.
auto section = System::MakeObject<Aspose::Words::Section>(doc);
doc->AppendChild<System::SharedPtr<Aspose::Words::Section>>(section);
// Set some page setup properties for the section.
section->get_PageSetup()->set_SectionStart(Aspose::Words::SectionStart::NewPage);
section->get_PageSetup()->set_PaperSize(Aspose::Words::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.
auto body = System::MakeObject<Aspose::Words::Body>(doc);
section->AppendChild<System::SharedPtr<Aspose::Words::Body>>(body);
// Create a paragraph, set some formatting properties, and then append it as a child to the body.
auto para = System::MakeObject<Aspose::Words::Paragraph>(doc);
para->get_ParagraphFormat()->set_StyleName(u"Heading 1");
para->get_ParagraphFormat()->set_Alignment(Aspose::Words::ParagraphAlignment::Center);
body->AppendChild<System::SharedPtr<Aspose::Words::Paragraph>>(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.
auto run = System::MakeObject<Aspose::Words::Run>(doc);
run->set_Text(u"Hello World!");
run->get_Font()->set_Color(System::Drawing::Color::get_Red());
para->AppendChild<System::SharedPtr<Aspose::Words::Run>>(run);
ASSERT_EQ(u"Hello World!", doc->GetText().Trim());
doc->Save(get_ArtifactsDir() + u"Section.CreateManually.docx");
See Also
- Namespace Aspose::Words
- Library Aspose.Words for C++