TextFrameFormat

Inheritance: java.lang.Object, com.aspose.slides.PVIObject

All Implemented Interfaces: com.aspose.slides.ITextFrameFormat, com.aspose.slides.IChartTextBlockFormat

public final class TextFrameFormat extends PVIObject implements ITextFrameFormat, IChartTextBlockFormat

Contains the TextFrame’s formatTextFrameFormatting properties.

Constructors

ConstructorDescription
TextFrameFormat()Initializes a new instance of TextFrameFormat class.

Methods

MethodDescription
getVersion()
getTextStyle()Returns text’s style.
getThreeDFormat()Returns the ThreeDFormat object that represents 3d effect properties for a text.
getMarginLeft()Returns or sets the left margin (points) in a TextFrame.
setMarginLeft(double value)Returns or sets the left margin (points) in a TextFrame.
getMarginRight()Returns or sets the right margin (points) in a TextFrame.
setMarginRight(double value)Returns or sets the right margin (points) in a TextFrame.
getMarginTop()Returns or sets the top margin (points) in a TextFrame.
setMarginTop(double value)Returns or sets the top margin (points) in a TextFrame.
getMarginBottom()Returns or sets the bottom margin (points) in a TextFrame.
setMarginBottom(double value)Returns or sets the bottom margin (points) in a TextFrame.
getWrapText()True if text is wrapped at TextFrame’s margins.
setWrapText(byte value)True if text is wrapped at TextFrame’s margins.
getAnchoringType()Returns or sets vertical anchor text in a TextFrameEx.
setAnchoringType(byte value)Returns or sets vertical anchor text in a TextFrameEx.
getCenterText()If NullableBool.True then text should be centered in box horizontally.
setCenterText(byte value)If NullableBool.True then text should be centered in box horizontally.
getTextVerticalType()Determines text orientation.
setTextVerticalType(byte value)Determines text orientation.
getAutofitType()Returns or sets text’s autofit mode.
setAutofitType(byte value)Returns or sets text’s autofit mode.
getColumnCount()Returns or sets number of columns in the text area.
setColumnCount(int value)Returns or sets number of columns in the text area.
getColumnSpacing()Returns or sets the space between text columns in the text area (in points).
setColumnSpacing(double value)Returns or sets the space between text columns in the text area (in points).
getRotationAngle()Specifies custom the rotation that is being applied to the text within the bounding box.
setRotationAngle(float value)Specifies custom the rotation that is being applied to the text within the bounding box.
getTransform()Gets or sets text wrapping shape.
setTransform(byte value)Gets or sets text wrapping shape.
getKeepTextFlat()Gets or sets keeping text flat even if a 3-D Rotation effect was applied.
setKeepTextFlat(boolean value)Gets or sets keeping text flat even if a 3-D Rotation effect was applied.
getEffective()Gets effective text frame formatting data with the inheritance applied.

TextFrameFormat()

public TextFrameFormat()

Initializes a new instance of TextFrameFormat class.

getVersion()

public long getVersion()

Version. Read-only long.

Returns: long

getTextStyle()

public final ITextStyle getTextStyle()

Returns text’s style. Read-only ITextStyle.

Returns: ITextStyle

getThreeDFormat()

public final IThreeDFormat getThreeDFormat()

Returns the ThreeDFormat object that represents 3d effect properties for a text. Read-only IThreeDFormat.


Presentation pres = new Presentation();
 try {
     IAutoShape autoShape = pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 10, 20, 400, 300);
     ITextFrame textFrame = autoShape.getTextFrame();
     textFrame.setText("Aspose.Slide Test Text");
     // Set text transformation
     textFrame.getTextFrameFormat().setTransform(TextShapeType.ArchUpPour);
     // Set Extrusion
     textFrame.getTextFrameFormat().getThreeDFormat().getExtrusionColor().setColor(Color.ORANGE);
     textFrame.getTextFrameFormat().getThreeDFormat().setExtrusionHeight(6);
     // Set Contour
     textFrame.getTextFrameFormat().getThreeDFormat().getContourColor().setColor(Color.DARK_GRAY);
     textFrame.getTextFrameFormat().getThreeDFormat().setContourWidth(1.5);
     // Set Depth
     textFrame.getTextFrameFormat().getThreeDFormat().setDepth(3);
     // Set Material
     textFrame.getTextFrameFormat().getThreeDFormat().setMaterial(MaterialPresetType.Plastic);
     // Set Lighting
     textFrame.getTextFrameFormat().getThreeDFormat().getLightRig().setDirection(LightingDirection.Top);
     textFrame.getTextFrameFormat().getThreeDFormat().getLightRig().setLightType(LightRigPresetType.Balanced);
     textFrame.getTextFrameFormat().getThreeDFormat().getLightRig().setRotation(0, 0, 40);
     // Set camera type
     textFrame.getTextFrameFormat().getThreeDFormat().getCamera().setCameraType(CameraPresetType.PerspectiveContrastingRightFacing);
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: IThreeDFormat

