Thread: [Solved] Conditional Style ref
View Single Post
 
Old 02-12-2017, 08:56 AM
slaycock slaycock is offline Windows 7 64bit Office 2013
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default Conditional Style ref

I have a long document with multiple sections. I am using Styleref fields in the header to cross refer to heading styles chaper and subchapter

e.g.
Line 1 { styleref "Heading 1" \n} {styleref "Heading 1"}
Line 2 {Styleref "Heading 2" \n} {styleref "Heading 2"}

I have encountered two problems

1. Sometimes there is no sub chapter

In this case I would like the heading 2 styleref to be blank but unfortunately Word seems to search past the next Level 1 heading to return the Level 2 heading of the next chapter.

Eg you get

1 A chapter heading
2.1 A chapter heading too far.

where there is no sub chapter 1.1

Is there any way I can persuade Word to make the sub charter references blank in the above case.

2. In some cases the Heading 2 style precedes the heading 1 so I have to use the \l switch

But this is frustrating as I want the same fields in each section heading, I don't want to have to scan through the document each time we make changes to see if I need to remove the \l switch.

So I think this is a feature request for the Styleref field

The searching for the styleref reference should respect the outline level of the style if it is not BodyText and only search backwards or forwards within the context of the outline level of the styleref field.

In the meantime I can write yet another macro to search headings to detect both of the cases above and make the necessary changes to the document.
Reply With Quote