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

Get the paragraphs with anchored images

Guest
Jan 28, 2017 Jan 28, 2017

Copy link to clipboard

Copied

Hi all.

I have inline images anchored to some paragraphs of a text.

How do I get those paragraphs with images?

Thanks in advance.

TOPICS
Scripting

Views

548

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

Community Expert , Jan 29, 2017 Jan 29, 2017

If a paragraph contains an inline image, it contains a rectangle. Two way to go about finding them:

1. Test every paragraph for the presence of rectangles:

if (myParagraphs.rectangles.length > 0) {

2. Find all anchors, then get their parent paragraphs:

app.findGrepPreferences = null;

app.findGrepPreferences.findWhat = '~a';

inlines = xxx.findGrep();

// Now iterate through inlines

Peter

Votes

Translate

Translate
Community Expert ,
Jan 29, 2017 Jan 29, 2017

Copy link to clipboard

Copied

If a paragraph contains an inline image, it contains a rectangle. Two way to go about finding them:

1. Test every paragraph for the presence of rectangles:

if (myParagraphs.rectangles.length > 0) {

2. Find all anchors, then get their parent paragraphs:

app.findGrepPreferences = null;

app.findGrepPreferences.findWhat = '~a';

inlines = xxx.findGrep();

// Now iterate through inlines

Peter

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 Expert ,
Jan 29, 2017 Jan 29, 2017

Copy link to clipboard

Copied

Hi Peter,

it does not necessarily mean a rectangle. Could be an oval or polygon as well.

What I do not know, so this question goes to the OP laindustia:
Would you like to find paragraphs that contain nested structures like e.g. groups that contain images as well?
Or that contain tables that contain images as well?

Regards,
Uwe

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 Expert ,
Jan 29, 2017 Jan 29, 2017

Copy link to clipboard

Copied

> it does not necessarily mean a rectangle. Could be an oval or polygon as well.

True. But it gives the op something to go on. Anyway, instead of rectangles, use pageItems and do some further test(s).

P.

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
Guest
Feb 03, 2017 Feb 03, 2017

Copy link to clipboard

Copied

LATEST

All my images are in rectangles non grouped by now. Maybe ovals later.

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
Guest
Feb 03, 2017 Feb 03, 2017

Copy link to clipboard

Copied

The first way works fine.

Thanks very much, pkahrel.

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