Skip to main content
Participant
February 17, 2020
Answered

force lower case in paragraph styles in Indesign

  • February 17, 2020
  • 1 reply
  • 3932 views

Hi guys, so i have come across a bit of a issue. I want to force the paragraph styles to always be lower case. (as the upper case version of a font has some rather ugly letters.) The imformation i am importing obviously has large amounst of captials throughout the copy and cant be changed as the copy doucment will remind live for other people to add to and change during this design process. 

I was wondering if there is a grep style i could apply to this paragraph style to make sure that no matter what i import it will always be displayed in lower case. There is a option in parapgraph styles to change it to all caps ect, just not the other way around? 

 

Any help would be greatly appreciated.

 

Cheers.

This topic has been closed for replies.
Correct answer Manan Joshi

Thanks so much guys! I'm really new to scripts, can I please ask you to show me it as the whole script - I messed up something when I tried to add this! Also, is there anyway to change this to convert to Title Case instead of lowercase? Or even just Initial capitalisation? Thanks again!


Hi @EubhaLiath,

Something like the following would work. Change the text Your_Style_Name with the name of the paragraph style that should be applied on the text which needs to be converted to Titlecase.

var paras = app.documents[0].stories.everyItem().paragraphs.everyItem().getElements()
for(var i = 0; i < paras.length; i++)
    if(paras[i].appliedParagraphStyle.name == "Your_Style_Name")
	    paras[i].changecase(ChangecaseMode.TITLECASE)

This can be written more efficiently by searching for the text with the applied style and then changing the case on that smaller set of paragraphs

-Manan

 

1 reply

Community Expert
February 18, 2020

I don't see this possible using Grep Styles, however this can be scripted. Like the following code would change all the content in a document to lowercase irrespective of the paragraph style applied over it, if this is to be done only on text that has a particular Paragraph Style added over it, then that condition can be added easily as well

var paras = app.documents[0].stories.everyItem().paragraphs.everyItem().getElements()
for(var i = 0; i < paras.length; i++)
	paras[i].contents = paras[i].contents.toLowerCase()

 

-Manan 

-Manan
Known Participant
February 15, 2024

Hi Manan! I know this answer is a bit old now but I was wondering if you could explain how you would restrict this to text of a certain paragraph style please?

Robert at ID-Tasker
Legend
February 15, 2024

I'm not JS guy, but you need to check:

 

if (paras[i].appliedParagraphStyle.name == "name_of_the_style")
{
...
};

 

or something like that.