getMarginLeft()

public final double getMarginLeft()

Returns or sets the left margin (points) in a TextFrame. Read/write double.

Returns: double

setMarginLeft(double value)

public final void setMarginLeft(double value)

Returns or sets the left margin (points) in a TextFrame. Read/write double.

Parameters:

ParameterTypeDescription
valuedouble

getMarginRight()

public final double getMarginRight()

Returns or sets the right margin (points) in a TextFrame. Read/write double.

Returns: double

setMarginRight(double value)

public final void setMarginRight(double value)

Returns or sets the right margin (points) in a TextFrame. Read/write double.

Parameters:

ParameterTypeDescription
valuedouble

getMarginTop()

public final double getMarginTop()

Returns or sets the top margin (points) in a TextFrame. Read/write double.

Returns: double

setMarginTop(double value)

public final void setMarginTop(double value)

Returns or sets the top margin (points) in a TextFrame. Read/write double.

Parameters:

ParameterTypeDescription
valuedouble

getMarginBottom()

public final double getMarginBottom()

Returns or sets the bottom margin (points) in a TextFrame. Read/write double.

Returns: double

setMarginBottom(double value)

public final void setMarginBottom(double value)

Returns or sets the bottom margin (points) in a TextFrame. Read/write double.

Parameters:

ParameterTypeDescription
valuedouble

getWrapText()

public final byte getWrapText()

True if text is wrapped at TextFrame’s margins. Read/write NullableBool.


