There tutorial about MailMerge and XML, but only C and vba. I want to do the same in java.
Is it possible ?
Thx
There tutorial about MailMerge and XML, but only C and vba. I want to do the same in java.
Is it possible ?
Thx
Hello
Thanks for your request. Yes of course you can do MailMerge using Aspose.Words for Java. Just use the following line of code:
doc.getMailMerge().execute(...)
You can download the latest version of Aspose.Words for Java from here:
https://releases.aspose.com/words/java
Best regards,
I try create region merge. But iwant make simple like exemple about merge :
doc.getMailMerge().execute(
new String[]
{
"FullName",
"Company",
"Address",
"Address2",
"City"
},
new Object[]
{
"James Bond",
"MI5 Headquarters",
"Milbank",
"",
"London"
});
But exemples about region merge use resultSet and sql request.
It is possible use anything else ?
Thx
Hello
Thanks for your inquiry. You can use IMailMergeDataSource, please see the following link:
https://reference.aspose.com/words/net/aspose.words.mailmerging/imailmergedatasource/
Best regards,
i want to use IMailMergeDataSource with mail merge region.
My code is:
CustomerList customers = new CustomerList();
customers.add(new Customer("Thomas Hardy", "120 Hanover Sq. London"));
customers.add(new Customer("m Platon", "Dublin"));
CustomerMailMergeDataSource customersDataSource = new CustomerMailMergeDataSource(customers);
doc.getMailMerge().executeWithRegions(customersDataSource);
And my word file is
{MERGEFIELD TableStart:Customer * MERGEFORMAT} | {MERGEFIELD mFullName * MERGEFORMAT} | {MERGEFIELD mAddress * MERGEFORMAT } | {MERGEFIELD TableEnd:Customer * MERGEFORMAT} |
---|
And after execute my code , i have:
Evaluation Only. Created with Aspose.Words. Copyright
2003-2008 Aspose Pty Ltd.
{MERGEFIELD mFullName * MERGEFORMAT} | {MERGEFIELD mAddress * MERGEFORMAT} | ||
---|---|---|---|
{MERGEFIELD mFullName * MERGEFORMAT} | {MERGEFIELD mAddress * MERGEFORMAT} |
I don’t understand.
is it possible use IMailMergeDataSource with mail merge region or not ?
And if yes, what (where) is my mistake ?
i find my mistake.
{MERGEFIELD mFullName \* MERGEFORMAT}
This code is wrong.
Indeed the code must be : {MERGEFIELD FullName \* MERGEFORMAT}
i have write “m” before FullName…
Thx for all anyway.
Hello
It is perfect, that you already resolved the problem.
Best regards,