Skip to main content
Camussx
Inspiring
October 7, 2009
Question

Insert graphic in middle of text

  • October 7, 2009
  • 1 reply
  • 607 views

Hi.

Now, I can insert images inside a TextFlow. But I have a problem.

For example, I write something like: "This is an example of text", next, I put the cursor between "an" and "example", then, I push my button to insert a image but this image inserts at finish of my text.

I understand that this happens because I use:

p.addChild(inlineGraphic);

where "p" is a ParagraphElement then, this insert the graphic at the end.

I need insert a image exactly where is the cursor.

How can I do that?

Please, I need your help.

This topic has been closed for replies.

1 reply

Camussx
CamussxAuthor
Inspiring
October 7, 2009

Well, I found a solution.

Instead of:

p.addChild(inlineGraphic);

where:

p is my paragraphElement assigned to my textFlow

inlineGraphic is my InlineGraphicElement with source, width and height

I use:

edition.insertInlineGraphic(inlineGraphic.source, inlineGraphic.width, inlineGraphic.height);

where:


edition is my EditionManager assigned to my TextFlow

inlineGraphic is my InlineGraphicElement with source, width and height

Now, I can insert graphics anywhere my cursor is placed.