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

How to do formatting in indesign document through script

Explorer ,
May 14, 2020 May 14, 2020

Copy link to clipboard

Copied

Hi Team,

 

I am working in a application in which I am generating the indesign document and related pdf files directly through the scripting without using indesign templates. The reason I am doing is that the xml content is very dynamic and there is always change  in position and content of xml tags

 

In this document I will have to do certain types of formatting such as 

 

1. Align the text in center position and with bold 

2. Anchor rag with ref attribute should be display as link in the document

3. If there is "text type" xml tag with attribute as "para" then its content should be displayed in indesign document as paragraph and many more

 

Kindly guide us how to do all such formatting with the help of indesign scripts. do I need to create these styles in any templates and then will have to load it OR if there is way by which I can directly do it through indesign script without using the templates

 

Kindly look into the below sample code 

Ex.

var TextFrameChapterDetails = app.documents[0].textFrames.add();
TextFrameChapterDetails.geometricBounds = ['5p0', '22p0', '7p0', '42p0'];
TextFrameChapterDetails.contents =labelText.bold();

 

The content of the frame show within bold tag like <b>5 May 2013, in accordance with article 18(1).</b> but why the entire content itself is not showing as bold

 

Kindly suggest

 

Regards,

 

 

TOPICS
Scripting , SDK

Views

659

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

correct answers 1 Correct answer

Community Expert , May 14, 2020 May 14, 2020

The bold method you use just adds the tag it does not change the formatting of the text content. In order to change the formatting you need to change the textproperties. The easiest way for you would be to apply a paragraph style to your text inside the textframe. Set all the properties that you want in this paragraph style and then apply it using script. Have a look at the following discussion where i have provided an example of how to set the paragraphstyle for a textframe and also how to chan

...

Votes

Translate

Translate
Community Expert ,
May 14, 2020 May 14, 2020

Copy link to clipboard

Copied

LATEST

The bold method you use just adds the tag it does not change the formatting of the text content. In order to change the formatting you need to change the textproperties. The easiest way for you would be to apply a paragraph style to your text inside the textframe. Set all the properties that you want in this paragraph style and then apply it using script. Have a look at the following discussion where i have provided an example of how to set the paragraphstyle for a textframe and also how to change the text properties

https://community.adobe.com/t5/indesign/script-for-changing-font/m-p/10984673?page=1

 

-Manan

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