SUM function is not working in aspose words table mail merge

Hi,


Sum function is not working in table, can u plz check once…

Please find the attached java code.


Dear AsposeTeam,


We encountered the issue with the latest ASPOSE WORDS and we are stand by with customer requirement.

Looks like this is basic requirement in Template. Not sure why they are not working.
Is there any upgrade patch or version that is going to be released to fix any your known issues in templates?

Our requirements mostly are with custom templates building for variety of data sources and we would need your help to close the issues on priorty otherwise we will be delayed with our customer timelines.

Please take this as priority .

Thanks
Kiran Pasham
Hi Kiran,

Thanks for your inquiry. Please call Document.updateFields method before saving the document to pdf. This will fix the shared issue. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "simple.rtf");
DataSet ds =
new DataSet();
ds.readXml(
MyDir + "newxml.xml");

doc.getMailMerge().setUseNonMergeFields(
true);
doc.getMailMerge().executeWithRegions(ds);
doc.updateFields();
doc.save(
MyDir + "out.pdf", SaveFormat.PDF);

HI Tahir Manzoor,


Thanks for giving the solution, its working fine, but we are facing one more issue.

Above are two tables inside one more table(outer table contains 2 cells, each cell has one table), my intention is to print TOTAL in same line, but i am getting alignment issue. can you please help to solve this issue.
Below is our client recommended format(we are just hiding table lines in below table)
Hi Kiran,

Thanks for your inquiry. Unfortunately, the shared images are corrupted. Please share them again. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a simple Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we'll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.

Hi,


Please find the attachments



Hi Kiran,

Thanks for sharing the detail. In your case, we suggest you please insert empty rows before the last row of table to get the desired output. You need to add the rows according to your requirements. Please check the following code example. We have attached the output document with this post for your kind reference. Hope this helps you.

Document doc = new Document(MyDir + "simple.rtf");
DataSet ds =
new DataSet();
ds.readXml(
MyDir + "newxml.xml");

doc.getMailMerge().setUseNonMergeFields(
true);
doc.getMailMerge().executeWithRegions(ds);
doc.updateFields();

Table table = (Table)doc.getChild(NodeType.TABLE, 3, true);
Row row = (Row)table.getRows().get(1).deepClone(true);
for (Cell cell : row.getCells()) {
cell.removeAllChildren();
cell.ensureMinimum();
}

table.insertAfter(row.deepClone(true), table.getRows().get(1));
table.insertAfter(row.deepClone(true), table.getRows().get(1));
table.insertAfter(row.deepClone(true), table.getRows().get(1));

doc.save(
MyDir + "17.2.0.pdf");

Hi,


My template is dynamically created by client requirements, its not fixed format.

And also data also not fixed.
Is it possible to handle from rtf document, without hard coding in java code
Hi Kiran,

Thanks for your inquiry. Please use the same approach to insert the empty rows in table. After performing the mail merge, get the difference of table's row count and insert empty rows in the other table accordingly.

Please let us know if you have any more queries.