Article View: adobe.scripting.indesign
Article #19837Re: fill color
From: Olav Kvern
Date: Mon, 18 Nov 2002 20:08
Date: Mon, 18 Nov 2002 20:08
41 lines
2093 bytes
2093 bytes
Laurent--
Try this:
Private Sub Command1_Click()
Rem Compare/Copy fill color
Dim myInDesign As InDesign.Application
Set myInDesign = CreateObject("InDesign.Application.2.0")
Set myDocument = myInDesign.Documents.Add
Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add
myTextFrame.GeometricBounds = myGetBounds(myDocument.Pages.Item(1), myDocument)
myTextFrame.TextContents = "This is paragraph 1." & vbCr & "This is paragraph 2."
Rem Create an example color.
Set myColor = myDocument.Colors.Add
myColor.ColorValue = Array(0, 100, 100, 0)
myTextFrame.Paragraphs.Item(1).FillColor = myColor
If myTextFrame.Paragraphs.Item(2).FillColor <> myColor Then
myTextFrame.Paragraphs.Item(2).FillColor = myColor
End If
End Sub
Rem Function for returning "live" area from a page.
Private Function myGetBounds(myPage, myDocument)
myPageHeight = myDocument.DocumentPreferences.PageHeight
myPageWidth = myDocument.DocumentPreferences.PageWidth
myX1 = myPage.MarginPreferences.MarginLeft
myY1 = myPage.MarginPreferences.MarginTop
myY2 = myPageHeight - myPage.MarginPreferences.MarginBottom
myX2 = myPageWidth - myPage.MarginPreferences.MarginRight
myGetBounds = Array(myY1, myX1, myY2, myX2)
End Function
Does it work for you?
Thanks,
Ole
Technical Details
Message-ID:
<1de6a49e.0@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<DFF9FC3225C33D087E52C6689C593770@in.WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,7254ff3a19df304b X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-11-18 12:50:05 PST From: "Olav Kvern" <okvern@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: fill color Message-ID: <1de6a49e.0@WebX.la2eafNXanI> Date: Mon, 18 Nov 2002 12:08:11 -0800 References: <DFF9FC3225C33D087E52C6689C593770@in.WebX.la2eafNXanI> Lines: 39 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit