Help me with Mailmerge ExecuteWithRegions

Hi All !

I come from VietNam, and i have a problem with Mailmerge ExecuteWithRegions.
I can’t speak English fluently, I’m sorry about that
My problem is:
I have 3 tables :

Table Product :
ProductID ProductName Details
Table City :
CityID CityName ProductID

Table SaleStaff :

SaleStaffID SaleName ProductID

I want create a report as :

INFORMATION CITY SALES
ProductID, ProductName, Details
Signature of SaleStaff is here
SaleStaffName
CityID, CityName
Signature of SaleStaff is here
SaleStaffName
ProductID, ProductName, Details
Signature of SaleStaff is here
SaleStaffName
CityID, CityName
Signature of SaleStaff is here
SaleStaffName
ProductID, ProductName, Details
Signature of SaleStaff is here
SaleStaffName
CityID, CityName
Signature of SaleStaff is here
SaleStaffName

Header of table will repeat next page

I try with document.MailMerge.ExecuteWithRegions(DataSet) but i have a report as :

INFORMATION CITY SALES
ProductID, ProductName, Details
Signature of SaleStaff is here
SaleStaffName
CityID, CityName
Signature of SaleStaff is here
SaleStaffName
ProductID, ProductName, Details
Signature of SaleStaff is here
SaleStaffName
CityID, CityName
Signature of SaleStaff is here
SaleStaffName
ProductID, ProductName, Details
Signature of SaleStaff is here
SaleStaffName
CityID, CityName
Signature of SaleStaff is here
SaleStaffName

Distance beetween Signature and SaleStaffName is very disorderly

Please help me !

Thanks for watching

Please help me !

Hi Hoàng,

Thanks for your inquiry and sorry for the delayed response. Please create a simple application (for example a Console Application Project) that helps us reproduce the same problem on our end and attach it here for testing. Also, please attach your template Word document and output Word document for our reference. As soon as you get these pieces of information to us, we’ll start our investigation into your issue and provide you code to achieve what you’re looking for. Thanks for your cooperation.

Best regards,

Hi Awais Hafeez!

Thanks for Reply !

I send my Project and file Product.bak of my DB

Please check App.config and change it to run Application

Thanks for watching !

Best regards,

Hi Hoàng,

Thanks for the additional information. Please add the following line of code before line:79 (dstDoc.MailMerge.ExecuteWithRegions(ds);) in the Form1.cs file to generate a data.xml file. Please attach this XML file here for further testing. Thanks for your cooperation:

ds.WriteXml(@“C:\Temp\data.xml”);

PS: It seems you’re using an older version of Aspose.Words for .NET i.e. 11.8.0. I would suggest you please upgrade to the latest version from the following link:
https://releases.aspose.com/words/net

Best regards,

Hi Awais Hafeez !

Thank you for reply

I send file data.xml for testing

Please check it and help me about problem

I try with Aspose.Words for .NET 13.4.0, but not satisfactory ( i use google translate, i don’t know, do you understand ?, sorry about that)

Hi Hoàng,

Thanks for the additional information. I have attached an output document here for your reference. In this case, Aspose.Words produces the report as per your template document. I could not see any issue with your output document (InformationData Out 0.docx) either; so, it would be great if you please modify this (output.docx) document using Microsoft Word as per your requirement and attach the modified document showing your expected/desired output here for our reference.

Best regards,

INFORMATION CITY SALES
Product Code: P01
Product Name: Pencil
Details: Pencil use write text and paragraph. It very population in the world. Pencil use write text and paragraph. It very population in the world.
Product Code: P02
Product Name: Pen
Details: Penl use write text and paragraph. It very population in the world. Pencil use write text and paragraph. It very population in the world.
Product Code: P03
Product Name: Laptop
Details: A laptop computer is a personal computer for mobile use.[1] A laptop has most of the same components as a desktop computer, including a display, a keyboard, a pointing device such as a touchpad (also known as a trackpad) and/or a pointing stick, and speakers into a single unit. A laptop is powered by mains electricity via an AC adapter, and can be used away from an outlet using a rechargeable battery. Laptops are also sometimes called notebook computers, notebooks, ultrabooks[2] or netbooks.
Product Code: P04
Product Name: Personal Computer
Details: A personal computer (PC) is a general-purpose computer, whose size, capabilities, and original sale price makes it useful for individuals, and which is intended to be operated directly by an end-user with no intervening computer operator.
Product Code: P05
Product Name: RAM
Details: RAM (pronounced ramm) is an acronym for random access memory, a type of computer memory that can be accessed randomly; that is, any byte of memory can be accessed without touching the preceding bytes. RAM is the most common type of memory found in computers and other devices, such as printers.
Product Code: P06
Product Name: NIC
Details: In computer networking, a NIC provides the hardware interface between a computer and a network. A NIC technically is network adapter hardware in the form factor of an add-in card such as a PCI or PCMCIA card.
Sale Staff Name: Nguyen Van A (same line with Sale Staff Name in next to cell)
City Code: C01
City Name: Los Angeles
City Code: C02
City Name: San Francisco
City Code: C03
City Name: New York
City Code: C04
City Name: Lon Don
City Code: C05
City Name: Ha Noi
City Code: C06
City Name: Yen Bai
Sale Staff Code: S01
Sale Staff Name: Nguyen Van A (same line with Sale Staff Name in next to cell)

I want Sale Staff Name in 2 cell on to the same line, but this very disorderly

Plesae help me fix it

Hi Hoàng,

Thanks for your inquiry. In your case, you need to modify the template document similar to the one I attached here with this post. This helps in producing the correct layout of your final report. Please let me know if I can be of any further assistance.

Best regards,