com.aspose.words

Class TextPath

  • java.lang.Object
    • com.aspose.words.TextPath
public class TextPath 
extends java.lang.Object

Defines the text and formatting of the text path (of a WordArt object).

Use the Shape.TextPath property to access WordArt properties of a shape. You do not create instances of the TextPath class directly.

Example:

Shows how to work with WordArt.
public void insertTextPaths() throws Exception {
    Document doc = new Document();

    // Insert a WordArt object and capture the shape that contains it in a variable
    Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);

    // View and verify various text formatting settings
    shape.getTextPath().setBold(true);
    shape.getTextPath().setItalic(true);

    Assert.assertFalse(shape.getTextPath().getUnderline());
    Assert.assertFalse(shape.getTextPath().getShadow());
    Assert.assertFalse(shape.getTextPath().getStrikeThrough());
    Assert.assertFalse(shape.getTextPath().getReverseRows());
    Assert.assertFalse(shape.getTextPath().getXScale());
    Assert.assertFalse(shape.getTextPath().getTrim());
    Assert.assertFalse(shape.getTextPath().getSmallCaps());

    Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
    Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
    Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);

    // Toggle whether or not to display text
    shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
    shape.getTextPath().setOn(true);

    shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
    shape.getTextPath().setOn(false);

    // Apply kerning
    shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
    shape.getTextPath().setKerning(true);

    shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
    shape.getTextPath().setKerning(false);

    // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
    shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
    shape.getTextPath().setSpacing(0.1);

    // Rotate letters 90 degrees to the left, text is still laid out horizontally
    shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
    shape.getTextPath().setRotateLetters(true);

    // Set the x-height to equal the cap height
    shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
    shape.getTextPath().setSameLetterHeights(true);

    // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
    shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
    Assert.assertTrue(shape.getTextPath().getFitShape());
    shape.getTextPath().setSize(24.0);

    // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
    // We can also set TextPathAlignment to align the text
    shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
    shape.getTextPath().setFitShape(false);
    shape.getTextPath().setSize(24.0);
    shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);

    doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
}

/// <summary>
/// Insert a new paragraph with a WordArt shape inside it.
/// </summary>
private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
    // Insert a new paragraph
    Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));

    // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
    // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
    // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
    Shape shape = new Shape(doc, wordArtShapeType);
    shape.setWrapType(WrapType.INLINE);
    para.appendChild(shape);

    // Set the shape's width and height
    shape.setWidth(shapeWidth);
    shape.setHeight(shapeHeight);

    // These color settings will apply to the letters of the displayed WordArt text
    shape.setFillColor(wordArtFill);
    shape.setStrokeColor(line);

    // The WordArt object is accessed here, and we will set the text and font like this
    shape.getTextPath().setText(text);
    shape.getTextPath().setFontFamily(textFontFamily);

    return shape;
}
See Also:
Shape.TextPath

Property Getters/Setters Summary
booleangetBold()
void
setBold(booleanvalue)
           True if the font is formatted as bold.
booleangetFitPath()
void
setFitPath(booleanvalue)
           Defines whether the text fits the path of a shape.
booleangetFitShape()
void
setFitShape(booleanvalue)
           Defines whether the text fits bounding box of a shape.
java.lang.StringgetFontFamily()
void
setFontFamily(java.lang.Stringvalue)
           Defines the family of the textpath font.
booleangetItalic()
void
setItalic(booleanvalue)
           True if the font is formatted as italic.
booleangetKerning()
void
setKerning(booleanvalue)
           Determines whether kerning is turned on.
booleangetOn()
void
setOn(booleanvalue)
           Defines whether the text is displayed.
booleangetReverseRows()
void
setReverseRows(booleanvalue)
           Determines whether the layout order of rows is reversed.
booleangetRotateLetters()
void
setRotateLetters(booleanvalue)
           Determines whether the letters of the text are rotated.
booleangetSameLetterHeights()
void
setSameLetterHeights(booleanvalue)
           Determines whether all letters will be the same height regardless of initial case.
booleangetShadow()
void
setShadow(booleanvalue)
           Defines whether a shadow is applied to the text on a text path.
doublegetSize()
void
setSize(doublevalue)
           Defines the size of the font in points.
booleangetSmallCaps()
void
setSmallCaps(booleanvalue)
           True if the font is formatted as small capital letters.
doublegetSpacing()
void
setSpacing(doublevalue)
           Defines the amount of spacing for text. 1 means 100%.
