We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Mergefields

Thread ID:

Created:

Updated:

Platform:

Replies:

76550 Sep 12,2008 08:56 AM Jan 6,2009 07:40 AM Windows Forms 10
loading
Tags: DocIO
Nuyttens Xavier
Asked On September 12, 2008 08:56 AM

Hey,

I'm evaluating DocIO for a project we're working on that needs a extensive Word-link. At first sight it looks very intresting.
We want to let our customers create documents from our data. There are 2 steps : first they create the template, after that they use the templates to merge.
For the template creation I would like to present them with an empty document that has all possible MergeFields allready defined since we have them in a database already (100+ fields, so impossible to define manualy every time).
Can I do this with DocIO ? I didn't find an example to add a defination of mergefield yet.

Thanks for the help
Xavier, CPS


Bhuvaneswari P [Syncfusion]
Replied On September 12, 2008 09:15 AM

Hi Xavier,

Thank you for evaluating Syncfusion Essential DocIO.

Yes, it is possible to insert merge field using the DocIO API's by using the Paragraph.AppendField() method. You can insert any field using this method like CreateDate, Formfields and etc.. Please refer the below code snippet to do so:
[C#]

paragraph.AppendText("FirstName=");
//Insert MergeField
paragraph.AppendField("FirstName", FieldType.FieldMergeField);
paragraph.AppendText("\nLastName=");
//Insert MergeField
paragraph.AppendField("LastName", FieldType.FieldMergeField);


Here is the sample for your reference:

http://websamples.syncfusion.com/samples/DocIO.Windows/F76550/main.htm


Please try this and let us know if you need any further assistance we glad to assist to you.

Best Regards,
Bhuvana



Nuyttens Xavier
Replied On September 12, 2008 10:49 AM

Bhuvana,

Thanks for your help, but I don't think this is what I was looking for.

I want users to be able to create the template and select the fields from the Word mergefields list. We had something like that in the previous application we wrote in Foxpro and automated with Office directly. I think it was achieved by connecting the datasource to the document without executing the mergefunction. That way you work with the fields from datasource in the template and even start the merge from Word itself if you want to.

Greetings
Xavier



Bhuvaneswari P [Syncfusion]
Replied On September 22, 2008 08:52 AM

Hi Xavier,

Thanks for the update.

Please have a look into your sample browser sample which includes all the merge features:
\\Syncfusion\EssentialStudio\X.X.X.X\Windows\DocIO.Windows\Samples\2.0\MailMerge

Online Documentation link:

http://help.syncfusion.com/UG/Reporting/DocIO/Windows%20Forms/Documents/46mailmerge.htm


Please try these features and let us know if you need any further assistance.

Best Regards,
Bhuvana



Nuyttens Xavier
Replied On September 23, 2008 08:01 AM

Bhuvana,

I have looked at your samples and played around with the code, but again, there's one big feature I'm missing : ability to open the document (template) with the datasource connected BEFORE the mailmerge is executed.
I added an example of what I'm trying to achieve.

Greetings
Xavier


Nuyttens Xavier
Replied On September 23, 2008 08:02 AM

Bhuvana,

I have looked at your samples and played around with the code, but again, there's one big feature I'm missing : ability to open the document (template) with the datasource connected BEFORE the mailmerge is executed.
I added an example of what I'm trying to achieve.

Greetings
Xavier


Nuyttens Xavier
Replied On September 23, 2008 08:03 AM

Bhuvana,

I have looked at your samples and played around with the code, but again, there's one big feature I'm missing : ability to open the document (template) with the datasource connected BEFORE the mailmerge is executed.
I added an example of what I'm trying to achieve.

Greetings
Xavier



MailMerge_53fe72a.zip

Bhuvaneswari P [Syncfusion]
Replied On September 24, 2008 08:49 AM

Hi Xavier,

Thanks for the update.

I could find only one screenshot there is no sample. Could you please send me the sample?

Best Regards,
Bhuvana


Administrator [Syncfusion]
Replied On December 23, 2008 12:25 PM

Xavier,

Looking through this thread, it appears that the screenshot you provided is some kind of Word plugin you had created that allows your end-users to select the fields they want inserted while creating a "mail merge template" in Word.

If so, DocIO, does not help you in any way to create such a plug-in for Word.

Once the template is created though, as you probably know already, DocIO can perform the mail merge.

Also if you want your end-users to create a template using Word, that has to be done outside the scope of DocIO.

If we are missing something please let us know.

Thanks
Praveen



Nuyttens Xavier
Replied On January 5, 2009 03:29 AM

Hi,

No I did not create a plugin of any kind. All I did was create a datasource, open the Word document and connect the datasource. At this moment Word lets you choose the fields since it knows what fields are available.

Greetings
Xavier, CPS

>Xavier,

Looking through this thread, it appears that the screenshot you provided is some kind of Word plugin you had created that allows your end-users to select the fields they want inserted while creating a "mail merge template" in Word.

If so, DocIO, does not help you in any way to create such a plug-in for Word.

Once the template is created though, as you probably know already, DocIO can perform the mail merge.

Also if you want your end-users to create a template using Word, that has to be done outside the scope of DocIO.

If we are missing something please let us know.

Thanks
Praveen





Bhuvaneswari P [Syncfusion]
Replied On January 6, 2009 07:40 AM


Hi Xavier,

Thanks for the update.

Yes, it's possible to take a list of fields from the word document and also it is possible to insert the merge fields into the document using DocIO.

Code snippet to get the merge fields from the document:
string[] s = doc.MailMerge.GetMergeFieldNames();

Code snippet to insert fields into the word document:
doc.LastParagraph.AppendText("FirstName");
WField field= doc.LastParagraph.AppendField("FirstName", FieldType.FieldMergeField) as WField ;

Sample link:
http://www.syncfusion.com/uploads/redirect.aspx?file=DocIO_MailMerge_6bc94ab9.zip&team=support

sample description: 1. The existing document merge fields displayed in the listbox
2. select fields and click "Addfield" button to add the field into another document
3. After added all the fields click "create doc" button will create the document with that fields.

Please let me know if this meets your requirement.

Best Regards,
Bhuvana



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;