Hi,
How do i read only simple merge fields?
when i’m using this method doc.getMailMerge().getFieldNames();
I’m getting all the fields as below specified, i do not want the table fields. How can i skip those? and in the template file may have any nof of table merge field and in any order, but need to skip those all.
TableStart:documents
docName
TableEnd:documents
TableStart:Customer
customerName
TableStart:documentList
nameOfDocument
TableEnd:documentList
TableEnd:Customer
gender
dob
city
TableStart:list
book
TableEnd:list
My requirement is , i need to read the simple merge fields from the document and i need to assign the values to those and generate the pdf.
for example in this scenario, i want to read these 3 only below specified and i want to use execute method below specified.
{{ gender }}
{{dob}}
{{city}}
doc.getMailMerge().execute(new String[]{“gender”,“dob”,“city”}, new Object[]{“MALE”,“1996”,“Berlin”});
and in my program , To display the region data, I’m using doc.getMailMerge().executeWithRegions(ds); from different data source.
Just for your understanding i’m giving this info.
In my program i need to use both executeWithRegions() & execute() methods.
Could you please suggest?
Please find the attachment for my simple program and input and output.
ReadonlySimplemergefields.zip (13.4 KB)
@Rakesh_M MailMerge.getFieldNames method returns all merge field names in the document, including regions.
There are MailMerge.getRegionsHierarchy, MailMerge.getRegionsByName and MailMerge.getFieldNamesForRegion to get fields for regions. So you can get field for regions and exclude them from the full list of fields to get only fields outside the regions.
Hi,
I’m using this String f1[] = doc.getMailMerge().getFieldNamesForRegion(“documents”);
but i’m not getting anything.
and im this as well still im not getting anything.
// String f1=doc.getMailMerge().getRegionsByName(“documents”).get(0).getName();
//String f = doc.getMailMerge().getRegionsHierarchy().getName();
pfa for my sample app.
I’m considering documets as a region name, is it correct? if not in for each loop which one is the region name?
Below specified is the template:
• {{ #foreach documents}}{{docName}} {{ /foreach documents }}
{{ #foreach Customer }} {{customerName }}
** {{ #foreach documentList}} {{ nameOfDocument}} {{ /foreach documentList}}**
{{ /foreach Customer }}
{{ gender }}
{{dob}}
{{city}}
** {{ #foreach list}}{{book}} {{ /foreach list }} **
Could you pls suggest?
attaching my sample application as well.
Reading regions issue.zip (745 Bytes)
@Rakesh_M
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-25404
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Yes, We ordered the Aspose licence as well.
May be in near future we’ll utilize the paid services:-).
What is the Issue ID(s): WORDSNET-25404 ? I did not get it?
is there any solution for my issue, pls suggest.
@Rakesh_M The issue WORDSNET-25404 is in the queue for analysis. Once development team complete analysis we will be able to provide you more information.
Unfortunately, at the moment i cannot suggest you any workaround of this issue.
The issues you have found earlier (filed as WORDSNET-25404) have been fixed in this Aspose.Words for Java 23.7 update.