Free Support Forum -

And advice appreciated

Hi I have just started using aspose.words with C# and .Net 1.1 and I am trying to fill a word doc with data retrieved from sql server. I have managed to fill a basic doc but now I need to fill this doc

The table will have 16 rows and the top section needs to be filled once so as im new to this im just looking for some advice on how to go about this or where I could take a look at some similar tutorials.

Thanks in advance


I think you should call MailMerge.Execute first with the data source containing data for the header. Then call MailMerge.ExecuteWithRegions with the DataTable containing player information. For merging image data please use MergeImageField event. The usage of this event is described in Using Merge Events article in the documentation.

Concerning tutorials, please check Performing MailMerge section of the documentation. Much useful information together with code examples can be found in API reference as well. You can also check our source code demo projects. They have several examples of most frequently used MailMerge scenarios there.

If you have further questions please don't hesitate to ask them here in the forums. I will be happy to assist you with whatever I can.

thanks for ur reply i have the header section working but thats the easy part. when the ExecuteWithRegions fucntion exectues i get this error “Found mail merge region ‘Suppliers’ nested in another mail merge region ‘Suppliers’. Nested mail merge regions are not yet supported.” i have no fererences to suppliers in my code so im just wondering if this means anything to you
thanks again

this prob is ok now thanks i just needed to setup the mailmerge fields again

Please check the actual field names of TableStart and TableEnd fields. This could be done by pressing Alt-F9 to turn field codes view on or editing field with context menu command 'Edit field'. The actual names of these are currently 'Suppliers' not 'Players'.

Please inform me if the error persists after field name correction. I will then do further research on this issue.

Best regards,

Oh, I see that you have already solved this issue. If you will have any other problems just let me know.

just wondering if anyone knows of anyway to get around the way you must have the table start and end tags on the same row of a table

Sorry for delay. I understand what your problem is and will try to provide you some solution on Monday.

Best regards,

It seems that there is a workaround although it is a little bit tricky.

Please download the simplified template from the attachment and run it with the following code:

Document doc = Open("TeamReport.doc");

// make a test data table

DataTable table = new DataTable("Players");

string playerName = "PlayerName";


for(int i = 0; i<3; i++)


DataRow datarow = table.NewRow();


datarow[0] = playerName + i;



// Merge "Remove" merge fileds with empty data.

// That will efectively remove the paragraphs that contain them due to RemoveEmptyParagraphs setting.

doc.MailMerge.RemoveEmptyParagraphs = true;

doc.MailMerge.Execute(new string[] {"Remove"}, new string[] {""});

The trick is to place TableStart and TableEnd fields before and after the table part that should be duplicated and use dummy "Remove" fields to remove paragraphs that will otherwise remain between duplicated tables. The name for the dummy fields can actually be anything. I have named them "Remove" just to illustrate the point.

Best regards,

The issues you have found earlier (filed as 39) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.