Manual setting merge field result

2 posts, 0 answers
  1. Matt
    Matt avatar
    2 posts
    Member since:
    Jun 2015

    Posted 03 Jul Link to this post

    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.

  2. Matt
    Matt avatar
    2 posts
    Member since:
    Jun 2015

    Posted 03 Jul in reply to Matt Link to this post

    Never mind, I never got that to work but I was able to use ExpandoObject to do what I needed to do.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top