1

I have a document:

Heading 1
    Heading 2
        Heading 3
          Body Text

How can I, in the body text, get the names of each of the parent, grandparent (etc) heading to form a sentence like this:

Section 1: Heading 1 -> Heading 2 -> Heading 3

I'm comfortable using macros,fields and the like, if that's what's required.

2

First, for the section:

  1. Set your cursor at the point you want to insert your text. Type the word "Section" and add a space.
  2. Bring up the Field dialog (try Alt,N,Q,F; or from the Insert tab, in the Text group, click on Quick Parts and select "Field").
  3. From the Categories: dropdown, select "Numbering".
  4. Select "Section" from the Field names: dropdown.
  5. From the Format: dropdown in the top-middle of the dialog, select "1, 2, 3, ..."
  6. Click the OK button. It adds the section number.
  7. Add your colon and space.

Follow these steps for each heading:

  1. Bring up the Field dialog per the previous steps.
  2. In Categories:, select "Links and References".
  3. In Field names:, Select "StyleRef".
  4. From the Style name: dropdown in the top-middle of the dialog, select the desired style (starting with "Heading 1").
  5. Click the OK button. It adds the text of the selected Heading style.
  6. Add your arrow.
  7. Repeat these steps for the other two headings.
0
1

Just use the following field codes set up like this:

Section 1: {styleref "heading 1"} -> {styleref "heading 2"} -> {styleref "heading 3"}

The style reference code will always pick up the last instance of when the style was used. To insert the field codes, select ctl + F9. After you insert the code, click on each one and select F9. You can copy and paste that in for each section in your report.

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.