Skip to main content
jothipriya
Inspiring
June 6, 2020
Answered

How to find bold text using script in InDesign document

  • June 6, 2020
  • 2 replies
  • 3770 views

How to find the bold text in indesign document by running script in script panel. Please guide me.........

-Jothi

This topic has been closed for replies.
Correct answer jothipriya

ok 1'll explain you what i'm trying to do is, I have generated an xml including <bol></bol> tag for some text. After drag and drop the contents from xml in InDesign document the text included in <bol></bol> tag gets bold. But, in our plugin after using liveupdate the bold tag disappears in the database but it present in the xml. i don't know what to do with it. i'm searching to do liveupdate with all tags that applied in the xml must apply to the database. Is there ia a way??? The reason i have asked about the scripting is to check wheather i can get the document contents with applied styles or not..

-Jothi

2 replies

Community Expert
June 8, 2020

I did not quite follow what you want, to get all the text of the document you could use the following code. It does not care about the formatting applied to the text

app.activeDocument.stories.everyItem().contents

 

To get the content of a textframe you need to refer its contents property

-Manan

-Manan
jothipriya
jothipriyaAuthorCorrect answer
Inspiring
June 8, 2020

ok 1'll explain you what i'm trying to do is, I have generated an xml including <bol></bol> tag for some text. After drag and drop the contents from xml in InDesign document the text included in <bol></bol> tag gets bold. But, in our plugin after using liveupdate the bold tag disappears in the database but it present in the xml. i don't know what to do with it. i'm searching to do liveupdate with all tags that applied in the xml must apply to the database. Is there ia a way??? The reason i have asked about the scripting is to check wheather i can get the document contents with applied styles or not..

-Jothi

Community Expert
June 6, 2020

You can use the Find/Change feature to find the font style. The following script would do that

app.findTextPreferences = NothingEnum.nothing;
app.findTextPreferences.fontStyle = "Bold"
var find = app.activeDocument.findText ();
app.findTextPreferences = NothingEnum.nothing;
alert("Found " + find.length + " occurence")

 

-Manan

-Manan
jothipriya
Inspiring
June 8, 2020

Yeah! It's shows the bold text count. I have an another doubt (for.eg., In InDesign document i have contents with bold text and unbold text in a same textframe by using the script i need to fetch all texts in the InDesign document without missing the bold text and unbold text is it possible)

-Jothi