TL;DR: Cross-References to the Heading Text of a Heading-styled paragraph are incredibly fragile and don't survive in the real world where users edit text. Terrible workaround: Make all edits to the non-last word in the heading-styled paragraph. How can we simply and reliably cross-reference heading text in an environment where users are not Word experts?

Hi. This one is a doozy from a user-experience perspective, because it's really hard to justify this behaviour. Users of this template must be able to create cross-references to procedure titles within the document. Procedure titles are Heading 7. Headings are not (and will not be) numbered in this template.

Initial condition: enter image description here

The Task column will be numbers representing the order of operations. The Procedure column will contain the Procedure Title. You can guess what the Page column is for.

Expected workflow: User places cursor in the Procedure row > References > Cross-reference > Reference type=Heading > For which heading=Procedure Title > Insert reference to=Heading Text; repeat for Insert reference to=Page number. enter image description here

Results are exactly as expected: enter image description here

Here's where it goes all wrong. User then changes the text of Procedure Title (the paragraph mark is untouched) and updates the cross-reference: enter image description here

We get Error! Reference source not found. Arrgh.

Similar problems have been resolved by making the cross-reference to Reference type=Numbered Item/Insert reference to=Paragraph text. However, these headings will not be numbered, so that's not an option. enter image description here

Trial, error, and XML have revealed an unexpected behaviour. The cross-reference to Heading Text appears to be not to the heading text, but to the range of the heading text that was present when the bookmark was initially created. If it's changed in any way other than something ridiculously specific for the real world, the range does not update and the bookmark will fail.

Here's the XML of the freshly-inserted cross-references: enter image description here

And here's the XML of the cross-reference targets, wrapped with bookmarkStart and bookmarkEnd: enter image description here

Everything is wonderful.

Now we update the Procedure Title to New Text and update the references. (For sake of reducing the screen cap volume, I'm only updating and screen capping the reference to Heading Text. But it's the same basic problem for the reference to Page Number even though the error text is now inexplicably worded Error! Bookmark not defined..) enter image description here

enter image description here

enter image description here

This is stupid. Everything that identifies this range as a bookmark is gone. A user expects to be able to update text and references to the text should not be destroyed – or in this case, the reference anchors should not be destroyed. Those bookmarkStart and bookmarkEnd tags surround the range, but edits to the range text level destroy their surroundings. Whatever technical justification there may be for this is irrelevant* because the user experience is utterly terrible.

*Example: When editing existing text, a new range is created to hold the edits and an rsidR identifies the individual edit range for change tracking and doc merging purposes. But the bookmarkStart and bookmarkEnd tags do not surround the net range, which is what a user would expect – they remain statically wrapping the remnants of the original range.

I found a circumstance where this works as one might expect! (the "something ridiculously specific" I mentioned an hour ago). If the user edits or replaces existing non-last words, it works. It also works when edits are prepended to the last word. (See green highlights.) BUT! If changes are appended to the last word, the last word is replaced, or new text is added after the last word, it falls outside the range and fails. If the text is entirely replaced (as above), the entire range is replaced. The bookmarkStart and bookmarkEnd do NOT react well to changing real-world usage as a normal human being would expect. enter image description here

So… what's the simple and reliable answer to cross-referencing heading text? Do I tell users to re-create the cross-reference every time they update the heading text? They (almost) might as well not make cross-references then.

BTW thanks for listening to me rant. :-)

PS: A TOC isn't the answer. The order in which each Procedure Title is listed in the document isn't necessarily the order in which they'll be listed in the table. The tasks involved in changing a car's tire are identical; the order of the tasks determines whether you're taking the tire off or putting it on.

Cross-posted to: https://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-mso_other-mso_2010/cross-reference-to-heading-text-of-heading/219ea22a-12de-4df8-b76e-a715ddd6eccb?tm=1556143226993

Similar to: Microsoft word - How to prevent/fix cross-reference Error! Reference source not found


Doug Robbins and Jay Freedman answered at my cross-post and both confirmed there is no user-friendly solution. There are two options:

  1. Recreate the cross-reference after editing the heading text.
  2. Edit the heading text up to, but NOT including the last character. Confirm the cross-reference, then delete the last character using the Delete key (not Backspace) in order to preserve the bookmarkStart and bookmarkEnd assigned to that range.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.