Hi,We are trying to perform a mailmerge on a document in which we want to have ‘normal’ merge fields and also repeatable regions. I have found that fieldsbetween a start/end table are only parsed when they we call ExecuteWithRegions; And that fields that are not placed between a start/end are only parsed when calling de normal Execute.
We wish to give our users ‘total freedom’ in creating their templates so I tried to combine both techniques with the following code.
internal void ParseDocument(Document subject, DataSet DataSource)
{
foreach (DataTable table in DataSource.Tables)
{
subject.MailMerge.Execute(table);
}
subject.MailMerge.ExecuteWithRegions(DataSource);
}
The problem with this is that each call to ‘Execute’ will duplicate the entire orignal document.
So in if we have a template with one page and a dataset with 5 tables, the end result is a document with 5 pages.
It does not seem to matter whether there are actual mergefields in the document or not.
It also does not seem to matter in which order (Execute/executeWithRegions) we call the methods, the result is the same.
Strangely enough, if one of the ‘regionized’ tables contain more than one row, each row is correctly shown within its’ region.
The ONLY problem is that the entire document is duplicated for every table in the dataset.
Is there a way that I can prevent the additional copies being made?
Everything else seems to work fine.
Tanks, Bas.