Solusi kita nyedhiyakake API independen platform sing kuat. Gunakake API dokumen Mail merge kanggo ngembangake piranti lunak tingkat dhuwur kanggo platform Java. Iki minangka solusi piranti lunak sing kuat kanggo nggabungake template ing Word format lan PDF lan data saka sumber data khusus lan luwih ngekspor asil menyang DOCX, PDF, HTML lan format populer liyane nggunakake Java.
Java kuat kanggo nggunakake operasi mail merge kanthi cithakan mustache lan data pangguna.
Java SDK iki ngidini sampeyan nggunakake template Mustache adhedhasar sintaks Mustache lan nglakokake operasi mail merge ing cithakan tanpa logika iki kanggo ngisi dokumen karo data saka macem-macem sumber data. Sampeyan bisa ngekspor asil menyang format dokumen sing dibutuhake: DOCX, PDF, HTML lan format populer liyane nggunakake Java.
Mustache minangka sintaks alternatif kanggo cithakan mail merge sing kasusun saka tag. Kanggo nggawe cithakan mustache, gunakake tag sing ditemtokake dening kurung ganda kaya ing ngisor iki:
{{FirstName}}
Ing kasus iki, sampeyan bisa nemokake tag kasebut ing jero cithakan lan ngganti karo nilai sing ditemtokake dening tombol ing njero tag. Iki diarani template tanpa logika amarga ora ana pernyataan if, klausa else, utawa for loop.
Mustache minangka siji-sijine pilihan sing bisa digunakake karo template HTML utawa TXT sing ora ngemot kolom apa wae. Iki tegese karo sawetara format cithakan, kayata cithakan Word, sampeyan bisa nggunakake loro kolom lan sintaks kumis, lan karo liyane, kayata HTML utawa TXT, mung sintaks cithakan kumis.
Sampeyan bisa nyoba solusi kanggo nindakake operasi gabungan mail nganggo cithakan kumis ing Java. Sawise mbukak kode kasebut, ekspor asil gabungan mail nggunakake Java menyang format file sing trep kayata DOCX utawa PDF:
// 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>
Nyalin
// 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')
Nyalin
// 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>
Nyalin
// 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"
Nyalin
import com.aspose.words.*;
String[] fields = new String[]
{
};
Object[] values = new Object[]
{
};
Document doc = new Document("Input.docx");
doc.getMailMerge().setUseNonMergeFields(true);
doc.getMailMerge().execute(fields, values);
doc.save("Output.docx");
Kita dadi tuan rumah paket Java ing repositori Maven. 'Aspose.Words kanggo Java' JAR umum sing ngemot kode byte. Tututi pandhuan langkah demi langkah babagan carane nginstal ing lingkungan pangembang Java.
Java SE 7 Java sing luwih anyar didhukung. Kita uga nyedhiyakake paket kapisah kanggo Java SE 6 yen sampeyan wajib nggunakake JRE ketinggalan jaman iki.
Java kita lintas platform lan mbukak kabeh sistem operasi kanthi JVM, kalebu Microsoft Windows, Linux, macOS, Android lan iOS.
Kanggo informasi babagan katergantungan paket opsional, kayata JogAmp JOGL, Harfbuzz font Java Advanced Imaging JAI, waca Dokumentasi Produk.
Sampeyan bisa nindakake operasi Mail merge kanggo format file liyane: