Thread

Posted on Wed Apr 18 22:54:06 2007 by cajun
inserting image into specific paragraph
I am trying to insert a jpg file into an existing paragraph. I don't get any errors but the jpg image doesn't show up in the doc. What am I missing?

my $piepara = $c->selectElementByContent("_chart"); $c->createImageElement( "piechart", description => "Some pie chart", attachment => $piepara, import => "/home/me/piechart.jpg" ); $c->importImage("piechart", "/home/me/piechart.jpg");
Direct Responses: 4933 | Write a response
Posted on Thu Apr 19 18:54:40 2007 by cajun in response to 4929
Re: inserting image into specific paragraph
I figured out my problem. The element I was selecting was a Section and not a Paragraph. So I guess
you can't add an image directly to a Section?

Isn't a paragraph automatically created though, if you add text, ie. "_chart"? When I look at the
content.xml, there is a < text:p> tag around the "_chart" text.
Direct Responses: 5026 | Write a response
Posted on Mon Apr 30 23:47:15 2007 by jmgdoc in response to 4933
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