Microsoft Developer Network >
Página principal de foros
>
Visual Studio Tools for Office
>
Post-process the result of the INDEX
Post-process the result of the INDEX
- Dear friends,
I had an issue with word indexing . I had posted my question initially in "word general questions" which is below for your reference
"> I have a question is indexing.. If i am doing indexing for integer/numeric
> starting values like "1-North street" its displaying in index under the
> heading "1".
>
> Is there any option to display all the numeric starting values under a
> common heading(say numerics)????"
and the reply i have got from few is
"I think there isn't. You'd have to post-process the result of the INDEX
field each time you update the index.
If you need this functionality a lot, a macro doing the post-processing
(basically deleting all the 1/2/3/... headings in the TOC and inserting
one "Numerics" heading) is certainly feasible."
I am not exactly able to catch up the point here. Do anybody got worked out samples for this issue?
Thanks in advance.
Respuestas
- Hi Karthik
I don't have any code for this - I've never tried this particular exercise...
What the person answering means is that you need to "walk" the Index entries (TOC was probably just a lapse of concentration) - probably paragraphs, but it will depend on the type of Index. Where you find a number as the first character of an entry, your code would delete that and any other extraneous characters (dashes, spaces, etc). Do that until the numbers stop.
At the same time, also delete the "section heading" for each number (1, 2, 3, etc).
And, of course, at the top insert the "section heading" you want to see.
As the person notes, this code would have to be run again everytime the Index is updated. This is because updating a field will erase any editing done to the field text.
Cindy Meister, VSTO/Word MVP- Marcado como respuestaTim LiMSFT, Moderadorjueves, 09 de julio de 2009 2:38
- Hi Karthik
In that case, all you need to do is delete those headings and insert your own. The field result can be manipulated just like any other text in the document. What you do just isn't "permanent" (will be lost when the field updates).
Cindy Meister, VSTO/Word MVP- Marcado como respuestaTim LiMSFT, Moderadorjueves, 09 de julio de 2009 2:38
Todas las respuestas
- Hi Karthik
I don't have any code for this - I've never tried this particular exercise...
What the person answering means is that you need to "walk" the Index entries (TOC was probably just a lapse of concentration) - probably paragraphs, but it will depend on the type of Index. Where you find a number as the first character of an entry, your code would delete that and any other extraneous characters (dashes, spaces, etc). Do that until the numbers stop.
At the same time, also delete the "section heading" for each number (1, 2, 3, etc).
And, of course, at the top insert the "section heading" you want to see.
As the person notes, this code would have to be run again everytime the Index is updated. This is because updating a field will erase any editing done to the field text.
Cindy Meister, VSTO/Word MVP- Marcado como respuestaTim LiMSFT, Moderadorjueves, 09 de julio de 2009 2:38
- Cindy,
Here i don't need to modify the entries. let the entries be starting with numerics or extraneous characters, but i need to change all those numeric entries to be displayed under a common heading.
Thx in advance
Karthik
- Hi Karthik
In that case, all you need to do is delete those headings and insert your own. The field result can be manipulated just like any other text in the document. What you do just isn't "permanent" (will be lost when the field updates).
Cindy Meister, VSTO/Word MVP- Marcado como respuestaTim LiMSFT, Moderadorjueves, 09 de julio de 2009 2:38
- Hi Cindy,
Is there any macro or sample available to get the headings of the index?
-karthik I know of none. In any case, it's going to depend on exactly how the Index is generated (the particular properties used).
Cindy Meister, VSTO/Word MVP

