[Java] Add WordArt to Word document

Compared to regular text, WordArt looks more beautiful and interesting, but is designed to be easy to sort out and is often found in magazines and posters. In your daily work, when you edit a Word document, you can make articles stand out and beautify your page layout through WordArt. In this article, I'll show you how to use Free Spire.Doc for Java to add WordArt to your word document and set styles and effects.

** Import JAR package ** ** Method 1: ** After downloading and unzipping Free Spire.Doc for Java, in the lib folder Import the Spire.Doc.jar package into your Java application as a dependency.

** Method 2: ** After installing the JAR package directly from the Maven repository, configure the pom.xml file as follows:

<repositories>
        <repository>
            <id>com.e-iceblue</id>
            <name>e-iceblue</name>
            <url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
        </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc.free</artifactId>
        <version>3.9.0</version>
    </dependency>
</dependencies>

** Add WordArt **

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 section
        Section section = doc.addSection();

        //Add paragraph to section
        Paragraph paragraph = section.addParagraph();

        //Add a shape and set its size and style
        ShapeObject shape = paragraph.appendShape(280, 80, ShapeType.Text_Inflate);

        //Set the position of the shape
        shape.setVerticalPosition(80);
        shape.setHorizontalPosition(100);

        //WordArt text content
        shape.getWordArt().setText("The influence of words");

        //Sets the color of the WordArt fill
        shape.setFillColor(Color.CYAN);
        shape.setStrokeColor(Color.BLACK);

        //Save the document
        doc.saveToFile("WordArt.docx", FileFormat.Docx_2013);
    }
}

** Add WordArt effects ** art.jpg

Recommended Posts

[Java] Add WordArt to Word document
Add multi-letter watermark to Java Word
Add watermark to Java to PDF document
How to print a Java Word document
Add footnotes to Word documents in Java
Java creates a Word document
Java (add2)
Java (add)
Add / remove watermark to Java PowerPoint
[Java] Realize multi-column effect of Word document
Java creates a table in a Word document
Add SameSite attribute to cookie in Java
[Java] Introduction to Java
Introduction to java
Java 11 document summary
[Java] Add quotes only to specific CSV columns
[Java] Article to add validation with Spring Boot 2.3.1.
Add files to jar files
Changes from Java 8 to Java 11
Sum from Java_1 to 100
Java compressed PDF document
[Java] Connect to MySQL
PKIX path building failed: Add SSL certificate to java
Use Maven to add your favorite Java library to your environment.
Kotlin's improvements to Java
Java applications convert Word (DOC / DOCX) documents to PDF
[Java] Initialize, add, get
Merge Java Word documents
From Java to Ruby !!
[Java] [XML signature] Add prefix and ID to Signature tag
Introduction to java command
java: Add date [Note]
Java reserved word summary
How to lower java version
[Java] How to use Map
Convert Java Powerpoint to XPS
Java adds table to PDF
Java to play with Function
Java --How to make JTable
How to add ActionText function
How to use java Optional
New features from Java7 to Java8
How to minimize Java images
How to write java comments
How to use java class
Output javadoc to word file
Connect from Java to PostgreSQL
[Java] How to display Wingdings
[Java] Introduction to lambda expressions
4 Add println to the interpreter
[Java] How to use string.format
Shell to kill Java process
How to use Java Map
How to set Java constants
Connect to DB with Java
Connect to MySQL 8 with Java
[java] Reasons to use static
Java creates an Excel document
[Rails] Add column to devise
How to use Java variables
[Java] Introduction to Stream API