Copy link to clipboard
Copied
Hi Guys
Is it possible for the TOC tool to ignore anchor objects? Just bring the text, (pure text)...
TOC is created pushing text styles that you choose. To bring anchor objects it looks like strange.
Hi Bob,
here a little code snippet that will remove all anchored frames from a selected text frame and its parent story ( in case the TOC is running through several text containers ) :
app.selection[0].parentStory.pageItems.everyItem().remove();
Written in ExtendScript (JavaScript).
How to save code and install a script:
Indiscripts :: Indiscripts for Dummies
Regards,
Uwe
Copy link to clipboard
Copied
The short answer is "no."
As far as InDesign is concerned an anchored object IS part of the text in the paragraph where it is anchored, so it must be included, but perhaps (I have not played with this, so I don't know) you can include a conditional text attribute on the anchored object and hide it in your TOC style.
If that fails to work, the old standby of making a duplicate, but non-printing, entry on your page, with a different style that is used for TOC instead of the one with the anchored object is one possible option. Another might be to put the anchored object into its own paragraph with a different style, but that would require it to be anchored as the first or last character in its current paragraph.
More info, perhaps a screen shot, will probably get you better advice.
Copy link to clipboard
Copied
I've had to work on a couple of projects like this and found the easiest method is to generate the TOC as the very last thing and then delete any anchored objects. If you do this all the time, you might want to pop over to the scripting forum and see if anyone can help with a script.
Copy link to clipboard
Copied
Hi Bob,
here a little code snippet that will remove all anchored frames from a selected text frame and its parent story ( in case the TOC is running through several text containers ) :
app.selection[0].parentStory.pageItems.everyItem().remove();
Written in ExtendScript (JavaScript).
How to save code and install a script:
Indiscripts :: Indiscripts for Dummies
Regards,
Uwe
Copy link to clipboard
Copied
That’s great. Thanks, Uwe!
Copy link to clipboard
Copied
Reminder:
TOC includes only inline anchored objects.
Custom position anchored object are ignored by TOC.
Copy link to clipboard
Copied
Hi,
After having created the TOC a first time, just play this script to update … (the anchorings included in the TOC are all removed).
No need TOC text frame selection.
Dropbox - _FRIdNGE-0306_UpdateTOC.jsxbin
Best,
Michel, from FRIdNGE
["For free" script]