🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #16520

Re: Tables, Collections, Selection, and Huh?

#16520
From: Matthew Frederick
Date: Mon, 01 Sep 2003 18:59
61 lines
3352 bytes
I still can't figure out how to get multiple columns or rows in a selection, but at least I've figured out how to reference the columns and rows from the cells. Unfortunately the script runs really slowly... perhaps it's normal for InDesign scripts or perhaps it's my script. Does anything I'm doing look like a bad idea (that is, is there an easier way)?



Dim sObject, sCell, sLines, sParagraph 
Dim Col1Set, Col2Set 
Col1Set = False 
Col2Set = False 
Set myInDesign = CreateObject("InDesign.Application") 
Set myDocument = myInDesign.ActiveDocument 
For Each sObject In myInDesign.Selection 
  Select Case TypeName(sObject) 
    Case "Cell" 
      For Each sCell In sObject.Cells 
        'Format Overall Table 
        sCell.Parent.SpaceAfter = 0 
        'Format Lines and Spacing 
        sCell.BottomEdgeStrokeWeight = 0 
        sCell.BottomInset = 0.25 
        sCell.LeftEdgeStrokeWeight = 0 
        sCell.LeftInset = 0 
        sCell.RightEdgeStrokeWeight = 0 
        sCell.RightInset = 0 
        sCell.TopEdgeStrokeWeight = 0 
        sCell.TopInset = 0.25 
       'Set Column Width and Paragraph Styles 
       If sCell.ParentColumn.Index = 1 Then 
         If Not Col1Set Then 
           sCell.ParentColumn.Width = 7.25 
           Col1Set = True 
         End If 
       For Each sParagraph In sCell.Paragraphs 
         sParagraph.ParagraphStyle = "Spell Item Right" 
       Next 
     Else 
       If Not Col2Set Then 
         sCell.ParentColumn.Width = 12.75 
         Col2Set = True 
       End If 
       For Each sParagraph In sCell.Paragraphs 
         sParagraph.ParagraphStyle = "Spell Items" 
       Next 
     End If 
     'Set Row Height and Color 
     sLines = sCell.TextLines.Count 
     If sCell.ParentRow.MinimumHeight < sLines + 0.25 Then 
       sCell.ParentRow.MinimumHeight = sLines + 0.25 
     End If 
     If sCell.ParentRow.Index = 1 Or sCell.ParentRow.Index = 3 Or sCell.ParentRow.Index = 5 Or sCell.ParentRow.Index = 13 Or sCell.ParentRow.Index = 15 Then 
       sCell.ParentRow.FillColor = myDocument.Swatches.Item("Row Background") 
     End If 
   Next 
 End Select 
Next 
Beep 
End


Oh, and when I'm coloring those rows I want the 1st, 2nd, and 3rd rows colored, as well as the 7th and 8th (if they exist). Why do I need to refer to them as the 1st, 3rd, 5th, 13th, and 15th? (Note that I cannot use alternating fills because, for example, I don't want the 9th row filled... it's specific to the table.)

Thanks again in advance. This is my first InDesign script so I'm sure I'm making some newbie mistakes.
Technical Details
Message-ID: <2ccd2f62.1@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2ccd2f62.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,dbf123f26daf8769
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-09-01 12:07:53 PST
From: "Matthew Frederick" <mfrederick@qwest.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: Tables, Collections, Selection, and Huh?
Message-ID: <2ccd2f62.1@webx.la2eafNXanI>
Date: Mon, 1 Sep 2003 11:59:26 -0700
References: <2ccd2f62.-1@webx.la2eafNXanI>
Lines: 70
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit