我需要快速支持来填充 radrichtextbox 上的邮件合并数据。在第一步中,我只是在邮件合并中填充数据列表,如“FirstName”、“LastName”,然后我想获取与这些标签关联的数据,例如 Firstname=Peter ....请查看以下行代码。我的问题是如何在按预览结果时在文档上加载 FirstName、LastName 数据。
负载
this.radRichTextBox.Document.MailMergeDataSource.ItemsSource = new List<Employee>()
{
new Employee()
{
FirstName = "Guest1",
LastName = "Guest2",
},
new Employee()
{
FirstName = "Ali",
LastName = "Doc",
}
};
private void btnPrint_Click(object sender, RoutedEventArgs e)
{
//this.radRichTextBox.InsertField(new MergeField() { PropertyPath = "FirstName" });
MergeField field = new MergeField() { PropertyPath = "FirstName" };
field.DisplayMode = FieldDisplayMode.Result;
this.radRichTextBox.Document.ChangeFieldDisplayMode(field.FieldStart, FieldDisplayMode.Result);
}