Our solution provides a powerful platform independent API. Use our Mail merge document API to develop high-level software for Java platform. This is a powerful software solution for merging templates in Word and PDF formats and data from custom data sources and further exporting the result to DOCX, PDF, HTML and other popular formats using Java.
With our product API, you can create personalized documents using the Mail merge DOCX template, data from a custom data sources and Mail merge feature in Java. Mail merge DOCX template is a document in DOCX format with merge fields – special fields where you want to insert personalized data from your data source.
The data source is a custom data store from which data is pulled during the Mail merge operation to be substituted into appropriate fields of DOCX template.
You can build reports based on Mail merge DOCX using the merge operation. Simply create an DOCX template with merge fields that can be used for report generation and select your data source. You can even generate reports from Excel data if you collect it there.
To try our Mail merge feature, load a DOCX template with merge fields and fill in these fields through our interface. After running the code, export the report in a convenient format generated using Java.
The following example shows how to perform a Mail merge operation in Java:
// Repository path: https://releases.aspose.com/java/repo/
// Maven, where 'ver' - Aspose.Words version number, for example, 24.4.
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>ver</version>
<classifier>jdk17</classifier>
</dependency>
Copy
// Repository path: https://releases.aspose.com/java/repo/
// Gradle, where 'ver' - Aspose.Words version number, for example, 24.4.
compile(group: 'com.aspose', name: 'aspose-words', version: 'ver', classifier: 'jdk17')
Copy
// Repository path: https://releases.aspose.com/java/repo/
// Ivy, where 'ver' - Aspose.Words version number, for example, 24.4.
<dependency org="com.aspose" name="aspose-words" rev="ver">
<artifact name="aspose-words" m:classifier="jdk17" ext="jar"/>
</dependency>
Copy
// Repository path: https://releases.aspose.com/java/repo/
// Sbt, where 'ver' - Aspose.Words version number, for example, 24.4.
libraryDependencies += "com.aspose" % "aspose-words" % "ver"
Copy
import com.aspose.words.*;
String[] fields = new String[]
{
};
Object[] values = new Object[]
{
};
Document doc = new Document("Input.docx");
doc.getMailMerge().execute(fields, values);
doc.save("Output.docx");
We host our Java packages in Maven repositories. 'Aspose.Words for Java' is a common JAR file containing byte-code. Please follow the step-by-step instructions on how to install it to your Java developer environment.
Java SE 7 and more recent Java versions are supported. We also provide a separate package for Java SE 6 in case you are obliged to use this outdated JRE.
Our Java package is cross-platform and runs on all operating systems with JVM implementation, including Microsoft Windows, Linux, macOS, Android and iOS.
For information on optional package dependencies, such as JogAmp JOGL, Harfbuzz font engine, Java Advanced Imaging JAI, please refer to Product Documentation.
You can perform Mail merge operation for other file formats: