View Full Version : Solved: Two Ref Field Codes on one line in Word 2007
Bernadette
08-29-2011, 08:44 AM
Hello,
I need to create a Table of Contents that links to paragraph numbers (not page numbers).
I was not able to using the Heading styles so I inserted bookmarks for the Titles I want to refer to. Then I created a cross reference to the bookmark put in a dot leader tab and cross referenced a Numbered Item and referred to the Paragraph Number. This works fine, however when I update the link I lose the dot leader tab and the second cross reference.
I Introduction............................................................... ......................... [1]
Any ideas on how I can keep the tab and the second cross reference?
Thanks!
Frosty
08-29-2011, 12:04 PM
I don't think what you want is possible without writing a custom macro (I can't think of a way to do this with just formatting and use of built-in xref/TOC functionality).
None of the natively-supported tables (contents/figures/index/authorities) will automatically put anything but a page number to the right. And since they are all, technically, a single field code in a single paragraph (try ALT+F9 to see what's going on behind the scenes in a TOC), anything you manually put to the right of a specific level within the TOC will be lost when you update (which is what you're experiencing).
And if you manually build this with a macro... the ability to automatically update with a native word function would be lost.
It's a big "strange" (not a judgement, just a comment) to request to have an automatically updating table which shows:
[paragraph number in one format][tab][paragraph title][tab][same paragraph number in a different format]
like you're requesting. To have the following:
I. Introduction ....................... 1
II. Summary ........................... 2
Show up when both your introduction and summary paragraphs are on the same page seems somewhat repetitive and potentially confusing, doesn't it? Can't you just have...
I. Introduction
II. Summary
That is native functionality (simply by hiding page numbers in an automatically generated TOC).
You can, of course, write a macro to do anything... and, in fact, it would be fairly easy to do this manually by simply utilizing an existing TOC, "breaking" the field into regular text, and then appending a tab character and a number... but, as you have already discovered, you would be unable to update this automatically (you'd have to identify the range of your "broken" TOC, whether by content control or some other mechanism like a table cell), and then regenerate through the use of another macro.
Unless I'm misunderstanding your post... perhaps you can make a mock-up document with a couple of headings and a table of the way you want it to look and attach that document?
Bernadette
08-29-2011, 02:57 PM
Hello Frosty,
Thanks again for your help. I have attached a Word document as an example of what I'm trying to achieve.
Bernie
Frosty
08-29-2011, 03:24 PM
You have...
I. Introduction
[1] paragraph 1
[2] paragraph 2
[3] Paragraph 3
II. Summary
[4] paragraph 4
And you want your pseudo-TOC to look like...
I Introduction [1]
II Summary [4]
So what you really want is the paragraph number of the paragraph immediately following each heading? I think you need to set up a two column table with a single row... and put your TOC paragraph in the left column, and your paragraphs with xrefs in the right column.
You may need to play around with the spacing, etc... but I've added a demo to the top of this document to show you what I mean. The important things to note are:
1. You could still build this off of heading styles, although this sample doesn't (it does builds off of your "Titles" style so you can see the difference between what you have and what I added).
2. It involves a fair amount of manual "trickery" (i.e., this TOC still has page numbers so that you automatically get your dot leader, but I've moved the tab stop for TOC1 off to the right so that the page numbers are "hidden" behind the table cell. This may cause issues when redlining a document, depending on whether/how you do that. It also means you'll get prompted to update "just the page numbers" when there are no page numbers to be seen.
3. It involves an additional tab leader set up in the right column (and the requirement for manually inserting a tab character in a table cell by using CTRL+TAB, since just hitting the TAB key in a table cell will take you to the next cell, rather than inserting a character).
4. I kept your "Paragraph No." heading outside of the table deliberately, so that you can more easily select the right "column" in order to adjust your tab formatting. Your mileage may vary... and obviously setting up a style for that table cell would probably be useful.
This solution still requires a manual inserting of a xref to the right paragraph. The good thing is-- the xrefs and TOC can update. The bad thing is: xrefs can break, and if you don't fully understand how they can break, it can be summed up as follows: always insert new paragraphs AFTER an existing paragraph (having your cursor at the end of a paragraph) rather than BEFORE an existing paragraph (having your cursor at the start of a paragraph). If your users don't understand this process, or you have to train them to understand it... this solution becomes even clunkier than it already is.
The short answer is: this still isn't terribly easy or foolproof.
Hope this helps.
- Jason
Bernadette
08-29-2011, 04:30 PM
I think you're a genius! I won't have to worry about cross referencing to a numbered item as I selected the paragraph mark and made that a bookmark and linked it to that.
Thank you so much for your help it is greatly appreciated.
I attached the revised document.
Bernadette
08-29-2011, 04:42 PM
I just realized there is still a problem with the bookmarks because depending where you press Enter the bookmark may not be in the right place...
Paul_Hossler
08-29-2011, 04:44 PM
I think you're a genius!
Oh, great ... now you'll give him a swelled head :devil2:
Seriously, tho .. that was pretty clever
Paul
Bernadette
08-29-2011, 04:47 PM
Instead of selecting the paragraph mark I just put the bookmark in front of the paragraph mark and this seems to work.
Thanks again!!!
Frosty
08-29-2011, 05:01 PM
Haha, thanks for the compliments. Either way though, it's breakable. It's just a question of how you want your end-users to interact with the document. I actually thought your method was a pretty clever solution, since it takes a little longer to "break" the bookmark your way.
But no matter what, at some point during the life of the document... that bookmark is going to break (either be deleted or be in the "wrong" paragraph-- your current method "breaks" if you insert a new "Introduction Paragraph 1" by hitting the ENTER key at the end of your Introduction paragraph), and thus the field referencing the bookmark will break too (it will either have no bookmark to reference, or be pointing at the wrong paragraph).
The question is: what do you want your end-user to do to "fix" the broken bookmark?
1. Use the native xref function to re-insert the right reference, which can easily be identified by the numbered heading above it, or...
2. Use the insert bookmark function to redefine (user-friendly with good bookmark names like you have in the sample document) or recreate (not so friendly, since you need to know the right name)
3. Have a macro which does the whole process for you.
This is, ultimately, a judgement call by you based on the end-users you have working on the document, and their level of training.
Keep playing around with the alternatives, and keep trying to delete/recreate/edit paragraphs so that you've wrapped your mind around all the potential pitfalls. It looks like you're already doing that-- but just know that there is no perfect "solution" -- only something which breaks the least for your users.
Also, it will help if you try out the xref methodology, and then click that "show hidden bookmarks" checkbox and clicking the "Go To" button, to see what they actually represent. As you play around with the paragraphs, you'll see the various ways the bookmarks (hidden or not) get confused just by normal end-user interaction of creating/deleting paragraphs.
It's a tough call. I've gone with the "insert xref" methodology in the past because I generally try to work within Word's native functionality. However, that insert xref dialog is so unfriendly in a heavily numbered document, that I rebuilt it with a couple of extra bells and whistles (allowing the ability to collapse/expand by heading level, to allow easier navigation).
If that's something you'd be interested in, I can post a sample, although it would take me a little bit to extract it.
Frosty
08-29-2011, 05:10 PM
Oh, one additional note about the whole "broken" bookmark concept. It's the beginning of the bookmark that matters.
1. [Parargaph
2. Paragraph
3. Paragraph]
A bookmark which has "broken" could span multiple paragraphs like above-- but the xref to that bookmark will reference the first paragraph. In your case, this is a good thing, since you almost always want that first paragraph.
If you can train your users to handle the first paragraphs following a heading "gently" (i.e., if they need a new one, they shouldn't insert a new one, just edit the existing)... your methodology should work 90% of the time (which would be pretty good)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.