This is a migrated thread and some comments may be shown as answers.

Manual setting merge field result

1 Answer 61 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 03 Jul 2016, 05:40 AM
I'm trying to set merge field values manually and I can't get anything to work, or find anything indicating how I can do this directly.  Here's an example of my code:

 

                        var span = new Span("Testing");
                        var fragment = DocumentFragment.CreateFromInline(span);


                        start.Field.SetFragmentByDisplayMode(FieldDisplayMode.Result, fragment);

 

start.Field is a MergeField, and basically other than the end result being blank.  When I look at the MergeField objects properties after making this call I see that the ResultFragment shows as empty.  What am I missing here?  If this won't work is there some way to just remove the field and insert my text? 

I realize the documentation is angled towards mail merge but my situation doesn't make that feasible.

1 Answer, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 03 Jul 2016, 06:13 AM
Never mind, I never got that to work but I was able to use ExpandoObject to do what I needed to do.
Tags
RichTextBox
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
Share this question
or