OpenOffice-OODoc - Re: inserting image into specific paragraph

Posted on Mon Apr 30 23:47:15 2007 by jmgdoc in response to 4933 (See the whole thread of 3)
Re: inserting image into specific paragraph

When you select an element by content without explicit context, the default context is the whole document, so the first element matching the filter is returned. selectElementByContent returns the first matching container, not the nearest container. In this example, the "_chart" text is contained in paragraph, but this paragraph belongs to a section, so the section is regarded as the first matching container.

In order to get the containing paragraph, you can use currentContext(), with the section as an argument, in order to restrict the search context to the content of the section.
Write a response