Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC: Different formats on Text and dots/numbers
If a create the TOC and format its styles, I will get a TOC seemed to this
picture (http://img241.imageshack.us/img241/6...cbeforelw3.jpg) Well, I'd like to format a TOC with this result (http://img250.imageshack.us/img250/2145/tocafterai5.jpg) Is there any solution to keep this format even though I update the TOC? Because if I do this TOC and manually change the format of the dots and numbers, when I update the TOC, the work will be overrided. |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Different formats on Text and dots/numbers
Unfortunately, there is no way to achieve this in current versions of Word
(except by applying the formatting after editing is complete and the TOC has been unlinked or locked). This is one of the improvements that is on the MVP Wish List for Word 14 that is currently being prepared. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Anderflash" wrote in message ... If a create the TOC and format its styles, I will get a TOC seemed to this picture (http://img241.imageshack.us/img241/6...cbeforelw3.jpg) Well, I'd like to format a TOC with this result (http://img250.imageshack.us/img250/2145/tocafterai5.jpg) Is there any solution to keep this format even though I update the TOC? Because if I do this TOC and manually change the format of the dots and numbers, when I update the TOC, the work will be overrided. |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC: Different formats on Text and dots/numbers
As Suzanne said, there is no easy way to obtain what you want using the
built-in functionality. However, it is possible to obtain what you want using a macro. The macro below should do the job without changing your current TOC style definitions. The macro: - unlocks the TOC (corresponds to Ctrl+Shift+F11) - updates the TOC - runs through all paragraphs in the (first) TOC and applies black color to all the tab leaders and page numbers (provided the TOC looks like the one in the JPG file to which you linked) - locks the TOC (corresponds to Ctrl+F11) The macro needs to be adjusted if the preconditions change. Sub UpdateFormatAndLockTOC() Dim oPara As Paragraph Dim oToc As TableOfContents Dim orange As Range Set oToc = ActiveDocument.TablesOfContents(1) 'unlock and update TOC oToc.Range.Fields.Locked = False oToc.Update For Each oPara In ActiveDocument.TablesOfContents(1).Range.Paragraph s 'exclude text until tab is start of range - tab = chr(9) Set orange = oPara.Range With orange If InStr(1, orange.Text, Chr(9)) 0 Then Do While .Characters.First Chr(9) .Start = .Start + 1 Loop 'Now range is correct, change color .Font.Color = wdColorBlack End If End With Next oPara 'Lock TOC again oToc.Range.Fields.Locked = True Set oToc = Nothing Set orange = Nothing End Sub -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "Anderflash" wrote: If a create the TOC and format its styles, I will get a TOC seemed to this picture (http://img241.imageshack.us/img241/6...cbeforelw3.jpg) Well, I'd like to format a TOC with this result (http://img250.imageshack.us/img250/2145/tocafterai5.jpg) Is there any solution to keep this format even though I update the TOC? Because if I do this TOC and manually change the format of the dots and numbers, when I update the TOC, the work will be overrided. |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Different formats on Text and dots/numbers
Well, applying direct formatting (or a character style) to all
top-level headings should create the desired result. -- Stefan Blom Microsoft Word MVP "Suzanne S. Barnhill" wrote in message ... Unfortunately, there is no way to achieve this in current versions of Word (except by applying the formatting after editing is complete and the TOC has been unlinked or locked). This is one of the improvements that is on the MVP Wish List for Word 14 that is currently being prepared. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Anderflash" wrote in message ... If a create the TOC and format its styles, I will get a TOC seemed to this picture (http://img241.imageshack.us/img241/6...cbeforelw3.jpg) Well, I'd like to format a TOC with this result (http://img250.imageshack.us/img250/2145/tocafterai5.jpg) Is there any solution to keep this format even though I update the TOC? Because if I do this TOC and manually change the format of the dots and numbers, when I update the TOC, the work will be overrided. |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Different formats on Text and dots/numbers
Hmm, this assumes that the OP wants *the same* formatting in the TOC
as in the headings themselves, which isn't necessarily true. -- Stefan Blom Microsoft Word MVP "Stefan Blom" wrote in message ... Well, applying direct formatting (or a character style) to all top-level headings should create the desired result. -- Stefan Blom Microsoft Word MVP "Suzanne S. Barnhill" wrote in message ... Unfortunately, there is no way to achieve this in current versions of Word (except by applying the formatting after editing is complete and the TOC has been unlinked or locked). This is one of the improvements that is on the MVP Wish List for Word 14 that is currently being prepared. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Anderflash" wrote in message ... If a create the TOC and format its styles, I will get a TOC seemed to this picture (http://img241.imageshack.us/img241/6...cbeforelw3.jpg) Well, I'd like to format a TOC with this result (http://img250.imageshack.us/img250/2145/tocafterai5.jpg) Is there any solution to keep this format even though I update the TOC? Because if I do this TOC and manually change the format of the dots and numbers, when I update the TOC, the work will be overrided. |