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
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 ;
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.
What is wrong?
Thank you very much for the help.
Albert