Problem with Data Source Java

Hi,



I need to open a word file (.dotx or .docx), with a different datasouce to the original, to use as a template, using the combined fields.
I do it with this code

File st = new File(“C:\TEST\TEST03.docx”);
File st1 = new File(“C:\TEST\TEST04.docx”);
st.createNewFile();
st1.createNewFile();
Document doc = new Document(“C:\TEST\TEST03.docx”);
//cnnect
nom_doc = getItem(ITEMS.nomdoc).getValue();
String url = “xxxxxxxxxxxx”;
String user = “_xxxxxx”;
String password = “xxxx”;
Connection conn;
conn = DriverManager.getConnection(url,user,password);
Statement stmt = conn.createStatement();
ResultSet rs ;

DataSet pizzaDs = new DataSet();
DataTable tvorlage = new DataTable(stmt.executeQuery(“select v_label FROM _SYSTEM.tvorlage WHERE v_nomdoc = '” + nom_doc + "’ ORDER BY v_label ASC "), “tvorlage”);
pizzaDs.getTables().add(tvorlage);
// Execute nested mail merge with regions
doc.getMailMerge().executeWithRegions(pizzaDs);
doc.save(“C:\TEST\TEST04.docx”);





The file generates it to me, but it appears empty, without the option of being able to use the combined fields in the template.
What is wrong?
Thank you very much for the help.

Albert


Hi Albert,


Thanks for your inquiry. We will appreciate it if you please share your sample input,output and expected document here as well. It will help us to understand your issue exactly and address it accordingly.

Best Regards,

Hi Tilal


Thank you very much for the reply
Both documents (destination and source) are two blank docx documents.
I add them in copy

Thanks again.


Albert

HI Tilal



In case it helps, I send you a screen of what should be the final result when opening the target document.

Thank you !!

Hi Albert,


Thanks for sharing your sample documents. Unfortunately, we are unable to understand your requirements. Your source document(Template) is blank, you can use either mail merge fields or plain text marker for mail merge operation. We will appreciate it if you please share more details about your workflow and requirements, so we will guide you accordingly.


We are sorry for the inconvenience.

Best Regards,