The following sample code shows how to wrap text in Presentation.
 
 Presentation pres = new Presentation();
 try {
     ISlide slide = pres.getSlides().get_Item(0);
     IAutoShape autoShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 30, 30, 350, 100);
     Portion portion = new Portion("lorem ipsum...");
     portion.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK);
     portion.getPortionFormat().getFillFormat().setFillType(FillType.Solid);
     autoShape.getTextFrame().getParagraphs().get_Item(0).getPortions().add(portion);
     ITextFrameFormat textFrameFormat = autoShape.getTextFrame().getTextFrameFormat();
     textFrameFormat.setWrapText(NullableBool.True);
     pres.save("Output-presentation.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: byte

setWrapText(byte value)

public final void setWrapText(byte value)

True if text is wrapped at TextFrame’s margins. Read/write NullableBool.


The following sample code shows how to wrap text in Presentation.
 
 Presentation pres = new Presentation();
 try {
     ISlide slide = pres.getSlides().get_Item(0);
     IAutoShape autoShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 30, 30, 350, 100);
     Portion portion = new Portion("lorem ipsum...");
     portion.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK);
     portion.getPortionFormat().getFillFormat().setFillType(FillType.Solid);
     autoShape.getTextFrame().getParagraphs().get_Item(0).getPortions().add(portion);
     ITextFrameFormat textFrameFormat = autoShape.getTextFrame().getTextFrameFormat();
     textFrameFormat.setWrapText(NullableBool.True);
     pres.save("Output-presentation.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

ParameterTypeDescription
valuebyte

getAnchoringType()

public final byte getAnchoringType()

Returns or sets vertical anchor text in a TextFrameEx. Read/write TextAnchorType.

Returns: byte

setAnchoringType(byte value)

public final void setAnchoringType(byte value)

Returns or sets vertical anchor text in a TextFrameEx. Read/write TextAnchorType.

Parameters:

ParameterTypeDescription
valuebyte

getCenterText()

public final byte getCenterText()

If NullableBool.True then text should be centered in box horizontally. Read/write NullableBool.

Returns: byte

setCenterText(byte value)

public final void setCenterText(byte value)

If NullableBool.True then text should be centered in box horizontally. Read/write NullableBool.

Parameters:

ParameterTypeDescription
valuebyte

getTextVerticalType()

public final byte getTextVerticalType()

Determines text orientation. The resulted value of visual text rotation summarized from this property and custom angle in property RotationAngle. Read/write TextVerticalType.

Returns: byte

setTextVerticalType(byte value)

public final void setTextVerticalType(byte value)

Determines text orientation. The resulted value of visual text rotation summarized from this property and custom angle in property RotationAngle. Read/write TextVerticalType.

Parameters:

ParameterTypeDescription
valuebyte

getAutofitType()

public final byte getAutofitType()

Returns or sets text’s autofit mode. Read/write TextAutofitType.


The following sample code shows how to resize shape to Fit Text in a PowerPoint Presentation.
 
 Presentation pres = new Presentation();
 try {
     ISlide slide = pres.getSlides().get_Item(0);
     IAutoShape autoShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 30, 30, 350, 100);
     Portion portion = new Portion("lorem ipsum...");
     portion.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK);
     portion.getPortionFormat().getFillFormat().setFillType(FillType.Solid);
     autoShape.getTextFrame().getParagraphs().get_Item(0).getPortions().add(portion);
     ITextFrameFormat textFrameFormat = autoShape.getTextFrame().getTextFrameFormat();
     textFrameFormat.setAutofitType(TextAutofitType.Shape);
     pres.save("Output-presentation.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }
 
 The following sample code shows how to shrink text on overflow.
 
 Presentation pres = new Presentation();
 try {
     ISlide slide = pres.getSlides().get_Item(0);
     IAutoShape autoShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 30, 30, 350, 100);
     Portion portion = new Portion("lorem ipsum...");
     portion.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK);
     portion.getPortionFormat().getFillFormat().setFillType(FillType.Solid);
     autoShape.getTextFrame().getParagraphs().get_Item(0).getPortions().add(portion);
     ITextFrameFormat textFrameFormat = autoShape.getTextFrame().getTextFrameFormat();
     textFrameFormat.setAutofitType(TextAutofitType.Normal);
     pres.save("Output-presentation.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: byte

setAutofitType(byte value)

public final void setAutofitType(byte value)

Returns or sets text’s autofit mode. Read/write TextAutofitType.


The following sample code shows how to resize shape to Fit Text in a PowerPoint Presentation.
 
 Presentation pres = new Presentation();
 try {
     ISlide slide = pres.getSlides().get_Item(0);
     IAutoShape autoShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 30, 30, 350, 100);
     Portion portion = new Portion("lorem ipsum...");
     portion.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK);
     portion.getPortionFormat().getFillFormat().setFillType(FillType.Solid);
     autoShape.getTextFrame().getParagraphs().get_Item(0).getPortions().add(portion);
     ITextFrameFormat textFrameFormat = autoShape.getTextFrame().getTextFrameFormat();
     textFrameFormat.setAutofitType(TextAutofitType.Shape);
     pres.save("Output-presentation.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }
 
 The following sample code shows how to shrink text on overflow.
 
 Presentation pres = new Presentation();
 try {
     ISlide slide = pres.getSlides().get_Item(0);
     IAutoShape autoShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 30, 30, 350, 100);
     Portion portion = new Portion("lorem ipsum...");
     portion.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK);
     portion.getPortionFormat().getFillFormat().setFillType(FillType.Solid);
     autoShape.getTextFrame().getParagraphs().get_Item(0).getPortions().add(portion);
     ITextFrameFormat textFrameFormat = autoShape.getTextFrame().getTextFrameFormat();
     textFrameFormat.setAutofitType(TextAutofitType.Normal);
     pres.save("Output-presentation.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

ParameterTypeDescription
valuebyte

getColumnCount()

public final int getColumnCount()

Returns or sets number of columns in the text area. This value must be a positive number. Otherwise, the value will be set to zero. Value 0 means undefined value. Read/write int.


The following sample code shows how to add column in Text frame inside a PowerPoint Presentation.
 
 Presentation pres = new Presentation();
 try {
     IAutoShape shape1 = pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 300, 300);
     TextFrameFormat format = (TextFrameFormat)shape1.getTextFrame().getTextFrameFormat();
     format.setColumnCount(2);
     format.setColumnSpacing(20);
     shape1.getTextFrame().setText("All these columns are forced to stay within a single text container -- " +
     "you can add or delete text - and the new or remaining text automatically adjusts " +
     "itself to stay within the container. You cannot have text spill over from one container " +
     "to other, though -- because PowerPoint's column options for text are limited!");
     pres.save("Columns_output.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: int

setColumnCount(int value)

public final void setColumnCount(int value)

Returns or sets number of columns in the text area. This value must be a positive number. Otherwise, the value will be set to zero. Value 0 means undefined value. Read/write int.


The following sample code shows how to add column in Text frame inside a PowerPoint Presentation.
 
 Presentation pres = new Presentation();
 try {
     IAutoShape shape1 = pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 300, 300);
     TextFrameFormat format = (TextFrameFormat)shape1.getTextFrame().getTextFrameFormat();
     format.setColumnCount(2);
     format.setColumnSpacing(20);
     shape1.getTextFrame().setText("All these columns are forced to stay within a single text container -- " +
     "you can add or delete text - and the new or remaining text automatically adjusts " +
     "itself to stay within the container. You cannot have text spill over from one container " +
     "to other, though -- because PowerPoint's column options for text are limited!");
     pres.save("Columns_output.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

ParameterTypeDescription
valueint

getColumnSpacing()

public final double getColumnSpacing()

Returns or sets the space between text columns in the text area (in points). This should only apply when there is more than 1 column present. This value must be a positive number. Otherwise, the value will be set to zero. Read/write double.

Returns: double

setColumnSpacing(double value)

public final void setColumnSpacing(double value)

Returns or sets the space between text columns in the text area (in points). This should only apply when there is more than 1 column present. This value must be a positive number. Otherwise, the value will be set to zero. Read/write double.

Parameters:

ParameterTypeDescription
valuedouble

getRotationAngle()

public final float getRotationAngle()

Specifies custom the rotation that is being applied to the text within the bounding box. If it not specified, the rotation of the accompanying shape is used. If it is specified, then this is applied independently from the shape. That is the shape can have a rotation applied in addition to the text itself having a rotation applied to it. The resulted value of visual text rotation summarized from this property and predefined vertical type in property TextVerticalType. Read/write float.


Consider the case where a shape has a rotation of 90 degrees clockwise applied to it. 
 In addition to this, the text body itself has a rotation of -90 degrees 
 counter-clockwise applied to it. Then the resulting shape would appear to
 be rotated but the text within it would appear as though it had not been rotated at all.

Returns: float

setRotationAngle(float value)

public final void setRotationAngle(float value)

Specifies custom the rotation that is being applied to the text within the bounding box. If it not specified, the rotation of the accompanying shape is used. If it is specified, then this is applied independently from the shape. That is the shape can have a rotation applied in addition to the text itself having a rotation applied to it. The resulted value of visual text rotation summarized from this property and predefined vertical type in property TextVerticalType. Read/write float.


Consider the case where a shape has a rotation of 90 degrees clockwise applied to it. 
 In addition to this, the text body itself has a rotation of -90 degrees 
 counter-clockwise applied to it. Then the resulting shape would appear to
 be rotated but the text within it would appear as though it had not been rotated at all.

Parameters:

ParameterTypeDescription
valuefloat

getTransform()

public final byte getTransform()

Gets or sets text wrapping shape. Read/write TextShapeType.

Returns: byte

setTransform(byte value)

public final void setTransform(byte value)

Gets or sets text wrapping shape. Read/write TextShapeType.

Parameters:

ParameterTypeDescription
valuebyte

getKeepTextFlat()

public final boolean getKeepTextFlat()

Gets or sets keeping text flat even if a 3-D Rotation effect was applied. Read/write boolean.

Returns: boolean

setKeepTextFlat(boolean value)

public final void setKeepTextFlat(boolean value)

Gets or sets keeping text flat even if a 3-D Rotation effect was applied. Read/write boolean.

Parameters:

ParameterTypeDescription
valueboolean

getEffective()

public final ITextFrameFormatEffectiveData getEffective()

Gets effective text frame formatting data with the inheritance applied.


This example demonstrates getting some of effective text frame formatting properties.
 
 Presentation pres = new Presentation("MyPresentation.pptx");
 try
 {
     IAutoShape shape = (IAutoShape)pres.getSlides().get_Item(0).getShapes().get_Item(0);
     ITextFrameFormatEffectiveData effectiveTextFrameFormat = shape.getTextFrame().getTextFrameFormat().getEffective();
    
     System.out.println("Anchoring type: " + effectiveTextFrameFormat.getAnchoringType());
     System.out.println("Autofit type: " + effectiveTextFrameFormat.getAutofitType());
     System.out.println("Text vertical type: " + effectiveTextFrameFormat.getTextVerticalType());
     System.out.println("Margins");
     System.out.println("   Left: " + effectiveTextFrameFormat.getMarginLeft());
     System.out.println("   Top: " + effectiveTextFrameFormat.getMarginTop());
     System.out.println("   Right: " + effectiveTextFrameFormat.getMarginRight());
     System.out.println("   Bottom: " + effectiveTextFrameFormat.getMarginBottom());
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: ITextFrameFormatEffectiveData - A ITextFrameFormatEffectiveData.