Skip to main content
Inspiring
March 30, 2011
Question

How to get rid of text content but not picture boxes?

  • March 30, 2011
  • 1 reply
  • 538 views

I have an xml element that corresponds to a textFrame. The xml element has two children corresponding to picture boxes. Now I want to read in xml and fill textFrame and picture boxes. Before doing this I need to empty the textFrame.

Unfortunately xml.texts[0].contents="" also deletes the picture boxes.

The only rather silly solution I have found is to step thru all xml.characters and test for the number of associatedXMLElements. "Real" characters have one the picture boxes have two.

There must be a more sensible way but I cannot think of any.

Ralf

This topic has been closed for replies.

1 reply

Harbs.
Legend
March 30, 2011

Check for the story.pageItems. That will give you all inlines.

Checking the parent.index will give you the index of the containing character. Once you know where they are, you can use itemByRange() to get rid of the text-only.

Harbs

liedzeitAuthor
Inspiring
March 31, 2011

Thank you, Harbs. The problem is I cannot find any pageItems.

The xml object does have a parentStory but the parentStory contains no pageItems. The xml does not contain stories. I can get xml.texts[0], but this also does not have any pageItems. I am quite confused.

Ralf