• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Create paragraph style - predefined

Contributor ,
Nov 15, 2012 Nov 15, 2012

Copy link to clipboard

Copied

Hi all,

I m trying to create paragraph styles, specifying what we need? But the script runs error.

I m specifying here the font family which i need and the font style.

can anybody sort this out.

var doc = app.documents.item(0);

var paraStyleBodyText = doc.paragraphStyles.add({

  name: "Ariel",

  fontFamily: "Time New Roman",

  fonStyle: "Roman",

  pointSize: 6,

  fillColor: "black25",

});

thanks,

rkids.

TOPICS
Scripting

Views

1.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 15, 2012 Nov 15, 2012

Copy link to clipboard

Copied

fontStyle: "Roman",

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 15, 2012 Nov 15, 2012

Copy link to clipboard

Copied

Thanks vamitul,

although after correction was made,

the error is; invalid parameter.

highlighting the line;

var paraStyleBodyText = doc.paragraphStyles.add({

thanks.& regards,


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 15, 2012 Nov 15, 2012

Copy link to clipboard

Copied

do it in two steps:

var paraStyleBodyText = doc.paragraphStyles.add();

paraStyleBodyText. name= "Ariel";

paraStyleBodyText.fontFamily= "Time New Roman";

etc etc.



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 15, 2012 Nov 15, 2012

Copy link to clipboard

Copied

hi Vamitul,

adding to rajnikids request, how do we add script for pointsize and fillColour to the below script you wrote:

pointSize: 6,

fillColor: "black25",

vamitul wrote:

var paraStyleBodyText = doc.paragraphStyles.add();

paraStyleBodyText. name= "Ariel";

paraStyleBodyText.fontFamily= "Time New Roman";

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 15, 2012 Nov 15, 2012

Copy link to clipboard

Copied

paraStyleBodyText. pointSize= 6,

paraStyleBodyText. fillColor="black25",

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 16, 2012 Nov 16, 2012

Copy link to clipboard

Copied

Thanks vam,

I tried the below option using your clue. All attributes creates automatically except the fontFamily "Times".

When i checked the fontfamily: it still remain in system font. Myriad pro not Times as we substituted here in script.

var doc = app.documents.item(0);

var paraStyleBodyText = doc.paragraphStyles.add({

name: "Ariel",

fontFamily: "Times",

fontStyle: "Bold",

pointSize: 6,

fillColor: "black25",

});

thanks

rkids


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 16, 2012 Nov 16, 2012

Copy link to clipboard

Copied

that's because there is no fontFamily..

http://jongware.mit.edu/idcs5/pc_ParagraphStyle.html

the property you are looking for is: appliedFont.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 16, 2012 Nov 16, 2012

Copy link to clipboard

Copied

LATEST

Thanks Vam,

One of the best clue with lot of patience in reply to the beginners.

thanks so much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines