Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-16-2022, 11:58 PM
Peterson Peterson is offline Content controls bound to custom XML not updating Windows 10 Content controls bound to custom XML not updating Office 2019
Competent Performer
Content controls bound to custom XML not updating
 
Join Date: Jan 2017
Posts: 141
Peterson is on a distinguished road
Default Content controls bound to custom XML not updating

I'm pulling my hair out over content controls repeated multiple times across a template, bound to a custom XML part, that are neither updating properly nor in the same manner when I test with copies of the same template.



Template Details
  • The template is set up for Different First and Different Odd/Even pages.
  • There are eight content controls, all bound to a custom XML part.
  • All CCs are plain text, except one date picker.
  • Except for two CCs on the first page, all are in headers/footers.
  • Seven of the eight CCs appear on every page (one CC isn't on the first page).
Problem Details
  • When I enter data into all CCs on a single page, i.e., all entered via an Odd or all via an Even, all CCs correctly populate all other instances in the file. BUT...
  • With one version of the template:
    • In the Even Page Footer, which has three CCs, when I populate them, the THIRD one populated does NOT update elsewhere in the document.
    • Changing the order in which I add text doesn't yield a different result: it's always the last one that doesn't update elsewhere.
    • In a First Page Footer, which has five CCs, when I populate them, the FIFTH one does NOT populate in elsewhere in the document.
  • With another version, which is simply a copy of the prior, I get the same behavior, EXCEPT in the Odd Page Footer, the fifth of five CCs DOES update elsewhere.
  • With yet another version, again, simply a copy, all three of Even Page Footer CCs populate elsewhere, but the fifth of five CCs in the Odd Page Footer do NOT populate.
  • And with still another version...everything works as it should.
In the screenshot, the header/footer content is nearly entirely CCs. "EPH" means the CC was filled in in an Even Page Header; "FPF" is "First Page Footer"; "OPF" is Odd Page Footer. The numbers are the fill-in order. Each of the three shots is based on a different copy of the same template.

I'm at a loss -- any light you can shed on the problem would be greatly appreciated.

If it helps, and you're so inclined, you can easily view the XML with OOXML Tools, a Chrome/Edge extension that allows you to drag the template into your browser and view the package; no zipping.

Thank you.
Attached Images
File Type: png 2022-12-16_22-38-34.png (54.8 KB, 13 views)
Attached Files
File Type: dotx 31-2 CC Testing.dotx (65.1 KB, 4 views)
Reply With Quote
  #2  
Old 12-17-2022, 05:10 AM
Charles Kenyon Charles Kenyon is offline Content controls bound to custom XML not updating Windows 11 Content controls bound to custom XML not updating Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

First, it is counter to Word's design philosophy to put things to be edited by the user in the header/footer of a template. The headers and footers should be picking up or reflecting information in the body of the document. IMHO, better practice is usually to use a cover page to hold the first instance of the Mapped Content Controls. That page need not be printed and could even be deleted after it is filled in.

With your different even and odd, I understand the desire to use mapped CCs to have the same information in all headers and footers.

Location of a CC in an even or odd header/footer should not cause problems. It is still linked to the XML part.

With the CC that does not replicate:
  1. Check the mapping.
  2. Try recreating it and copying to the other locations.
Screenshots do not convey the needed information about document structure. Can you attach a copy of the problem templates or documents based on the templates?
Reply With Quote
  #3  
Old 12-18-2022, 02:27 PM
Guessed's Avatar
Guessed Guessed is offline Content controls bound to custom XML not updating Windows 10 Content controls bound to custom XML not updating Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I'm not sure I would use Word's design philosophy as a relevant data point here. If you want mapped CCs in your header/footer then just do it (Nike's design philosophy).

I'm not seeing the behaviour the OP described in the dotx file that was posted. If this is not reproducible on other machines then I would investigate whether there are any macros running on that machine (perhaps try starting in safe mode and see if the problem still persists). The mention of the problem being with the last CC in the story makes me think perhaps you need to exit the CC (which writes to the xml field) before leaving the footer.

You might also want to verify that the CCs are mapped to the same xml field with a macro like this.
Code:
Sub AuditCCs()
  Dim aCC As ContentControl, aStory As Range
  For Each aStory In ActiveDocument.StoryRanges
    For Each aCC In aStory.ContentControls
      Debug.Print aCC.Title, aCC.Tag, aCC.Range.Text
      If aCC.XMLMapping.IsMapped Then
        Debug.Print "", "", aCC.XMLMapping.XPath
      End If
    Next aCC
  Next aStory
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #4  
Old 12-18-2022, 07:10 PM
Charles Kenyon Charles Kenyon is offline Content controls bound to custom XML not updating Windows 11 Content controls bound to custom XML not updating Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Thank you for the sample.
I am unsure why there is a delay in updating.
Try tabbing from one to another, rather than clicking in the Content Control.

My observation was that they all did update when I cycled through them.
Reply With Quote
  #5  
Old 12-18-2022, 10:57 PM
Peterson Peterson is offline Content controls bound to custom XML not updating Windows 10 Content controls bound to custom XML not updating Office 2019
Competent Performer
Content controls bound to custom XML not updating
 
Join Date: Jan 2017
Posts: 141
Peterson is on a distinguished road
Default

Thank you for the replies, and for poking at the template.

I ran Andrew's macro to confirm that all of the content controls are mapped to the same nodes.

I also rebuilt the content controls in a blank template based on a "pure," default Normal. I did a little testing and it seems to work. The only weirdness was, in one instance, when binding a node to a CC, in Developer view, only one of the blue brackets turned orange. Also, after binding CCs in the body of the doc, they didn't change to orange, but when I bound CCs to the same nodes in headers/footers, there they changed to orange, but back in the body, they didn't unless I re-mapped them to their respective nodes. Not sure if that's meaningful...

I have macros in my Normal template, but none auto-run or otherwise have anything to do with XML. Still, I'll move them elsewhere and rebuild the CCs in the actual template giving me trouble.


EDIT: Finally, in the past, I was tabbing/clicking out of the last CC (and the header/footer, if I was in one), but it didn't make a difference.



Thanks again for taking a look.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the best method to have multiple sets of bound content control in a document VGW Word VBA 2 07-12-2018 12:15 PM
Macro to save docx to doc that checks compatibility and converts content controls to static content. staicumihai Word VBA 4 10-12-2016 08:23 PM
Content controls bound to custom XML not updating Word XML Content Controls for custom XML output Daedalus Word 1 11-26-2015 01:38 PM
Content controls bound to custom XML not updating Updating an old form with Content Controls Something Anon Word 4 03-26-2014 03:53 PM
Content controls bound to custom XML not updating Content Controls Sammie0Sue Word 6 11-06-2013 10:56 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:43 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft