[JS][ID5] Check if cell contains inline graphic


hello,

 

i have following script:

 

var mydoc = app.activedocument; var myimages = mydoc.allgraphics;  var mytables = mydoc.stories.everyitem().tables.everyitem().getelements();  (i=0; i<myimages.length; i++) {   (j=0;j<mytables.length;j++) {  var myactivetable = mytables[j];  if (myactivetable.rows.everyitem().cells.everyitem().texts[0].contents == myimages[i])  

 

i want check if table cell contains inline graphic, don't know how it!?

 

regards, sjoerd

the 'contents' of text item contains plain unformatted text, it's puzzling why thought somehow work ...

 

try http://jongware.mit.edu/idcs6js/pc_text.html#allgraphics ("lists graphics contained text.")

 

as happens, "allgraphics" available cell (so don't have use 'texts[0]'), row (so don't have use "rows.everyitem"), , table ... there no need drill down individual texts in cells , gathering them using everyitem -- use

 

if (myactivetable.allgraphics.length > 0)

 

it contains inline graphic.

 

looping on images and on tables not seem necessary, image inside table "is" link straight object, , in reverse, every inline image knows located. again, depends on information need able recommend angle should approach this.

 

i recommend not use on-line version of dom reference download searchable , indexed chm version instead. pick 1 need id version http://www.jongware.com/idjshelp.html. if using windows, can use straight away; mac, need find suitable chm viewer.

 

all had "allgraphics" in index immediate list of objects supported property; then, it's case of point-and-click walk , down object hierarchy git whereever want get.



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support