Skip to content

lstypka/templ4docx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

templ4docx - Utility library for filling templates in docx files.

The heart of this library is apache-poi

Thanks to templ4docx you can read the entire content (as simple String) of docx file, you can find all variables, register variables pattern and you can fill docx template file by your own map of variables.

The recommended way to get started using templ4docx in your project is a dependency management system – the snippet below can be copied and pasted into your build.

<dependency>
	<groupId>pl.jsolve</groupId>
	<artifactId>templ4docx</artifactId>
	<version>2.0.0</version>
</dependency>

Direct link to jar file

Example usage

Docx docx = new Docx("template.docx");
docx.setVariablePattern(new VariablePattern("#{", "}"));
    
// preparing variables
Variables variables = new Variables();
variables.addTextVariable(new TextVariable("#{firstname}", "Lukasz"));
variables.addTextVariable(new TextVariable("#{lastname}", "Stypka"));
        
// fill template
docx.fillTemplate(variables);
        
// save filled .docx file
docx.save("lstypka.docx");

More details:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%