Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
Word Automation - Table of Contents.MarkEntry
I am using the MARKENTRY method to insert TablesOfContents entries into a Word Document. My basic problem has been getting the entries to go exactly where I insert them. They tend to "fall" to the end of the section in which they are inserted regardless of exactly where within that section that I place the inserting code.
However, this code works ...
oRange.InsertAfter("Technology Assessment Scope"+CR)
oDoc.TablesOfContents.MarkEntry(oRange,"Technology Assessment Scope",,,1)
oRange.Font.Name="Arial"
oRange.Font.Size = nBaseFontSize+1
oRange.Font.Bold=1
oRange.Underline=wdUnderLineSingle
oRange.Collapse(wdCollapseEnd)
However, the problem with using that code is that the entry within the Table of Contents takes on the characteristics which were assigned immediately after that MarkEntry statement.
So I thought, I would give my MarkEntry its own separate characteristics like this ...
oRange.InsertAfter("Technology Assessment Scope"+CR)
oRange.Font.Name="Arial"
oRange.Font.Size = nBaseFontSize+1
oRange.Font.Bold=1
oRange.Underline=wdUnderLineSingle
oRange.Collapse(wdCollapseEnd)
oDoc.TablesOfContents.MarkEntry(oRange,"Technology Assessment Scope",,,1)
oRange.Font.Name="Arial"
oRange.Font.Size = 11
oRange.Font.Bold=0
oRange.Underline=wdUnderLineNone
oRange.Collapse(wdCollapseEnd)
Seems logical ... but not quite. It seems that it does give the proper characteristics to the MarkEntry lines, it also causes the Table of Contents Code to fall back down to the end of the Section marker instead of having it inserted exactly where I issued the command.
I have tried many, many, different permutations of these concepts and have not been able to come upon a method to accomplish this. Maybe it cannot be done.
I know this is not standard stuff but I am hoping there is a Word Automation Guru with the answer.
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement