MS Office Forum / Word / Numbering / January 2006
Q: inserting LISTNUM levels in doc
|
|
Thread rating:  |
Malcolm Dew-Jones - 19 Jan 2006 19:26 GMT I am using Word 2000
I have LISTNUM fields in a document. When I wish to add a cross-reference then word displays a menu of listnums that looks very much like a table of contents from which to choose the link.
I want to embed something similar to that menu in my document.
It seems I can't just use a TOC because the TOC isn't based on the LISTNUM fields. (I played with footnotes (instead of listnum), but the hierachy of the listnum is important and word automatically rearranges the levels if the document changes, which is important to me.)
Suggestions on how best to do this would be appreciated.
E.G.
The document looks like this
1) This is about the widgets. 1.1) They are green and 1.2) they are old.
2) Also consider the gadgets. 2.1) They are red and 2.2) they are new, or 2.3) they have been refurbished.
Lets talk about the colour (see 1.1 and 2.1) of the different items in use, and their age (see 1.2, 2.2, 2.3).
I want to include a section at the end of the document that can be automatically updated (like a TOC) and that looks like
1) This is about the widgets. 1.1) They are green and 1.2) they are old. 2) Also consider the gadgets. 2.1) They are red and 2.2) they are new, or 2.3) they have been refurbished.
That is basically the same as what word shows in the cross reference dialog.
I did some quick experiments with VB, though I am not an expert in VB so some intelligent use of word options would be better.
Also, in VB, I can find each listnum field, but I don't see how to get the level numbers from the field after I find it.
Selection.NextField.Select Set my_obj = Selection
MsgBox (my_obj.Text) ' show the field contents my_obj.XXX how do I get the listnum level numbers?
As I said, suggestions on how best to do this would be appreciated.
Thanks, Malcolm
Dawn Crosier - 20 Jan 2006 18:26 GMT I would setup your listnums with a custom styles. Then you can use the TOC where you use only the style to set it up.
\t "Style,Level,Style,Level,..." Builds a Table of Contents from paragraphs formatted with styles other than the built-in heading styles. For example, {TOC \t "chaptertitle,1, chapterhead,2"} builds a table of contents from paragraphs formatted with the styles "chaptertitle" and "chapterhead". The number after each style name indicates the table of contents entry level that corresponds to that style.
 Signature Dawn Crosier Microsoft MVP "Education Lasts a Lifetime"
This message is posted to a newsgroup. Please post replies and questions to the newsgroup so that others can learn as well.
>I am using Word 2000 > [quoted text clipped - 59 lines] > > Thanks, Malcolm Malcolm Dew-Jones - 20 Jan 2006 21:23 GMT : I would setup your listnums with a custom styles. Then you can use : the TOC where you use only the style to set it up.
: \t "Style,Level,Style,Level,..." Builds a Table of Contents from : paragraphs formatted with styles other than the built-in heading [quoted text clipped - 3 lines] : indicates the table of contents entry level that corresponds to that : style. That's an interesting thing to know thanks, but the issues then are two fold.
Surely, to use that I first have to assign the correct style to each part of the text, which is a lot more manual work that just inserting the listnum field (one keystroke, correct level assigned automatically) plus occasionally increasing or decreasing the level (one more keystroke, tab or shift+tab, and again, the field automatically tracks the correct level when I do this). Also, if I rearrange the text (for example if a paragraph becomes subordinate to something else) then surely I would have to go through and change all the styles within the paragraph to change each level that was flagged, whereas the listnum field handles all the changes automatically.
I suppose I could write a VB macro to "raise" and "lower" the styles so as to sort-of automate the process of changing levels.
Or perhaps I misunderstand the capabilities of how styles work.
: This message is posted to a newsgroup. Please post replies and : questions to the newsgroup so that others can learn as well.
: >I am using Word 2000 : > [quoted text clipped - 59 lines] : > : > Thanks, Malcolm --
Malcolm Dew-Jones - 20 Jan 2006 22:09 GMT : : I would setup your listnums with a custom styles. Then you can use : : the TOC where you use only the style to set it up.
: : \t "Style,Level,Style,Level,..." Builds a Table of Contents from : : paragraphs formatted with styles other than the built-in heading [quoted text clipped - 3 lines] : : indicates the table of contents entry level that corresponds to that : : style.
: That's an interesting thing to know thanks, but the issues then are : two fold.
: Surely, to use that I first have to assign the correct style to each : part of the text, which is a lot more manual work that just inserting [quoted text clipped - 8 lines] : that was flagged, whereas the listnum field handles all the changes : automatically. In fact there is a third issue with using styles. It ties the look of the text into the level of the hierarchy that I am marking, but the two are not necessarily related that closely.
For example, in some places a section title (large font, centered etc) could correspond to what I consider a top level category, whereas in other places each of a list of items discussed in a paragraph (regular font, etc) will be what I consider a top level category.
If the document was created from scratch then that issue might be a flag to the writer that the logical arrangement of the document should be improved. However the documents already exist, and I just wish to mark them up for cross referencing and to generate a TOC-like list of the things of interest to me.
For some documents I will not even need to consider eveything in the document, and for them the hierarchy of my list may never completely correspond to the layout of the document even if the document could be rearranged.
I am thinking more and more that I need to use VB to solve this. I am thinking I will maintain my own TC markers, one for each listnum. Each TC would take its level from the level of the listnum (which Word maintains automatically) and the text of the TC would be copied from the text of the document following the listnum. I have automated most of that now by simply recording a macro and tweaking it, BUT I need to know the level of the listnum and I have not yet figured out how to get that information.
So, information on how to get the level of a listnum from within VB would be most appreciated. (This is word 2000).
Thanks, malcolm.
: : This message is posted to a newsgroup. Please post replies and : : questions to the newsgroup so that others can learn as well.
: : >I am using Word 2000 : : > [quoted text clipped - 59 lines] : : > : : > Thanks, Malcolm
: -- --
Dawn Crosier - 20 Jan 2006 22:40 GMT Malcolm -
I agree that if the document is volatile that styles may not work for you, however, styles is how I would format the list. I would be sure and setup a keyboard shortcut so that when I moved text around, I could easily re-assign the style. Frankly, the style would have no additional formatting than you already have in your document, but your next question was how do you find the actual number of the paragraph where you have applied ListNum:
Try this to see if it will return what you want it to do. http://word.mvps.org/FAQs/Numbering/ListString.htm
 Signature Dawn Crosier Microsoft MVP "Education Lasts a Lifetime"
This message is posted to a newsgroup. Please post replies and questions to the newsgroup so that others can learn as well.
> : : I would setup your listnums with a custom styles. Then you can > use [quoted text clipped - 153 lines] > > : -- John McGhie [MVP - Word and Word Macintosh] - 27 Jan 2006 21:02 GMT Tricky :-)
* You will HAVE to use the TOC Generator to compile the list -- it's the only one that will give you a result ordered by the position in the document in which the numbers appear.
* You can generate the TOC using either Styles or TC field tags. You cannot use the default TOC mechanism, which uses Outline Levels.
I would use Styles. Create a style for each level of numbering you require. You might name the styles "ListNum TOC 1", "ListNum TOC 2", etc...
When defining the style, make sure that the Paragraph Properties "Outline Level" field is se to "Body Text" (if it is not, the TOC generator will try to override your sequence when it compiles).
Apply the appropriate style to each of the ListNum paragraphs.
Now insert a TOC into your document. In Insert>Index and Tables>Table of contents, click the Options button (I'm working in Mac Word at the moment, so I would try to tell you exactly where these commands are, you'll find them easily enough...)
Make sure that the top option, "Build Table of Contents from..." is set to STYLES, and that the bottom on, "TC Fields" is set to OFF. It is also critical to ensure that that you specify a "Format" of "From Template" when you insert the TOC. If you specify any other format, Word ignores all your hard work and re-writes your specifications each time the TOC generates.
Each paragraph in a style you nominate here will be listed in your Table of Contents. Place an integer in the box beside each style name you want in the TOC. The integer determines the LEVEL at which the TOC Generator compiles paragraphs with the nominated style.
Set to blank in this dialog any style you do not want listed. You may find that the default styles Heading 1 through Heading 4 have numbers against them already: if they have, you should remove those numbers to prevent these styles being listed in your TOC.
Now: Is this going to be the main (only...) TOC in the document? If not, you will have to bookmark the section of the document that you want the TOC generator to compile entries for this particular TOC from, and specify the name of the bookmark (it's case sensitive, and no spaces allowed...) correctly in the TOC field.
The user interface may not allow you to do this (depending on your version of Word) you may have to switch on Field Codes and insert the syntax by hand. You only have to do this once: once you have edited the field codes generating the TOC field, they will stay correct. Obviously you are aware that editing the text of the TOC is utterly pointless: the text is removed and replaced each time the TOC regenerates.
I did say you could also do this by adding TC tags around each piece of text you want to appear in the TOC. I would go to any lengths to avoid this, because putting the tags in is such a laborious task, and maintaining them as you edit the document is an absolute PITA. But you "can" do it if you have a high tolerance for pain. The only time I would use TC fields is if I want the style of the text in the body of the document to be independent of the level of the resulting entry in the TOC (e.g. To have entries from Heading 2, Heading 3 and Heading 4 paragraphs to appear at TOC level 2). Wanting that sort of thing is a bit like wanting your neighbour's wife: it indicates there is something very wrong with the fundamentals of your document design :-) I work very hard to ensure that I never want that :-)
Get back to us if you need any more help.
On 19/1/06 7:26 PM, in article 43cfe7f7$1@news.victoria.tc.ca, "Malcolm Dew-Jones" <yf110@vtn1.victoria.tc.ca> wrote:
> I am using Word 2000 > [quoted text clipped - 58 lines] > > Thanks, Malcolm
 Signature Please reply to the newsgroup to maintain the thread. Please do not email me unless I ask you to.
John McGhie <john@mcghie.name> Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer Sydney, Australia +61 (0) 4 1209 1410
|
|
|