![]() |
|
#1
|
|||
|
|||
![]()
Hello, a question about tables of contents with if conditions.
I have a document with chapters and subchapters. The document has two tables of contents: a short one (only the main heading) and a detailed one (with headings and page numbers). Now I want to ensure that the second detailed table of contents is not output if the short and detailed ones match. I have the following field code: {if {\TOC \t "Heading 2;1" \b inh_kap0_2 \o "2-2" \n "1-1" } = {\TOC \t "Heading 2;1;Heading 3;2" \b inh_kap0_2 \o "2-3" \n "1-1" } "" {\TOC \t "Heading 2;1;Heading 3;2" \b inh_kap0_2 \o "2-3" \n "1-1" \* mergeformat}} This works very well. Now I would like to create a detailed and linked table of contents. But, if I add the \h switch, so {if {\TOC \t "Heading 2;1" \b inh_kap0_2 \o "2-2" \n "1-1" } = {\TOC \t "Heading 2;1;Heading 3;2" \b inh_kap0_2 \o "2-3" \n "1-1" } "" {\TOC \h \t "Heading 2;1;Heading 3;2" \b inh_kap0_2 \o "2-3" \n "1-1" \* mergeformat}} There is still no link. I read that in \toc fields with if conditions the \h doesn't work. Is there another way to do this anyway? To reach links in the table of contents? Or works that, if at all, only via VBA code? Thank you for your support. Laurel |
#2
|
||||
|
||||
![]()
As you've discovered, the \h switch doesn't work inside an IF statement. I don't believe there's a field coding workaround for what you're trying to do.
A macro could be used to compare the two Tables of Contents and delete or hide the second one if they match, but that's probably about as far as you could go
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Thank you, Paul. Unfortunately that's not what I want. But I'll try.
|
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
sumProduct with OR condition | ShostyFan | Excel | 7 | 10-16-2019 02:19 PM |
![]() |
jhansrod | Word VBA | 8 | 06-15-2019 05:59 AM |
![]() |
LearnerExcel | Excel | 1 | 12-19-2016 02:14 PM |
![]() |
karti | Word | 2 | 03-15-2011 06:06 AM |
Retrict Method Condition | markp | Outlook | 0 | 12-22-2005 05:38 PM |