In "code-behind" I use the InsertField method to insert a MergeField into the document.. The problem is when i open the document in msWord the FontType is wrong and when i open the document after save in RichEdit the fields isn't visible.. Is there a way to fix this?
Code sample:
view.editor.InsertField(new MergeField() { PropertyPath = "Number" });
4 Answers, 1 is accepted
if (e.Command is OpenDocumentCommand)
{
View.editor.Commands.ChangeAllFieldsDisplayModeCommand.Execute("DisplayName");
}
The problem with the Font is probably a bug, the font formating is fine if I save the document as a rtf file instead of docx..
Have also countered some other bugs when I use mailmerge and the docx format
Gudrun
Thank you for getting to us about the export of merge fields.
The format providers export the result of the merge fields and when a merge source has not been set, the fields are not visible in the exported document. We have planned to add customization settings to the provider, so that merge fields can be exported using their display name/display code.
The workaround you have found should work correctly.
If you have encountered other bugs, we would appreciate it if you could share them with us.
Iva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
InsertMergeFieldEmptyCommand is infrastucture command used for binding the RadRichTextBoxRibbonUI. If you want a command that inserts a merge field, you can use InsertFieldCommand, which accepts as parameter a Field and inserts it at the current caret position:
<
telerik:RadRibbonToggleButton
Size
=
"Medium"
Text
=
"Bind"
Command
=
"{Binding ElementName=radRichTextBox, Path=Commands.InsertFieldCommand}"
>
<
telerik:RadRibbonToggleButton.CommandParameter
>
<
telerik:MergeField
PropertyPath
=
"FirstName"
/>
</
telerik:RadRibbonToggleButton.CommandParameter
>
</
telerik:RadRibbonToggleButton
>
Don't hesitate to contact us if you have other questions.
Kind regards,Boby
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>