public final class ParagraphFormat extends PVIObject implements IParagraphFormat, IChartParagraphFormat
This class contains the paragraph formatting properties. Unlike IParagraphFormatEffectiveData, all properties of this class are writeable.
This class is used to return and manipulate paragraph formatting properties defined for the particular paragraph. This means that no inheritance is applied when getting values so for the majority of cases you will get values meaning "undefined".
In order to get the effective formatting parameter values including inherited you need to use getEffective() method
which returns a IParagraphFormatEffectiveData instance.
| Constructor and Description |
|---|
ParagraphFormat()
Initializes a new instance of
ParagraphFormat class. |
| Modifier and Type | Method and Description |
|---|---|
int |
getAlignment()
Returns or sets the text alignment in a paragraph with no inheritance.
|
IBulletFormat |
getBullet()
Returns bullet format of the paragraph.
|
IPortionFormat |
getDefaultPortionFormat()
Returns default portion format of a paragraph.
|
float |
getDefaultTabSize()
Returns or sets default tabulation size with no inheritance.
|
short |
getDepth()
Returns or sets depth of the paragraph.
|
byte |
getEastAsianLineBreak()
Determines whether the East Asian line break is used in a paragraph.
|
IParagraphFormatEffectiveData |
getEffective()
Gets effective paragraph formatting data with the inheritance applied.
|
int |
getFontAlignment()
Returns or sets a font alignment in a paragraph with no inheritance.
|
byte |
getHangingPunctuation()
Determines whether the hanging punctuation is used in a paragraph.
|
float |
getIndent()
Returns or sets paragraph First Line Indent/Hanging Indent with no inheritance.
|
byte |
getLatinLineBreak()
Determines whether the Latin line break is used in a paragraph.
|
float |
getMarginLeft()
Returns or sets the left margin in a paragraph with no inheritance.
|
float |
getMarginRight()
Returns or sets the right margin in a paragraph with no inheritance.
|
byte |
getRightToLeft()
Determines whether the Right to Left writing is used in a paragraph.
|
float |
getSpaceAfter()
Returns or sets the amount of space after the last line in a paragraph with no inheritance.
|
float |
getSpaceBefore()
Returns or sets the amount of space before the first line in a paragraph with no inheritance.
|
float |
getSpaceWithin()
Returns or sets the amount of space between base lines in a paragraph.
|
ITabCollection |
getTabs()
Returns tabulations of a paragraph.
|
long |
getVersion()
Version.
|
void |
setAlignment(int value)
Returns or sets the text alignment in a paragraph with no inheritance.
|
void |
setDefaultTabSize(float value)
Returns or sets default tabulation size with no inheritance.
|
void |
setDepth(short value)
Returns or sets depth of the paragraph.
|
void |
setEastAsianLineBreak(byte value)
Determines whether the East Asian line break is used in a paragraph.
|
void |
setFontAlignment(int value)
Returns or sets a font alignment in a paragraph with no inheritance.
|
void |
setHangingPunctuation(byte value)
Determines whether the hanging punctuation is used in a paragraph.
|
void |
setIndent(float value)
Returns or sets paragraph First Line Indent/Hanging Indent with no inheritance.
|
void |
setLatinLineBreak(byte value)
Determines whether the Latin line break is used in a paragraph.
|
void |
setMarginLeft(float value)
Returns or sets the left margin in a paragraph with no inheritance.
|
void |
setMarginRight(float value)
Returns or sets the right margin in a paragraph with no inheritance.
|
void |
setRightToLeft(byte value)
Determines whether the Right to Left writing is used in a paragraph.
|
void |
setSpaceAfter(float value)
Returns or sets the amount of space after the last line in a paragraph with no inheritance.
|
void |
setSpaceBefore(float value)
Returns or sets the amount of space before the first line in a paragraph with no inheritance.
|
void |
setSpaceWithin(float value)
Returns or sets the amount of space between base lines in a paragraph.
|
equals, getParent_Immediate, getParent_IPresentationComponent, getParent_ISlideComponent, getPresentation, getSlide, hashCodepublic ParagraphFormat()
Initializes a new instance of ParagraphFormat class.
public final IBulletFormat getBullet()
Returns bullet format of the paragraph.
Read-only IBulletFormat.
getBullet in interface IParagraphFormatpublic final short getDepth()
Returns or sets depth of the paragraph.
Value 0 means undefined value.
Read/write short.
getDepth in interface IParagraphFormatpublic final void setDepth(short value)
Returns or sets depth of the paragraph.
Value 0 means undefined value.
Read/write short.
setDepth in interface IParagraphFormatpublic final int getAlignment()
Returns or sets the text alignment in a paragraph with no inheritance.
Read/write TextAlignment.
The following sample code shows how to Align Text Paragraphs in PowerPoint Presentation.// Instantiate a Presentation object that represents a PPTX file Presentation pres = new Presentation("ParagraphsAlignment.pptx"); try { // Accessing first slide ISlide slide = pres.getSlides().get_Item(0); // Accessing the first and second placeholder in the slide and typecasting it as AutoShape ITextFrame tf1 = ((IAutoShape)slide.getShapes().get_Item(0)).getTextFrame(); ITextFrame tf2 = ((IAutoShape)slide.getShapes().get_Item(1)).getTextFrame(); // Change the text in both placeholders tf1.setText("Center Align by Aspose"); tf2.setText("Center Align by Aspose"); // Getting the first paragraph of the placeholders IParagraph para1 = tf1.getParagraphs().get_Item(0); IParagraph para2 = tf2.getParagraphs().get_Item(0); // Aligning the text paragraph to center para1.getParagraphFormat().setAlignment(TextAlignment.Center); para2.getParagraphFormat().setAlignment(TextAlignment.Center); //Writing the presentation as a PPTX file pres.save("Centeralign_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
getAlignment in interface IChartParagraphFormatgetAlignment in interface IParagraphFormatpublic final void setAlignment(int value)
Returns or sets the text alignment in a paragraph with no inheritance.
Read/write TextAlignment.
The following sample code shows how to Align Text Paragraphs in PowerPoint Presentation.// Instantiate a Presentation object that represents a PPTX file Presentation pres = new Presentation("ParagraphsAlignment.pptx"); try { // Accessing first slide ISlide slide = pres.getSlides().get_Item(0); // Accessing the first and second placeholder in the slide and typecasting it as AutoShape ITextFrame tf1 = ((IAutoShape)slide.getShapes().get_Item(0)).getTextFrame(); ITextFrame tf2 = ((IAutoShape)slide.getShapes().get_Item(1)).getTextFrame(); // Change the text in both placeholders tf1.setText("Center Align by Aspose"); tf2.setText("Center Align by Aspose"); // Getting the first paragraph of the placeholders IParagraph para1 = tf1.getParagraphs().get_Item(0); IParagraph para2 = tf2.getParagraphs().get_Item(0); // Aligning the text paragraph to center para1.getParagraphFormat().setAlignment(TextAlignment.Center); para2.getParagraphFormat().setAlignment(TextAlignment.Center); //Writing the presentation as a PPTX file pres.save("Centeralign_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
setAlignment in interface IChartParagraphFormatsetAlignment in interface IParagraphFormatpublic final float getSpaceWithin()
Returns or sets the amount of space between base lines in a paragraph. Positive value means percentage, negative - size in points. No inheritance applied.
Read/write float.
getSpaceWithin in interface IChartParagraphFormatgetSpaceWithin in interface IParagraphFormatpublic final void setSpaceWithin(float value)
Returns or sets the amount of space between base lines in a paragraph. Positive value means percentage, negative - size in points. No inheritance applied.
Read/write float.
setSpaceWithin in interface IChartParagraphFormatsetSpaceWithin in interface IParagraphFormatpublic final float getSpaceBefore()
Returns or sets the amount of space before the first line in a paragraph with no inheritance.
A positive value specifies the percentage of the font size that the white space should be.
A negative value specifies the size of the white space in point size.
Read/write float.
getSpaceBefore in interface IChartParagraphFormatgetSpaceBefore in interface IParagraphFormatpublic final void setSpaceBefore(float value)
Returns or sets the amount of space before the first line in a paragraph with no inheritance.
A positive value specifies the percentage of the font size that the white space should be.
A negative value specifies the size of the white space in point size.
Read/write float.
setSpaceBefore in interface IChartParagraphFormatsetSpaceBefore in interface IParagraphFormatpublic final float getSpaceAfter()
Returns or sets the amount of space after the last line in a paragraph with no inheritance.
A positive value specifies the percentage of the font size that the white space should be.
A negative value specifies the size of the white space in point size.
Read/write float.
getSpaceAfter in interface IChartParagraphFormatgetSpaceAfter in interface IParagraphFormatpublic final void setSpaceAfter(float value)
Returns or sets the amount of space after the last line in a paragraph with no inheritance.
A positive value specifies the percentage of the font size that the white space should be.
A negative value specifies the size of the white space in point size.
Read/write float.
setSpaceAfter in interface IChartParagraphFormatsetSpaceAfter in interface IParagraphFormatpublic final byte getEastAsianLineBreak()
Determines whether the East Asian line break is used in a paragraph. No inheritance applied.
Read/write NullableBool.
getEastAsianLineBreak in interface IChartParagraphFormatgetEastAsianLineBreak in interface IParagraphFormatpublic final void setEastAsianLineBreak(byte value)
Determines whether the East Asian line break is used in a paragraph. No inheritance applied.
Read/write NullableBool.
setEastAsianLineBreak in interface IChartParagraphFormatsetEastAsianLineBreak in interface IParagraphFormatpublic final byte getRightToLeft()
Determines whether the Right to Left writing is used in a paragraph. No inheritance applied.
Read/write NullableBool.
getRightToLeft in interface IChartParagraphFormatgetRightToLeft in interface IParagraphFormatpublic final void setRightToLeft(byte value)
Determines whether the Right to Left writing is used in a paragraph. No inheritance applied.
Read/write NullableBool.
setRightToLeft in interface IChartParagraphFormatsetRightToLeft in interface IParagraphFormatpublic final byte getLatinLineBreak()
Determines whether the Latin line break is used in a paragraph. No inheritance applied.
Read/write NullableBool.
getLatinLineBreak in interface IChartParagraphFormatgetLatinLineBreak in interface IParagraphFormatpublic final void setLatinLineBreak(byte value)
Determines whether the Latin line break is used in a paragraph. No inheritance applied.
Read/write NullableBool.
setLatinLineBreak in interface IChartParagraphFormatsetLatinLineBreak in interface IParagraphFormatpublic final byte getHangingPunctuation()
Determines whether the hanging punctuation is used in a paragraph. No inheritance applied.
Read/write NullableBool.
getHangingPunctuation in interface IChartParagraphFormatgetHangingPunctuation in interface IParagraphFormatpublic final void setHangingPunctuation(byte value)
Determines whether the hanging punctuation is used in a paragraph. No inheritance applied.
Read/write NullableBool.
setHangingPunctuation in interface IChartParagraphFormatsetHangingPunctuation in interface IParagraphFormatpublic final float getMarginLeft()
Returns or sets the left margin in a paragraph with no inheritance.
Read/write float.
getMarginLeft in interface IChartParagraphFormatgetMarginLeft in interface IParagraphFormatpublic final void setMarginLeft(float value)
Returns or sets the left margin in a paragraph with no inheritance.
Read/write float.
setMarginLeft in interface IChartParagraphFormatsetMarginLeft in interface IParagraphFormatpublic final float getMarginRight()
Returns or sets the right margin in a paragraph with no inheritance.
Read/write float.
getMarginRight in interface IChartParagraphFormatgetMarginRight in interface IParagraphFormatpublic final void setMarginRight(float value)
Returns or sets the right margin in a paragraph with no inheritance.
Read/write float.
setMarginRight in interface IChartParagraphFormatsetMarginRight in interface IParagraphFormatpublic final float getIndent()
Returns or sets paragraph First Line Indent/Hanging Indent with no inheritance. Hanging Indent can be defined with negative values.
Read/write float.
getIndent in interface IChartParagraphFormatgetIndent in interface IParagraphFormatpublic final void setIndent(float value)
Returns or sets paragraph First Line Indent/Hanging Indent with no inheritance. Hanging Indent can be defined with negative values.
Read/write float.
setIndent in interface IChartParagraphFormatsetIndent in interface IParagraphFormatpublic final float getDefaultTabSize()
Returns or sets default tabulation size with no inheritance.
Read/write float.
getDefaultTabSize in interface IChartParagraphFormatgetDefaultTabSize in interface IParagraphFormatpublic final void setDefaultTabSize(float value)
Returns or sets default tabulation size with no inheritance.
Read/write float.
setDefaultTabSize in interface IChartParagraphFormatsetDefaultTabSize in interface IParagraphFormatpublic final ITabCollection getTabs()
Returns tabulations of a paragraph. No inheritance applied.
Read-only ITabCollection.
getTabs in interface IChartParagraphFormatgetTabs in interface IParagraphFormatpublic final int getFontAlignment()
Returns or sets a font alignment in a paragraph with no inheritance.
Read/write FontAlignment.
getFontAlignment in interface IChartParagraphFormatgetFontAlignment in interface IParagraphFormatpublic final void setFontAlignment(int value)
Returns or sets a font alignment in a paragraph with no inheritance.
Read/write FontAlignment.
setFontAlignment in interface IChartParagraphFormatsetFontAlignment in interface IParagraphFormatpublic final IPortionFormat getDefaultPortionFormat()
Returns default portion format of a paragraph. No inheritance applied.
Read-only IPortionFormat.
getDefaultPortionFormat in interface IParagraphFormatpublic final IParagraphFormatEffectiveData getEffective()
Gets effective paragraph formatting data with the inheritance applied.
This example demonstrates getting some effective paragraph format properties.Presentation pres = new Presentation("MyPresentation.pptx"); try { IAutoShape shape = (IAutoShape)pres.getSlides().get_Item(0).getShapes().get_Item(0); IParagraphFormatEffectiveData effectiveParagraphFormat = shape.getTextFrame().getParagraphs().get_Item(0).getParagraphFormat().getEffective(); System.out.println("Text alignment: " + effectiveParagraphFormat.getAlignment()); System.out.println("Indent: " + effectiveParagraphFormat.getIndent()); System.out.println("Bullet type: " + effectiveParagraphFormat.getBullet().getType()); } finally { if (pres != null) pres.dispose(); }
getEffective in interface IParagraphFormatIParagraphFormatEffectiveData.public long getVersion()
Version.
Read-only long.
getVersion in class PVIObjectCopyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.