Article View: adobe.scripting.indesign
Article #2423Re: [CS4 JavaScript] Cross references
From: Dave_Saunders
Date: Thu, 18 Dec 2008 17:42
Date: Thu, 18 Dec 2008 17:42
15 lines
1648 bytes
1648 bytes
Yes.
But finding them in the Object Model is an interesting challenge because they're not called cross references, they're called hyperlinks. Here's a snippet of code I used to make a cross reference using a format I called "Page Number Only" that I had previously created (manually in the UI):
var destination = doc.hyperlinkTextDestinations.add(dest, {name:termName});
var xRefForm = doc.crossReferenceFormats.item("Page Number Only");
var sourceText = getSource(para);
if (sourceText == null) {return } // I don't think this can happen, but just in case
var source = doc.crossReferenceSources.add(sourceText, xRefForm);
var myLink = doc.hyperlinks.add(source, destination);
myLink.visible = false;
So, it is very similar to making any other kind of hyperlink. First, make your destination (dest in that first statement is a text reference into my document) then make a cross reference source, then make a hyperlink joining the two together.
Dave
Technical Details
Message-ID:
<59b74dde.0@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!news2!feeder.erje.net!89.250.64.36.MISMATCH!feeder2.xentech.net!news4us.nl!webcrossingReferences:
<59b74dde.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,91522556f5796bab X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Dave_Saunders@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: Re: [CS4 JavaScript] Cross references Message-ID: <59b74dde.0@webcrossing.la2eafNXanI> Date: Thu, 18 Dec 2008 09:42:48 -0800 References: <59b74dde.-1@webcrossing.la2eafNXanI> Lines: 20 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!news2!feeder.erje.net!89.250.64.36.MISMATCH!feeder2.xentech.net!news4us.nl!webcrossing