Text Formatting

Applying Shadow Effects on Slide Text

Applying Outer Shadow Effects

Please follow the steps below to apply shadow effects on the text in a PPTX presentation using Aspose.Slides for Java.

  1. Create an instance of Presentation class.
  2. Obtain the reference of a slide by using its Index.
  3. Add an AutoShape of Rectangle type to the slide.
  4. Access the TextFrame associated with the AutoShape.
  5. Set the FillType of the AutoShape to NoFill.
  6. Instantiate OuterShadow class.
  7. Set the BlurRadius of the shadow.
  8. Set the Direction of the shadow.
  9. Set the Distance of the shadow.
  10. Set the RectanglelAlign to TopLeft.
  11. Set the PresetColor of the shadow to Black.
  12. Write the presentation as a PPTX file.

The implementation of the above steps is given below.

Applying Inner Shadow

In order to apply inner shadow. Please follow the steps below:

  1. Create an instance of Presentation class.
  2. Get reference of a slide.
  3. Add an AutoShape of Rectangle type.
  4. Add inner shadow and set all necessary parameters.
  5. Write the presentation as a PPTX file.

In the example given below, we have added a inner shadow.

Set Transparency Property For Text

This article demonstrates how to set transparency property to any text shape using Aspose.Slides for Java. In order to set the transparency to text. Please follow the steps below:

  • Create an instance of Presentation class.
  • Get reference of a slide.
  • Set shadow color
  • Write the presentation as a PPTX file.

The implementation of the above steps is given below.

Managing Text Autofit and Rotation

Setting the AutofitType property of text frame

Aspose.Slides for Java allows developers to set AutofitType property of any text frame. AutofitType could be set to Normal or Shape. If set to Normal then shape will remain the same whereas the text will be adjusted without causing the shape to change itself whereas If AutofitType is set to Shape, then shape will be modified such that only required text is contained in it. To set the AutofitType property of a text frame, please follow the steps below:

  1. Create an instance of Presentation class.
  2. Access the first slide.
  3. Add any shape to the slide.
  4. Access the TextFrame.
  5. Set the AutofitType of the TextFrame.
  6. Save file to disk.

Setting the anchor of TextFrame

Aspose.Slides for Java allows developers to set Anchor of any TextFrame. TextAnchorType specifies that where is that text placed in the shape. TextAnchorType could be set to Top, Center, Bottom, Justified or Distributed. To set Anchor of any TextFrame, please follow the steps below:

  1. Create an instance of Presentation class.
  2. Access the first slide.
  3. Add any shape to the slide.
  4. Access the TextFrame.
  5. Set TextAnchorType of the TextFrame.
  6. Save file to disk.

Rotating the text

Aspose.Slides for Java allows developers to rotate the text. Text could be set to appear as Horizontal, Vertical, Vertical270, WordArtVertical, EastAsianVertical, MongolianVertical or WordArtVerticalRightToLeft. To rotate the text of any TextFrame, please follow the steps below:

  1. Create an instance of Presentation class.
  2. Access the first slide.
  3. Add any Shape to the slide.
  4. Access the TextFrame.
  5. Rotate the text.
  6. Save file to disk

Managing WordArt Properties

Applying Outer Shadow

In order to apply the scheme of any WordArt. Please follow the steps below:

  1. Create an instance of Presentation class.
  2. Get reference of a slide.
  3. Add an AutoShape of Rectangle type.
  4. Enable InnerShadowEffect.
  5. Set all necessary parameters.
  6. Set ColorType as Scheme.
  7. Set Scheme Color.
  8. Write the presentation as a PPTX file.

In the example given below, we have added a connector between two shapes.

Managing Super Script and Sub Script Text

You can add super script and sub script text inside any paragraph portion. For adding Superscript or Subscript text in Aspose.Slides text frame one must use Escapement properties of PortionFormat class.

This property returns or sets the superscript or subscript text (value from -100% (subscript) to 100% (superscript). For example :

  • Create an instance of Presentation class.
  • Obtain the reference of a slide by using its Index.
  • Add an IAutoShape of Rectangle type to the slide.
  • Access the ITextFrame associated with the IAutoShape.
  • Clear existing Paragraphs
  • Create a new paragraph object for holding super script text and add it to the IParagraphs collection of the ITextFrame.
  • Create a new portion object
  • Set Escapement property for portion between 0 to 100 for adding super script. (0 mean no super script)
  • Set some text for Portion and then add that in portion collection of paragraph.
  • Create a new paragraph object for holding sub script text and add it to the IParagraphs collection of the ITextFrame.
  • Create a new portion object
  • Set Escapement property for portion between 0 to -100 for adding super script. (0 mean no sub script)
  • Set some text for Portion and then add that in portion collection of paragraph.
  • Save the presentation as a PPTX file.

The implementation of the above steps is given below.

Setting custom rotation angle for TextFrame

The new method setRotationAngle has been added to IChartTextBlockFormat and ITextFrameFormat interfaces, allows to set the custom rotation angle for TextFrame. In order to set the RotationAngle, Please follow the steps below:

  1. Create an instance of Presentation class.
  2. Add a chart on slide.
  3. Set RotationAngle.
  4. Write the presentation as a PPTX file.

In the example given below, we have set the RotationAngle.

Support to get effects by text-box paragraphs

Aspose.Slides for Java provides support for getting all animation effects applied to paragraphs of text frame (shape). Below is the sample code given.

Highlight Text

New highlightText method has been added to ITextFrame interface and TextFrame class.

It allows to highlight text part with background color using text sample, similar to Text Highlight Color tool in PowerPoint 2019.

The code snippet below shows how to use this feature:

Highlight Text using Regular Expression

 New highlightRegex method has been added to ITextFrame interface and TextFrame class.

It allows to highlight text part with background color using regex, similar to Text Highlight Color tool in PowerPoint 2019.

The code snippet below shows how to use this feature: