Java insert WordArt to word document

This article demonstrates how to add WordArt in a Word document in Java applications by using Spire.Doc for Java.

import com.spire.doc.*;
import com.spire.doc.documents.*;
import com.spire.doc.fields.ShapeObject;
import java.awt.*;

public class WordArt{
    public static void main(String[] args) throws Exception {
        //create a Word document.
        Document doc = new Document();

        //add a section
        Section section = doc.addSection();

        //add a paragraph.
        Paragraph paragraph = section.addParagraph();

        //add a shape
        ShapeObject shape = paragraph.appendShape(250, 70, ShapeType.Text_Wave_4);

        //set the position of the shape

        //set the text of WordArt
        shape.getWordArt().setText("Thanks for reading");

        //set the fill color

        //set the border color of the text

        //save the document to file.
        doc.saveToFile("output/wordart.docx", FileFormat.Docx_2013);

Java insert WordArt to word document