Article View: adobe.scripting.indesign
Article #15156JS: pageReferences.add confused by tables
From: Peter_Kahrel
Date: Thu, 18 Dec 2003 11:42
Date: Thu, 18 Dec 2003 11:42
20 lines
1777 bytes
1777 bytes
In JS, pageReferences.add appears to be confused by tables. Using the following routine to add page references to all occurrences of the first topic in the index ("s" is a topic to be searched):
f = _story.search( s , false , false , undefined )
for( i = f.length-1 ; i > -1 ; i-- )
{
_offset = f[i].insertionPoints[0].index;
doc.indexes[0].topics[0].pageReferences.add( _story , _offset , PageReferenceType.currentPage);
}
then page references will be placed correctly at all references before the first table in the story, but after the first table the references are placed two or three (sometimes four) words earlier. This could be a problem when you add a page reference at the first word of a page: the reference will then be on the previous page.
The problem is not the offset: when you add the following line:
_story.characters.itemByRange( _offset, _offset+9 ).appliedCharacterStyle="Red";
(assuming a character style that paints stuff red), you can see that the style is applied to the correct part of the text.
The problem can be circumvented by placing tables in separate frames, either as inlines or completely separately.
Peter
Technical Details
Message-ID:
<2ccefe85.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,b32b8edaaeb09cda,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-12-18 04:07:36 PST From: Peter_Kahrel@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: JS: pageReferences.add confused by tables Message-ID: <2ccefe85.-1@webx.la2eafNXanI> Date: Thu, 18 Dec 2003 03:42:23 -0800 Lines: 30 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit