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

How to apply bold to string which is created from javascript in a document

Contributor ,
Oct 11, 2022 Oct 11, 2022

Copy link to clipboard

Copied

var imgName = "img1.tif";

myTable.columns[0].cells[0].contents = "Figure Name: " + imgName;

 

In the above code, I need to apply Bold to  "Figure Name: " alone.

Is there any way to do this?

TOPICS
How to , Scripting

Views

41

Likes

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 , Oct 11, 2022 Oct 11, 2022

Hi @Karthik SG , Try this—it assumes the font has a "Bold" fontStyle

 

 

 

var imgName = "img1.tif";
var myTable = app.activeDocument.stories[0].tables[0];
myTable.columns[0].cells[0].contents = "Figure Name: " + imgName;
myTable.columns[0].cells[0].words.itemByRange(0,1).fontStyle = "Bold"

 

 

Likes

Translate

Translate
Community Expert ,
Oct 11, 2022 Oct 11, 2022

Copy link to clipboard

Copied

Hi @Karthik SG , Try this—it assumes the font has a "Bold" fontStyle

 

 

 

var imgName = "img1.tif";
var myTable = app.activeDocument.stories[0].tables[0];
myTable.columns[0].cells[0].contents = "Figure Name: " + imgName;
myTable.columns[0].cells[0].words.itemByRange(0,1).fontStyle = "Bold"

 

 

Likes

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 ,
Oct 11, 2022 Oct 11, 2022

Copy link to clipboard

Copied

LATEST

Thank you @rob day , it is working!

Likes

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