🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #10055

Re: Iterate thru selected rows of a table

#10055
From: Dave_Saunders
Date: Fri, 07 Jul 2006 09:40
11 lines
2044 bytes
That not-brilliantly named function sorts out the columns that are part of the selection. The problem could be that included in the selection is one or more merged cells. For example, the user might select just two cells in a row and run the script, but if the two cells are merged, for my script to work, I need the leftmost column of the first cell and the rightmost column of the last cell.

When I wrote the function, I thought I had to deal with non-rectangular selections (where a merged cell sticks out to the right of a selection of cells), so I thought I had to visit every cell in the selection.

Later, I was to discover the bug that makes such a selection impenetrable to a script but by then I had forgotten that I had handled the possibility in that function.

Because you can't know which (if any) cell might be sticking out, I processed every cell in the selection. That statement primes the initial values of Lcol and Rcol to be impossibly large and small respectively so that the first time around the loop the calls to Math.min and Math.max will generate the values of the first cell. After that, Lcol and Rcol will adjust appropriately.

Now that I'm revisiting this logic with such detail, I can see that all I really needed to do was pick up Lcol from the first cell and Rcol from the last.

Dave
Technical Details
Message-ID: <3bc0d3f4.4@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!193.190.198.17.MISMATCH!syros.belnet.be!news.belnet.be!news.stben.net!webcrossing
References: <3bc0d3f4.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,5a6e15a0faa4778e
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Dave_Saunders@adobeforums.com
Newsgroups: adobe.scripting.indesign
Subject: Re: Iterate thru selected rows of a table
Message-ID: <3bc0d3f4.4@webcrossing.la2eafNXanI>
Date: Fri, 7 Jul 2006 02:40:02 -0700
References: <3bc0d3f4.-1@webcrossing.la2eafNXanI>
Lines: 27
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!193.190.198.17.MISMATCH!syros.belnet.be!news.belnet.be!news.stben.net!webcrossing