Never mind, I figured it out.

For anyone who's interested, the SDT elements (content controls) in the
duplicated rows kept their IDs and it seems that in this scenario Word 2007
only keeps the last SDT for each ID (as it states in the documentation for
the ID element now that I look at it).  It seems Word 2010 is a bit more
tolerant.

The fix for me is to simply remove the IDs from the duplicate SDTs, although
you could probably generate new IDs if you needed to reference them
elsewhere.

On Tue, Dec 21, 2010 at 12:10 AM, Matt Siebert <[email protected]> wrote:

> Hi all,
>
> I'm using the Open XML SDK to work with .docx files.  I'm adding a custom
> XML part and binding content controls to it.
>
> I have some repeating items that I'm binding to content controls that
> appear in tables.  My code is correctly appending table rows and binding the
> content controls to the relevant elements in my custom XML part.
>
> The problem is that Word 2007 only renders the last row correctly.  That
> is, for the content controls in the other rows, only the placeholder text is
> rendered and it's rendered as plain text (i.e. the content control border
> doesn't show when you attempt to edit it).
>
> I've inspected the main document part's XML and confirmed that the only
> difference between the last row and the others is the index in the XPath
> queries which selects the relevant element for the binding.  Also, if I open
> the document in Word 2010 everything works as expected.
>
> This seems like a bug in Word 2007, but I can't find anything helpful on
> the net.  I've opened the document on several different machines with the
> same result, and I've installed all the Office 2007 updates and still no
> luck.
>
> This seems like a common scenario for content controls and custom XML
> parts.  Has anyone here seen this issue before, or know how to fix it?
>
> Cheers,
> Matt.
>

Reply via email to