Replace merge fields with text with OpenXML SDK 2.0

Posted by uggwar on Stack Overflow See other posts from Stack Overflow or by uggwar
Published on 2011-01-17T09:03:14Z Indexed on 2011/01/17 11:53 UTC
Read the original article Hit count: 252

Filed under:
|
|

What is the best way to remove all merge fields from a word 2010 document using openxml sdk 2.0, and replace them with a simple text? I have some difficulties to remove them cleanly. Have tried to remove all Run objects that includes a FieldCode with a "MERGEFIELD" defined, and appended a new Run with my text. But I am missing something crucial since the field seems to stay defined for this element.

© Stack Overflow or respective owner

Related posts about c#

Related posts about msword