booleangetStrikeThrough()
void
setStrikeThrough(booleanvalue)
           True if the font is formatted as strikethrough text.
java.lang.StringgetText()
void
setText(java.lang.Stringvalue)
           Defines the text of the text path.
intgetTextPathAlignment()
void
           Defines the alignment of text. The value of the property is TextPathAlignment integer constant.
booleangetTrim()
void
setTrim(booleanvalue)
           Determines whether extra space is removed above and below the text.
booleangetUnderline()
void
setUnderline(booleanvalue)
           True if the font is underlined.
booleangetXScale()
void
setXScale(booleanvalue)
           Determines whether a straight textpath will be used instead of the shape path.
 

    • Property Getters/Setters Detail

      • getBold/setBold

        public boolean getBold() / public void setBold(boolean value)
        
        True if the font is formatted as bold.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getFitPath/setFitPath

        public boolean getFitPath() / public void setFitPath(boolean value)
        
        Defines whether the text fits the path of a shape.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getFitShape/setFitShape

        public boolean getFitShape() / public void setFitShape(boolean value)
        
        Defines whether the text fits bounding box of a shape.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getFontFamily/setFontFamily

        public java.lang.String getFontFamily() / public void setFontFamily(java.lang.String value)
        
        Defines the family of the textpath font.

        The default value is Arial.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getItalic/setItalic

        public boolean getItalic() / public void setItalic(boolean value)
        
        True if the font is formatted as italic.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getKerning/setKerning

        public boolean getKerning() / public void setKerning(boolean value)
        
        Determines whether kerning is turned on.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getOn/setOn

        public boolean getOn() / public void setOn(boolean value)
        
        Defines whether the text is displayed.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getReverseRows/setReverseRows

        public boolean getReverseRows() / public void setReverseRows(boolean value)
        
        Determines whether the layout order of rows is reversed.

        The default value is false.

        If true, the layout order of rows is reversed. This attribute is used for vertical text layout.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getRotateLetters/setRotateLetters

        public boolean getRotateLetters() / public void setRotateLetters(boolean value)
        
        Determines whether the letters of the text are rotated.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getSameLetterHeights/setSameLetterHeights

        public boolean getSameLetterHeights() / public void setSameLetterHeights(boolean value)
        
        Determines whether all letters will be the same height regardless of initial case.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getShadow/setShadow

        public boolean getShadow() / public void setShadow(boolean value)
        
        Defines whether a shadow is applied to the text on a text path.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getSize/setSize

        public double getSize() / public void setSize(double value)
        
        Defines the size of the font in points.

        The default value is 36.

      • getSmallCaps/setSmallCaps

        public boolean getSmallCaps() / public void setSmallCaps(boolean value)
        
        True if the font is formatted as small capital letters.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getSpacing/setSpacing

        public double getSpacing() / public void setSpacing(double value)
        
        Defines the amount of spacing for text. 1 means 100%.

        The default value is 1.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getStrikeThrough/setStrikeThrough

        public boolean getStrikeThrough() / public void setStrikeThrough(boolean value)
        
        True if the font is formatted as strikethrough text.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getText/setText

        public java.lang.String getText() / public void setText(java.lang.String value)
        
        Defines the text of the text path.

        The default value is an empty string.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getTextPathAlignment/setTextPathAlignment

        public int getTextPathAlignment() / public void setTextPathAlignment(int value)
        
        Defines the alignment of text. The value of the property is TextPathAlignment integer constant.

        The default value is TextPathAlignment.CENTER.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getTrim/setTrim

        public boolean getTrim() / public void setTrim(boolean value)
        
        Determines whether extra space is removed above and below the text.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getUnderline/setUnderline

        public boolean getUnderline() / public void setUnderline(boolean value)
        
        True if the font is underlined.

        The default value is false.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }
      • getXScale/setXScale

        public boolean getXScale() / public void setXScale(boolean value)
        
        Determines whether a straight textpath will be used instead of the shape path.

        The default value is false.

        If true, the text runs along a path from left to right along the x value of the lower boundary of the shape.

        Example:

        Shows how to work with WordArt.
        public void insertTextPaths() throws Exception {
            Document doc = new Document();
        
            // Insert a WordArt object and capture the shape that contains it in a variable
            Shape shape = appendWordArt(doc, "Bold & Italic", "Arial", 240.0, 24.0, Color.WHITE, Color.BLACK, ShapeType.TEXT_PLAIN_TEXT);
        
            // View and verify various text formatting settings
            shape.getTextPath().setBold(true);
            shape.getTextPath().setItalic(true);
        
            Assert.assertFalse(shape.getTextPath().getUnderline());
            Assert.assertFalse(shape.getTextPath().getShadow());
            Assert.assertFalse(shape.getTextPath().getStrikeThrough());
            Assert.assertFalse(shape.getTextPath().getReverseRows());
            Assert.assertFalse(shape.getTextPath().getXScale());
            Assert.assertFalse(shape.getTextPath().getTrim());
            Assert.assertFalse(shape.getTextPath().getSmallCaps());
        
            Assert.assertEquals(shape.getTextPath().getSize(), 36.0);
            Assert.assertEquals(shape.getTextPath().getText(), "Bold & Italic");
            Assert.assertEquals(shape.getShapeType(), ShapeType.TEXT_PLAIN_TEXT);
        
            // Toggle whether or not to display text
            shape = appendWordArt(doc, "On set to true", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(true);
        
            shape = appendWordArt(doc, "On set to false", "Calibri", 150.0, 24.0, Color.YELLOW, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setOn(false);
        
            // Apply kerning
            shape = appendWordArt(doc, "Kerning: VAV", "Times New Roman", 90.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(true);
        
            shape = appendWordArt(doc, "No kerning: VAV", "Times New Roman", 100.0, 24.0, Color.ORANGE, Color.RED, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setKerning(false);
        
            // Apply custom spacing, on a scale from 0.0 (none) to 1.0 (default)
            shape = appendWordArt(doc, "Spacing set to 0.1", "Calibri", 120.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_CASCADE_DOWN);
            shape.getTextPath().setSpacing(0.1);
        
            // Rotate letters 90 degrees to the left, text is still laid out horizontally
            shape = appendWordArt(doc, "RotateLetters", "Calibri", 200.0, 36.0, Color.YELLOW, Color.GREEN, ShapeType.TEXT_WAVE);
            shape.getTextPath().setRotateLetters(true);
        
            // Set the x-height to equal the cap height
            shape = appendWordArt(doc, "Same character height for lower and UPPER case", "Calibri", 300.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_SLANT_UP);
            shape.getTextPath().setSameLetterHeights(true);
        
            // By default, the size of the text will scale to always fit the size of the containing shape, overriding the text size setting
            shape = appendWordArt(doc, "FitShape on", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            Assert.assertTrue(shape.getTextPath().getFitShape());
            shape.getTextPath().setSize(24.0);
        
            // If we set FitShape to false, the size of the text will defy the shape bounds and always keep the size value we set below
            // We can also set TextPathAlignment to align the text
            shape = appendWordArt(doc, "FitShape off", "Calibri", 160.0, 24.0, Color.BLUE, Color.BLUE, ShapeType.TEXT_PLAIN_TEXT);
            shape.getTextPath().setFitShape(false);
            shape.getTextPath().setSize(24.0);
            shape.getTextPath().setTextPathAlignment(TextPathAlignment.RIGHT);
        
            doc.save(getArtifactsDir() + "Shape.InsertTextPaths.docx");
        }
        
        /// <summary>
        /// Insert a new paragraph with a WordArt shape inside it.
        /// </summary>
        private Shape appendWordArt(Document doc, String text, String textFontFamily, double shapeWidth, double shapeHeight, Color wordArtFill, Color line, int wordArtShapeType) throws Exception {
            // Insert a new paragraph
            Paragraph para = (Paragraph) doc.getFirstSection().getBody().appendChild(new Paragraph(doc));
        
            // Create an inline Shape, which will serve as a container for our WordArt, and append it to the paragraph
            // The shape can only be a valid WordArt shape if the ShapeType assigned here is a WordArt-designated ShapeType
            // These types will have "WordArt object" in the description and their enumerator names will start with "Text..."
            Shape shape = new Shape(doc, wordArtShapeType);
            shape.setWrapType(WrapType.INLINE);
            para.appendChild(shape);
        
            // Set the shape's width and height
            shape.setWidth(shapeWidth);
            shape.setHeight(shapeHeight);
        
            // These color settings will apply to the letters of the displayed WordArt text
            shape.setFillColor(wordArtFill);
            shape.setStrokeColor(line);
        
            // The WordArt object is accessed here, and we will set the text and font like this
            shape.getTextPath().setText(text);
            shape.getTextPath().setFontFamily(textFontFamily);
        
            return shape;
        }