Word GO

WordGO - Making it easier for Java to generate word documents

Background

In traditional Java Word generation, template files are usually created manually and then imported. If you don’t want to create a template and want less code, it’s a good idea to choose Word Go~~

Installation

Manually import the jar package

  • IDEA import: Click File-Project Structure; then find Modules on the left and click; finally, click the green + sign on the right, select JARs or directories and select the jar package to be imported.
  • Eclipse import: right-click “Project” → select Properties, select Java Build Path in the list on the left side of the pop-up dialog box

maven import

  1. <dependency>
  2. <groupId>com.github.qrpcode</groupId>
  3. <artifactId>wordgo</artifactId>
  4. <version>1.0-SNAPSHOT</version>
  5. </dependency>

Environment dependency and compatibility

It can be used as long as it can run java, it does not rely on any third-party Office applications

See the table for compatibility:

我的兼容性

Use

Let’s create a “Hello World” first

  1. WordGo wordGo = new WordGo();
  2. //Create a new word
  3. wordGo.add("Hello World", "font-size: 15; color: #FF0000");
  4. //Fill in the data to view the corresponding function description
  5. wordGo.create("C:\\demo.docx");
  6. //Finally, it can be generated. The parameter is the generation directory, which must have a file name and end with. Docx

Yes, it is very similar to Css, it is easy to use~~

Code support JDK1.5 + (inclusive)

Corresponding function description

(can be learned in 10 minutes)

👉 WordGO Construct and generate files

👉 Set document attribute information

👉 Set paper size and margins

👉 Text, page change related operations

👉 Create, fill, and add tables related operations

👉 Picture related operations

👉 Header and footer related operations

Main project leader

@qrpcode

Join

Yes, I also think the code written by me is a bit (very) messy

Come and help me, just pull request after Fork~

Open source agreement

Apache-2.0 License

(In other words, it can be commercialized, please see the agreement in detail~~)

💖 If you find it useful, remember to star ⭐

PS:Welcome to download and try it out. If you need to apply it to commercial projects, please be sure to test all possible functions in advance to avoid generation deviation.

Feel free to leave a message if you find a bug!