Hi, after buildReport, the document is not generated correctly. Specifically
<<[ordinanzaRateizzazione.destinatario.indirizzo.completo]>> is not replaced correctly.
void tryMerge() throws Exception {
String fileName = "C:\\Samuele\\esporta-archivi-source-template\\converted\\Comunicazione_ordinanza_rateizzazione.odt";
// Load the template document.
Document doc = new Document(fileName);
DataSet x =new DataSet("ds");
x.readXml(
"C:\\Samuele\\java\\concilia-rtf-converter\\src\\main\\resources\\example.xml");
print_values(x,"test");
// Create a Reporting Engine.
ReportingEngine engine = new ReportingEngine();
engine.getKnownTypes().add(Util.class);
ReportingEngine.setUseReflectionOptimization(false);
doc.getMailMerge().setUseNonMergeFields(true);
engine.setOptions(ReportBuildOptions.INLINE_ERROR_MESSAGES + ReportBuildOptions.ALLOW_MISSING_MEMBERS + ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS);
// Execute the build report.
engine.buildReport(doc, x, "ds");
// Save the finished document to disk.
doc.save("c:\\tmp\\Test_Aspose.odt");
}
private static void print_values(DataSet dataSet, String label) {
System.out.println("\n" + label);
for (DataTable table : dataSet.getTables()) {
System.out.print(table.getTableName() + ":\nChildTables: ");
for (DataRelation dr : table.getChildRelations()) {
System.out.print(dr.getChildTable().getTableName() + " ");
}
System.out.print("\nColumns: ");
for (DataColumn column : table.getColumns()) {
System.out.print(column.getColumnName() + " | ");
}
int row_num = 0;
for (DataRow row : table.getRows()) {
System.out.print("\nRow " + row_num + ": ");
for (DataColumn column : table.getColumns()) {
System.out.print(row.get(column) + " | ");
}
}
System.out.println("\n");
}
}
Can you help me ?
Comunicazione_ordinanza_rateizzazione.zip (19.9 KB)