Copy link to clipboard
Copied
In the following script, the formatting of bold and italic words in text frame changed to normal/plain font.
Any suggestion to retain it without creating bold and italic character style sheets for it and looping each paragraph.
var myDoc = app.activeDocument;
myFrame = myDoc.textFrames.itemByName("virender");
myFrame.parentStory.paragraphs.everyItem().appliedParagraphStyle = "Body_text";
Hi @virender_CTS ,
see into method applyParagraphSyle() that comes with some options:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Text.html#d1e459465__d1e465769
The first argument requires the style object itself, not just the name, the second one is the one you perhaps are after.
Try to set "clearingOverrides" to false.
myFrame.parentStory.texts[0].applyParagraphStyle
(
app.activeDocument.paragraphStyles.itemByName( "Body_text" ) ,
false
);
Regards,
Uwe Laubender
( Adobe Comm
Copy link to clipboard
Copied
Looks like a side effect of this is Clear Style Overrides is applied as well...
Why can't you create and apply CharStyles first? Text imported from WORD and you are cleaning it?
Copy link to clipboard
Copied
Hi @virender_CTS ,
see into method applyParagraphSyle() that comes with some options:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Text.html#d1e459465__d1e465769
The first argument requires the style object itself, not just the name, the second one is the one you perhaps are after.
Try to set "clearingOverrides" to false.
myFrame.parentStory.texts[0].applyParagraphStyle
(
app.activeDocument.paragraphStyles.itemByName( "Body_text" ) ,
false
);
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Hi Uwe,
Vielen Dank (many thanks), this feature I was not aware of. It is working fine except for two paragraphs which are completely bold. Even when I select the complete text and then apply style using without script then also those two sentences bold converted to normal font.
Copy link to clipboard
Copied
Hi @virender_CTS ,
check if there is a character style applied to the paragraphs with text all in bold.
Hm. The question here is if the formatting is really intended…
Without having the InDesign document at hand, it's hard to see where the issue lies.
Regards,
Uwe Laubender
( Adobe Community Expert )
Find more inspiration, events, and resources on the new Adobe Community
Explore Now