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

How to select a section text in middle of paragraphstyle A and paragraphstyle B?

Community Beginner ,
Feb 28, 2017 Feb 28, 2017

Copy link to clipboard

Copied

I want to split some texts by paragraphstyle,how to select a section text in middle of  paragraphstyle A and paragraphstyle B?

Please suggest me how to do this with javascript.

Thanks,

Goldbridge

TOPICS
Scripting

Views

313

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

Guru , Mar 01, 2017 Mar 01, 2017

How about

Pseudo Code

... findPreferences ... = style1

myStyle1Finds = myStory.findText()

... findPreferences ... = style2

myStyle2Finds = myStory.findText()

loop .. i

a = myStyle1Finds.characters[-1].index + 1;

b = myStyle2Finds.characters[0].index - 1;

a bit of checking here to see that b is > a

then something close to

a = myStory.characters.paragraphs[0];

b = myStory.characters.paragraphs[0];

// paragraphs in between are

myStory.paragraphs.itemByRange(a,b).fillColor = "None" (well you might want to pick s

...

Votes

Translate

Translate
LEGEND ,
Mar 01, 2017 Mar 01, 2017

Copy link to clipboard

Copied

Hi! Screenshots please!

(^/)

Votes

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
Guru ,
Mar 01, 2017 Mar 01, 2017

Copy link to clipboard

Copied

How about

Pseudo Code

... findPreferences ... = style1

myStyle1Finds = myStory.findText()

... findPreferences ... = style2

myStyle2Finds = myStory.findText()

loop .. i

a = myStyle1Finds.characters[-1].index + 1;

b = myStyle2Finds.characters[0].index - 1;

a bit of checking here to see that b is > a

then something close to

a = myStory.characters.paragraphs[0];

b = myStory.characters.paragraphs[0];

// paragraphs in between are

myStory.paragraphs.itemByRange(a,b).fillColor = "None" (well you might want to pick some other properties and values).

HTH

Trevor

Votes

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
Community Beginner ,
Mar 01, 2017 Mar 01, 2017

Copy link to clipboard

Copied

LATEST

Dear Trevor,that's great,thank you!

Votes

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