WordArtをWord文書に追加する
5469 ワード
普通のテキストと比較して、WordArtはより創造的で装飾的です、それはしばしば美しく設計された雑誌またはポスターで使われます.この記事では、無料の尖塔を使用してWord文書にWordArtを追加する方法を紹介します.Java用のドキュメント.
インストール
方法1 : Free Spire.Doc for Javaをダウンロードして解凍します.その後、尖塔を追加します.doc.Javaファイルに依存するjarファイル.
方法2 : MavenプロジェクトにJAR依存を追加するには、POMに次の構成を追加します.XML
インストール
方法1 : Free Spire.Doc for Javaをダウンロードして解凍します.その後、尖塔を追加します.doc.Javaファイルに依存するjarファイル.
方法2 : MavenプロジェクトにJAR依存を追加するには、POMに次の構成を追加します.XML
<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>2.7.3</version>
</dependency>
</dependencies>
ワードアートを追加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
shape.setVerticalPosition(80);
shape.setHorizontalPosition(100);
//Set the text of WordArt
shape.getWordArt().setText("Thanks for reading");
//Set the fill color
shape.setFillColor(Color.CYAN);
//Set the border color of the text
shape.setStrokeColor(Color.BLACK);
//Save the document
doc.saveToFile("WordArt.docx", FileFormat.Docx_2013);
}
}
Reference
この問題について(WordArtをWord文書に追加する), 我々は、より多くの情報をここで見つけました https://dev.to/codesharing/java-add-wordart-to-word-document-4o11テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol