Skip to main content
Liphou
Inspiring
June 7, 2021
Question

[JS] Toc makeAnchor

  • June 7, 2021
  • 4 replies
  • 883 views

Good morning all How is it possible to retrieve the information from the anchor text (make text anchor in source paragraph.) That the table of contents insert when the option is checked?

 

I have nothing on the command:

leDoc.hyperlinks[lePosition].properties

and no longer on:

leDoc.hyperlinks[lePosition].destination.properties

 

thank you

Liphou

 

Bonjour à Tous

Comment est-il possible de recupé les informations de l'ancre de texte (make text anchor in source paragraph.) que le table des matière inser quand l'option est coché ?

 

je n'ai rien sur la commande :

leDoc.hyperlinks[lePosition].properties

et non plus sur:

leDoc.hyperlinks[lePosition].destination.properties

 

merci à vous

 

Liphou

 

This topic has been closed for replies.

4 replies

Liphou
LiphouAuthor
Inspiring
June 14, 2021

Hello, is it possible to change the # in the palette to something else?

 

Bonjour est-il possible de changé le # dans la palette par autre chose ?

Community Expert
June 14, 2021

Thanks, Peter!

Ok, I did some more tests at the weekend and started from scratch. So:

 

makeAnchor is adding hyperlinkTextDestinations to a document.

With a distinct name that has some numbering in it:

_idTOCAnchor-n

where n is the number.

 

The thing is, that all the hyperlinkTextDestinations are not removed from the document if you do a new TOC with a new TOCStyle where makeAnchor is set to false. That was my source of confusion first and where I was wrong when I stated that nothing changes in the document when you set makeAnchor to true or false. I started with a test where I first set makeAnchor to true, then set makeAnchor to false.

 

Back to Liphou:

If you want to update a TOC with a changed TOCStyle or an edited documents, e.g. you want no headline in your TOC, but only subhead and you would like to minimize your hyperlinkTextDestinations to the needed ones, you could consider first to remove all hyperlinkTextDestinations with that _idTOCAnchor-n name and then update the TOC.

 

Regards,
Uwe Laubender

( ACP )

Liphou
LiphouAuthor
Inspiring
June 14, 2021

Hi Peter

yes it's for the ePub, I wanted to recover them so as not to recreate them

oui c'est pour l'ePub, j'aurai voulus les récupérer pour ne pas les recrées

Community Expert
June 11, 2021

Hi Liphou,

are you sure that you are really after the option

"Make text anchor in source paragraph" ?

 

That feature was introduced with InDesign version 9. The first version of Creative Cloud.

Before, e.g. with InDesign CS6 version 8, this feature did not exist.

 

Nevertheless, InDesign's TOC feature added hyperlinks to a document when the TOC was built in CS6.

With text anchors in the source paragraphs. And this is still the case with InDesign CC 2021.

 

 

hyperlink.source.sourceText
hyperlink.source.name

 

 

should give you the needed information.

 

And you will see, that:

 

hypelink.visible

 

returns false in the case of a hyperlink that was added with the TOC functionality of InDesign.

 

 

hyperlink.destination

 

 

will return a HyperlinkPageDestination.

 

You now know the building blocks of a Table Of Contents in a document.

 

FWIW:

"Make text anchor in source paragraph" is an option, it is part of a TOCStyle and was, as I already said, introduced with InDesign version 9. In the ExtendScript DOM you can turn that option on and off with:

 

TOCStyle.makeAnchor

 

Set makeAnchor to true or false. It has no influence on adding hyperlinks to the document when a TOC is added or updated.

 

What's left? Hm…
What is the real purpose of option "Make text anchor in source paragraph" in a TOC style?

My guess is, this is for an output format like EPUB perhaps. Documentation does not mention this option at all:

https://helpx.adobe.com/in/indesign/using/creating-table-contents.html

 

And DOM documentation does not tell a bit more:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#TOCStyle.html

 

Maybe I detected a glimpse of information in James Wamser's New Features of InDesign pdf:

 

Adobe InDesign CC | June 17, 2013
Version 9.0
EPUB enhancements
New features make it easier to produce high-quality EPUB files from InDesign.

You have greater control over the table of contents and CSS export, and CSS editing is simpler.…

 

Regards,
Uwe Laubender

( ACP )

Peter Kahrel
Community Expert
Community Expert
June 13, 2021

Hi Uwe,

 

>What is the real purpose of option "Make text anchor in source paragraph" in a TOC style?

>My guess is, this is for an output format like EPUB perhaps

 

Correct: InDesign uses it to create a multi-level TOC when a document is exported to Epub.

 

P.

Community Expert
June 9, 2021

Hi Liphou,

I'm a little confused. What exactly are you after?

Could you post a screenshot showing that part of a TOC with invisible characters and the Story Editor window?

What information do you want to retrieve?

 

Thanks,
Uwe Laubender

( ACP )

Liphou
LiphouAuthor
Inspiring
June 10, 2021

 

 

 

Hello Laubender,

I am trying to retrieve the information on the text anchors that the table of contents when the option is selected: "Create a text anchor in the source paragraph", retrieve the information on these Anchors which links them with the table.

 

Merci

 

Liphou

 

Bonjour Laubbender,

 

Je cherche à récupérer les informations sur les ancres de textes que la table des matièrs quand l'option est selectioné : " Créer une ancre de texte dans le paragraphe source", récupérer les information sur ces Ancres qui les lie avec la table.