Article View: adobe.scripting.indesign
Article #8262Re: Formatting Fonts in TextFrames with JavaScript
From: Dave_Saunders
Date: Thu, 19 Oct 2006 18:55
Date: Thu, 19 Oct 2006 18:55
29 lines
1419 bytes
1419 bytes
Once you've made the style, or as you are making it, you just set its font properties.
There are two relevant properties:
appliedFont
fontStyle
But appliedFont can be used to set both at once.
myDocument = app.activeDocument;
myNewStyle = myDocument.paragraphStyles.add();
myNewStyle.name = "testname";
myNewStyle.appliedFont = "Arial\tBold";
or you could have written:
myDocument = app.activeDocument;
myNewStyle = myDocument.paragraphStyles.add({name:"testname", appliedFont: "Arial\tBold"});
or:
myDocument = app.activeDocument;
myNewStyle = myDocument.paragraphStyles.add()
myProps ={name:"testname", appliedFont: "Arial\tBold"};
myNewStyle.properties = myProps;
These are three ways of getting to the same result. I tend to use each approach as the mood takes me.
Dave
Technical Details
Message-ID:
<3bc155d2.8@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossingReferences:
<3bc155d2.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,17d528cc5b8e0e0c X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII-7-bit From: Dave_Saunders@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: Re: Formatting Fonts in TextFrames with JavaScript Message-ID: <3bc155d2.8@webcrossing.la2eafNXanI> Date: Thu, 19 Oct 2006 11:55:33 -0700 References: <3bc155d2.-1@webcrossing.la2eafNXanI> Lines: 32 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!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing