Protect and Unprotect

Hi

Thanks for your inquiry. I think that you should use Mail Merge with regions in this case. For more information see the following links.
https://docs.aspose.com/words/net/mail-merge-and-reporting/

I hope this could help you.

Best regards.

Hi !

You see my example for Template? In our process we don’t know , which template choose the user (we have many kinds of templates ) , and how much tables are in this template. Values for this Mergefield I take from XML file.

Question , how I see that Mergefield into table for clone the rows with this Mergefield?

Thank’s

Hi

Please try using Mail Merge with Regions. For example see the following code and attached template.

//Create table with data
DataTable myTable = new DataTable("myTable");
myTable.Columns.Add("Name");
myTable.Columns.Add("Company");
for (int i = 0; i < 10; i++)
{
    DataRow row = myTable.NewRow();
    row["Name"] = "Name_" + i.ToString();
    row["Company"] = "Company" + i.ToString();
    myTable.Rows.Add(row);
}
//Open template
Document doc = new Document(@"Test038\in.doc");
//Execute mail merge with regions
doc.MailMerge.ExecuteWithRegions(myTable);
//Save output document
doc.Save(@"Test038\out.doc");

Best regards.

Hi!

I use Mail Merge with Regions how you proposed. But in table after

AsposeDocument.MailMerge.ExecuteWithRegions(dataSet); in all tables in all rows i have blank rows because

TableStart and TableEnd fields. Is impossible for our client. How i delete this empty spaces.

I attach output file , after merge.

Thank’s

Hi

Could you please also attach your template? It seems that you insert paragraph break after TableStart. I think that if you remove this break then all will work fine.

Best regards.

Hi!

I attach our templete. I don’t insert the paragrapth break I can hide the Mergefields : TableStart , TableEnd?

Thank’s

Hi

Please try using the attached template. (I just removed paragraph breaks between fields).

Best regards.

Hi and thank’s . It’s worked. But I have a additional question : I can hide this MERGEFILEDS:

«TableStart:NECHES_MISHNE» and «TableEnd:NECHES_MISHNE »

?

Thank’s

Isabel

Hi

Why would you like to hide these fields? After executing mail merge with regions here will be no TableStart and TableEnd fields.

Best regards.

Hi!

I want to hide this fields because users see (client ) this templates before and after merge.Users begin to ask questions , they don’t know what this TableStart and TableEnd fields. They know only fields from their system.

Thank’s

Hi

It is very interesting. As workaround you can remove field value (Runs between FieldSeparator and FieldEnd). You can use DocumentExplorer (Aspose.Words demo app) to achieve this.

Best regards.