This question is locked. New answers and comments are not allowed.
Hi all,
How I can make a mail merge from existing docx file? I have a file with few fields for example: {MERGEFIELD OrganisationName}
But when I load the file in radRichTextBox seems he not understand the fields.
Here how I populate the data:
_radRichTextBox.Document.MailMergeDataSource.ItemsSource = new List<GetStartedPackModel>()
{
new GetStartedPackModel()
{
OrganisationName = SelectedOrder.Organisation.Name,
ContactName = SelectedOrder.Contact.FullName,
Code = SelectedOrder.Organisation.Code.ToString(),
Password = SelectedOrder.Organisation.Password
}
};
{MERGEFIELD OrganisationName} for RichTextBox seems is just a text and not replace it with OrganisationName. Same is for all other fields.
I test with your silverlight demo to load same document with a field from your list: {MERGEFIELD FullRecipientName} seems in the demo we have same behavior. It not understand it as a MergeField that need to be replaced with FullRecipientName.
Please advise.
Best regards,
Saykor
How I can make a mail merge from existing docx file? I have a file with few fields for example: {MERGEFIELD OrganisationName}
But when I load the file in radRichTextBox seems he not understand the fields.
Here how I populate the data:
_radRichTextBox.Document.MailMergeDataSource.ItemsSource = new List<GetStartedPackModel>()
{
new GetStartedPackModel()
{
OrganisationName = SelectedOrder.Organisation.Name,
ContactName = SelectedOrder.Contact.FullName,
Code = SelectedOrder.Organisation.Code.ToString(),
Password = SelectedOrder.Organisation.Password
}
};
{MERGEFIELD OrganisationName} for RichTextBox seems is just a text and not replace it with OrganisationName. Same is for all other fields.
I test with your silverlight demo to load same document with a field from your list: {MERGEFIELD FullRecipientName} seems in the demo we have same behavior. It not understand it as a MergeField that need to be replaced with FullRecipientName.
Please advise.
Best regards,
Saykor
9 Answers, 1 is accepted
0
Hello Saykor,
When loading a document containing merge fields into RadRichTextBox, the fields are not actually replaced. Instead, they are evaluated in one the field's modes - result, code or display name. The modes can be toggled using the commands exposed by the control and bound to the predefined UI using the buttons in the Mailings tab of the ribbon or through code like this:
To actually replace the fields in the document with the data from your source, you need to execute mail merge either through the UI or with the MailMerge() method.
More information on the topic is available in the Mail Merge article in our documentation and you can learn more about fields and their display modes in the Fields article.
I hope this is useful.
Regards,
Petya
Telerik
When loading a document containing merge fields into RadRichTextBox, the fields are not actually replaced. Instead, they are evaluated in one the field's modes - result, code or display name. The modes can be toggled using the commands exposed by the control and bound to the predefined UI using the buttons in the Mailings tab of the ribbon or through code like this:
this
.radRichTextBox.UpdateAllFields(FieldDisplayMode.Result);
To actually replace the fields in the document with the data from your source, you need to execute mail merge either through the UI or with the MailMerge() method.
RadDocument merged =
this
.radRichTextBox.MailMerge();
More information on the topic is available in the Mail Merge article in our documentation and you can learn more about fields and their display modes in the Fields article.
I hope this is useful.
Regards,
Petya
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Saykor
Top achievements
Rank 2
answered on 05 Aug 2014, 03:54 PM
Dear Petya,
If (You do a test != null &&
make a docx file with one field for example {MERGEFIELD FullRecipientName} == true &&
open in your silverlight demo http://demos.telerik.com/silverlight/#RichTextBox/MailMerge == true &&
click on Preview Result button to see nothing was changed == false &&
before to answer and lost another few days for next answer == false)
{
will be more useful;
}
You can see this video for your ease: https://www.youtube.com/watch?v=We2uYVV9UWc&feature=youtu.be
End download same test docx file: https://mega.co.nz/#!V5BSHbCB!_biSE4ie3qJWSPMfLtVy3_SlHlvIqiirFXKATxMRgSY
Regards,
If (You do a test != null &&
make a docx file with one field for example {MERGEFIELD FullRecipientName} == true &&
open in your silverlight demo http://demos.telerik.com/silverlight/#RichTextBox/MailMerge == true &&
click on Preview Result button to see nothing was changed == false &&
before to answer and lost another few days for next answer == false)
{
will be more useful;
}
You can see this video for your ease: https://www.youtube.com/watch?v=We2uYVV9UWc&feature=youtu.be
End download same test docx file: https://mega.co.nz/#!V5BSHbCB!_biSE4ie3qJWSPMfLtVy3_SlHlvIqiirFXKATxMRgSY
Regards,
0
Hi Saykor,
The provided document does not contain a merge field, it simply contains text {MERGEFIELD FullRecipientName}. Please note that fields are special document elements and need to be inserted as such in order to be evaluated properly.
A field can be inserted either through UI or from code with the InsertField() method of RadRichTextBox. Also, both RadRichTextBox's UI and the UI of other document editors like MS Word enable the mailing commands only if a data source has been set.
I hope this helps.
Regards,
Petya
Telerik
The provided document does not contain a merge field, it simply contains text {MERGEFIELD FullRecipientName}. Please note that fields are special document elements and need to be inserted as such in order to be evaluated properly.
A field can be inserted either through UI or from code with the InsertField() method of RadRichTextBox. Also, both RadRichTextBox's UI and the UI of other document editors like MS Word enable the mailing commands only if a data source has been set.
I hope this helps.
Regards,
Petya
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Saykor
Top achievements
Rank 2
answered on 11 Aug 2014, 01:44 PM
Thank you for you answer.
I am not sure why not receive email notification when you do it.
I suppose when I write a text {MERGEFIELD FullRecipientName} in the docx file and load it in to RadRichTextBox it will search in the text for a string that contains {MERGEFIELD xxx}, convert it as a MergeField with a property xxx automatically. Not to do this manually from your UI.
So you tell me if we want to have a MergeMail functionality we need to use your UI to add the fields on the right position on the document. It is ok but can you tell me how when we add the fields can save the document as a template to use it in the future and not to add the fields every time when we need to merge mail and print the result.
Example:
1. User upload a docx file and put mergeFIelds on the right place.
2. Save it as a template.
3. When a order is coming in the system user can just click print button and get the merged document.
4. Without to add the fields every time when have a new order.
Regards
I am not sure why not receive email notification when you do it.
I suppose when I write a text {MERGEFIELD FullRecipientName} in the docx file and load it in to RadRichTextBox it will search in the text for a string that contains {MERGEFIELD xxx}, convert it as a MergeField with a property xxx automatically. Not to do this manually from your UI.
So you tell me if we want to have a MergeMail functionality we need to use your UI to add the fields on the right position on the document. It is ok but can you tell me how when we add the fields can save the document as a template to use it in the future and not to add the fields every time when we need to merge mail and print the result.
Example:
1. User upload a docx file and put mergeFIelds on the right place.
2. Save it as a template.
3. When a order is coming in the system user can just click print button and get the merged document.
4. Without to add the fields every time when have a new order.
Regards
0
Hello Dimitar,
We will take a look what can cause you not receiving email notifications.
You can insert a merge field from the code, not only from the UI. Here you can find more information about MailMerge with RadRichTextBox. The Programmatic Mail Merge section explains how you can perform a mail merge from the code.
If you have other questions do not hesitate to contact us.
Regards,
Kammen
Telerik
We will take a look what can cause you not receiving email notifications.
You can insert a merge field from the code, not only from the UI. Here you can find more information about MailMerge with RadRichTextBox. The Programmatic Mail Merge section explains how you can perform a mail merge from the code.
If you have other questions do not hesitate to contact us.
Regards,
Kammen
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Saykor
Top achievements
Rank 2
answered on 14 Aug 2014, 02:18 PM
Can you please stop to refer me to the documentation and give me a real example of what I need to be done? Kammen, your answer not have any connection with my question. I not ask how to add fields from the code or from the UI. My question was:
"can you tell me how when we add the fields can save the document as a template to use it in the future and not to add the fields every time when we need to merge mail and print the result"
Other question is that I already read your documentation and when I have a question on your forum this mean I not find a answer in the documentation or it is not a clear explained. 14 days you still not understand or simulate that not understand what I ask and not provide a real working solution. We only talk in a circle and refer to same documentation without any real help.
Regards,
Dimitar Todorov
"can you tell me how when we add the fields can save the document as a template to use it in the future and not to add the fields every time when we need to merge mail and print the result"
Other question is that I already read your documentation and when I have a question on your forum this mean I not find a answer in the documentation or it is not a clear explained. 14 days you still not understand or simulate that not understand what I ask and not provide a real working solution. We only talk in a circle and refer to same documentation without any real help.
Regards,
Dimitar Todorov
0
Saykor
Top achievements
Rank 2
answered on 15 Aug 2014, 08:30 AM
http://demos.telerik.com/silverlight/#RichTextBox/MailMerge
When I add mergefields from the UI how I can save the document before to be merged so i can reuse it in the future. To start merge mail when I need not exactly on the time when I add the fields.
If I click MergeFinish the UI will replace the fields and give me the result file
If I click Save As will get again result file with replaced fields
If click save again same result.
If I add new button what command / code to use to get the file with the fields before to replace them so I can reuse it.
When I add mergefields from the UI how I can save the document before to be merged so i can reuse it in the future. To start merge mail when I need not exactly on the time when I add the fields.
If I click MergeFinish the UI will replace the fields and give me the result file
If I click Save As will get again result file with replaced fields
If click save again same result.
If I add new button what command / code to use to get the file with the fields before to replace them so I can reuse it.
0
Accepted
Hello Dimitar,
The documentation we pointed you to contains the basic information regarding fields, merge fields in particular and the mail merge action. If there is anything unclear in it, please let me know which part is misleading and I will make sure it is updated accordingly.
Like I previously explained, fields are special type of document elements and there are several ways to include one in a document. Importing or exporting a document that contains fields is possible to the formats that support the concept - DOCX, RTF and XAML. As to replacing a field with its resulting value, this is done when executing the mail merge action.
To your question, exporting a document containing fields to any of the formats mentioned above is performed just like exporting any other document. Based on the information in your last post I presume you are exporting to DOCX which results in the field being updated in their Result mode (please note, updated in Result mode but not replaced with their result).
If you try saving the document from the demo you pointed to, you'd notice only one record is available in the exported document, whereas performing mail merge results in all "merged" records in the same document. For future reference if you want to check whether something is a field (either when showing the document in RadRichTextBox or other editors like MS Word), you can simply right-click on it - in the context of fields, an "Update Field" item should appear in the context menu.
Additionally, if you do not want the fields to be exported in Result mode, but one of their other modes you can utilize the export settings available with DocxFormatProvider. More information on the approach is available in the Import/Export Settings help article.
I hope this helps you achieve the desired result.
Regards,
Petya
Telerik
The documentation we pointed you to contains the basic information regarding fields, merge fields in particular and the mail merge action. If there is anything unclear in it, please let me know which part is misleading and I will make sure it is updated accordingly.
Like I previously explained, fields are special type of document elements and there are several ways to include one in a document. Importing or exporting a document that contains fields is possible to the formats that support the concept - DOCX, RTF and XAML. As to replacing a field with its resulting value, this is done when executing the mail merge action.
To your question, exporting a document containing fields to any of the formats mentioned above is performed just like exporting any other document. Based on the information in your last post I presume you are exporting to DOCX which results in the field being updated in their Result mode (please note, updated in Result mode but not replaced with their result).
If you try saving the document from the demo you pointed to, you'd notice only one record is available in the exported document, whereas performing mail merge results in all "merged" records in the same document. For future reference if you want to check whether something is a field (either when showing the document in RadRichTextBox or other editors like MS Word), you can simply right-click on it - in the context of fields, an "Update Field" item should appear in the context menu.
Additionally, if you do not want the fields to be exported in Result mode, but one of their other modes you can utilize the export settings available with DocxFormatProvider. More information on the approach is available in the Import/Export Settings help article.
I hope this helps you achieve the desired result.
Regards,
Petya
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Saykor
Top achievements
Rank 2
answered on 21 Aug 2014, 02:13 PM
With your last answer i do what i need.
Thank you
Regards
Thank you
Regards