Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6214437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:52:35+00:00 2026-05-24T06:52:35+00:00

In our document generation system we use DOCX files in which we programmatically fill

  • 0

In our document generation system we use DOCX files in which we programmatically fill out mergefields. For this I’m using the OpenXml SDK 2.0.

I’ve been plowing through the document.xml file, in de docx, and found that the mergefields are usually represented by a SimpleField. An example from a document we use:

<w:fldSimple w:instr=" MERGEFIELD  NP021_INSSNumber  \* MERGEFORMAT "><w:r><w:rPr><w:noProof/></w:rPr><w:t>«NP021_INSSNumber»</w:t></w:r></w:fldSimple>

A fairly straightforward notation, containing the mergefield command and the text to be displayed in the document. It’s fairly easy to find this tag in the XML, just search for w:fldSimple tags. (I removed some style tags to make it more readable)

But a document recently created in Word didn’t parse in our code, and when I looked in the XML the notation for mergefields was completely different:

<w:instrText xml:space="preserve"> MERGEFIELD  NP021_INSSNumber  \* MERGEFORMAT </w:instrText>

And later in the document I found the display notation: <w:t>«NP021_INSSNumber»</w:t>
This is spectacularly impossible to parse in code.

How is it possible that doing the same thing in Word can have such different results, and is there a way to ensure that Word uses SimpleFields as XML notation for mergefields?

Thank you in advance for any helpful input.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:52:35+00:00Added an answer on May 24, 2026 at 6:52 am

    I would consider accepting revisions and simplifying the markup prior to parsing it.

    Note that the MarkupSimplifier is included in the Power Tools for Open XML.

    You will probably find lots more useful material in Eric Whites blog postings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We use a FileSystemWatcher to monitor documents opened from our Document Management system, and
we're currently generating all our official documents using XSL-FO transformation using .xml files as
In our project we want to query a document management system for a specific
My users like to upload password-protected Word documents into our custom document management system.
We use phpDocumentator to document our php code. The php code is in different
I'm working on a Javascript library which is currently in use by our websites
I'm using the following to get a help document in our app. My problem
We want to use Google Doc API to generate Document (In our own business
For our school project, we are tasked to define a design document describing the
What Delphi coding standards document(s) do you follow? Our company is looking at putting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.