Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Feb 28, 2014 3:29 pm

I am testing your tool, and so far I am very impressed. I do have some specific requirements, and I was wondering if your tool handles them.
The first issue I ran into is were the merge needs to be done by field name. An example is in the word doc, the field is names p1,p2,p3 etc. The merge file would similar to
p3:bob smith
p1:Mr.
p2: 416 222-5222

If I need to do a manual merge and loop through the arrays, that is ok.

rkmoray
 
Posts: 1
Joined: Thu Feb 27, 2014 2:18 pm

Mon Mar 03, 2014 2:48 am

Hello,

Sorry for late reply as weekend.
You could refer the following method.
Code: Select all
 //Create word document
Document document = new Document();
document.LoadFromFile("test.doc");
string[] filedNames = new string[]{"Contact Name","Fax","Date"};
string[] filedValues = new string[]{"John Smith","+1 (69) 123456",System.DateTime.Now.Date.ToString()};
document.MailMerge.Execute(filedNames, filedValues);
//Save doc file.
document.SaveToFile("Sample.doc", FileFormat.Doc);

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu Mar 06, 2014 9:19 am

Hello,

Have you tested the code provided by Gary? Does the code meet your need?
Could you please give us some feedback if convenience.
If there are any questions, welcome to get it back to us.

Regards,
Benjamin
E-iceblue support team
User avatar

Benjamin Du
 
Posts: 82
Joined: Thu Jul 25, 2013 2:38 am

Return to Spire.Doc

cron