Edit All Cells In All Tables


hello,

 

this first post, have been working indesign scripting while, , pretty fluent in javascript.

 

my scenario is, have document 1,000 pages. on each page table approximately 100 cells, 10 rows , 10 columns description @ 0-space of each, followed floating point number (in form of percentage) in every other cell. need format text color of each percentage in each row depending on value. instance, in first row, every percentage under 80.00% red, while else needs green. need color them based on value. however, value changes throughout course of 10 different rows.

 

i able make script allow me go on each cell in row 1 of every table on single page, iterate on other remaining pages in same way before continuning onto row 2. long process, typically leading crash in document on ~30 pages in length. given want run on gigantic 1,000+ page document (granted there 1 table per page), becomes impractical...

 

i'm curious if there way run in more realistic manner. there has quick way iterate on each row, check values, mark green or red , done it. idea to, perhaps, every row in table on 1 page , go onto next page, opposed row 1 on entire document, followed row 2, , on , forth? perhaps help?

 

the code farrr long post here, rough process have right following:

1.) setup variables define cells in each row:

     var alltables = app.activedocument.stories.everyitem().tables.everyitem();

     var firstrowcells = alltables.rows[1].cells.everyitem().getelements();

 

         (there has way optimize that???)

 

2.) call bunch of statements amount of rows need process (10) per table:

 

         for(var = 0; < firstrowcells.length; ++i)

         {

               var = parsefloat(firstrowcells[i].contents);

               if(a <= 80.00)

               {

                     firstrowcells[i].texts[0].appliedcharacterstyle = "fail red";

               } else if(a > 80.00){

                     firstrowcells[i].texts[0].appliedcharacterstyle = "pass green";

               }

         }

 

 

 

...all of (about 10 statements) results in pretty rough crash. have solution? or @ least optimization tip?

 

thanks,

-chris

hi,

 

perhaps exporting stories tagged text. search , resque may of shell, ruby whatever faster javascript. place refurbished tagged text file ...



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