Article View: adobe.scripting.indesign
Article #16796Re: ApplyStyle Method (Semi-Newbie Question)
From: Olav Kvern
Date: Mon, 04 Aug 2003 18:55
Date: Mon, 04 Aug 2003 18:55
37 lines
1974 bytes
1974 bytes
Paul--
I'm a bit confused. The following:
Rem Given a character object "myCharacter" and a character style object "myCharStyle"...
myCharacter.ApplyStyle myCharStyle, True
...should be all you need. Here's a more complete example:
Set myInDesign = CreateObject("InDesign.Application.2.0")
Set myDocument = myInDesign.Documents.Add
Set myCharStyle = myDocument.CharStyles.Add
myCharStyle.Name = "Lines"
Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add
myTextFrame.GeometricBounds = Array("6p", "6p", "36p", "36p")
myTextFrame.TextContents = "This is the first line." & vbCr & vbTab & "This line starts with a tab." & vbCr & vbTab & "This line starts with a tab." & vbCr & vbTab & "This line starts with a tab." & vbCr & vbTab & "This line starts with a tab." & vbCr & vbTab & "This line starts with a tab."
Set myFoundItems = myDocument.Search("^p^t")
For myCounter = 1 To myFoundItems.Count
Set myCharacter = myFoundItems.Item(1).Characters.Item(2)
myCharacter.ApplyStyle myCharStyle, True
Next
Does that work for you?
Thanks,
Ole
Technical Details
Message-ID:
<1dea2561.1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!151.189.0.75.MISMATCH!newsfeed.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1dea2561.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,79e1d7a74e4853d1 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-08-04 12:08:07 PST From: "Olav Kvern" <okvern@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!151.189.0.75.MISMATCH!newsfeed.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: ApplyStyle Method (Semi-Newbie Question) Message-ID: <1dea2561.1@WebX.la2eafNXanI> Date: Mon, 4 Aug 2003 11:55:39 -0700 References: <1dea2561.-1@WebX.la2eafNXanI> Lines: 34 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit