Gawe Word nggunakake Mail merge ing Java

Pustaka Java kacepetan dhuwur kanggo nglakokake operasi Mail merge kanggo cithakan Word lan data saka sumber data khusus

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.

Ndeleng potongan kode

Mail merge ing Word nggunakake Java

Kanthi API produk, sampeyan bisa nggawe dokumen pribadi nggunakake template Mail merge Word, data saka sumber data khusus lan fitur Mail merge ing Java. Cithakan Mail merge Word minangka dokumen ing Word format kanthi kolom gabungan - kolom khusus sing pengin dilebokake data pribadi saka sumber data.

Sumber data minangka panyimpenan data khusus saka ngendi data ditarik sajrone operasi Mail merge kanggo diganti menyang lapangan template Word sing cocog.

Laporan generasi

Sampeyan bisa nggawe laporan adhedhasar Mail merge Word nggunakake operasi gabungan. Cukup gawe template Word kanthi kolom gabungan sing bisa digunakake kanggo nggawe laporan lan pilih sumber data sampeyan. Sampeyan malah bisa ngasilake laporan saka Excel data yen sampeyan ngumpulake ing kana.

Coba Mail merge kanggo Word file ing Java

Kanggo nyoba fitur Mail merge, muat template Word kanthi kolom gabungan lan isi kolom kasebut liwat antarmuka kita. Sawise mbukak kode, ekspor laporan ing format trep kui nggunakake Java.

Conto ing ngisor iki nuduhake carane nindakake operasi Mail merge ing Java:

Nglakokake operasi Mail merge nggunakake cithakan docx ing Java
Unggah cithakan Mail merge
Kode roto
Pilih format target saka dhaptar
// 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().execute(fields, values);
doc.save("Output.docx");
Kode roto

Carane nggunakake Mail merge ing Word file

  1. Pasang Aspose.Words for Java.
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek Java sampeyan.
  3. Gawe cithakan gabungan Word karo kolom gabungan.
  4. Bukak berkas cithakan ing Java.
  5. Telpon metode execute(), ngliwati kolom gabungan lan nilai-nilai kasebut ing kana.
  6. Nelpon metode Save(), ngliwati jeneng file output kanthi ekstensi sing dibutuhake.
  7. Entuk asil operasi Mail merge minangka Word file.

Pustaka Java kanggo nggunakake Mail merge ing Word

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.

Syarat Sistem

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.

Format file liyane sing didhukung

Sampeyan bisa nindakake operasi Mail merge kanggo format file liyane:

5%

Langganan kanggo Aspose Update Product

Entuk buletin saben wulan lan tawaran langsung dikirim menyang kothak layang.

© Aspose Pty Ltd 2001-2024. Kabeh hak dilindhungi undhang-undhang.