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

force lower case in paragraph styles in Indesign

Community Beginner ,
Feb 17, 2020 Feb 17, 2020

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.

TOPICS
Feature request
3.8K
Translate
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 2 Correct answers

LEGEND , Feb 15, 2024 Feb 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. 

 

Translate
Community Expert , Feb 19, 2024 Feb 19, 2024

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

...
Translate
Community Expert ,
Feb 18, 2020 Feb 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 

Translate
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
Explorer ,
Feb 15, 2024 Feb 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?

Translate
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
LEGEND ,
Feb 15, 2024 Feb 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. 

 

Translate
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
Community Expert ,
Feb 15, 2024 Feb 15, 2024

I'm not JS guy

 

You keep saying that, but your JS is getty pretty good 🙂

Translate
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
LEGEND ,
Feb 15, 2024 Feb 15, 2024
quote

I'm not JS guy

 

You keep saying that, but your JS is getty pretty good 🙂


By @Peter Kahrel

 

Thanks, learned a lot from you and others - but my understanding / knowledge of JS is just basics.

 

Translate
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
Explorer ,
Feb 16, 2024 Feb 16, 2024

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!

Translate
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
Community Expert ,
Feb 19, 2024 Feb 19, 2024

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

 

Translate
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
Explorer ,
Feb 20, 2024 Feb 20, 2024
LATEST

Thank you so so much! This is perfect!

Translate
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