Smart Paste for DOCX graphics

Oxygen general issues.
david.badger
Posts: 25
Joined: Tue Feb 25, 2014 12:14 am

Smart Paste for DOCX graphics

Post by david.badger »

Hello,

We're attempting to use the Smart Paste functionality to be able to copy/paste graphics into XML documents utilizing a custom AuthorExternalObjectInsertionHandler with our framework. We are trying to embed the image data into the href attribute instead of inserting a reference to the graphic.

If we copy/paste from a .doc file, the AuthorExternalObjectInsertionHandler is invoked, and we could conceivably use this to grab the binary data and embed it into the href attribute. However, pasting from a .docx file does not invoke the AuthorExternalObjectInsertionHandler. The reason for this is likely that the Windows clipboard doesn't contain a "HTML Format" rendition of the content. Instead, oXygen prompts the user to save the graphic data to a file, then inserts a reference to the newly created image file. That's helpful, but it's preventing us from embedding the image data during a paste operation from .docx.

The question is: Is there a way to prevent the "Save As" behavior in oXygen when raw image data is pasted into the editor, and instead handle it another way? If so, we could attempt to embed the image data during a paste from .docx.

Thanks!
Radu
Posts: 9041
Joined: Fri Jul 09, 2004 5:18 pm

Re: Smart Paste for DOCX graphics

Post by Radu »

Hi David,

I understand, indeed when you paste an image in Oxygen, it is received on our side as a Swing image. Then we show a file chooser, save it to disk and afterwards we call the API to insert the URL.
Looking at our current API there is no way to control this.
So there are two possible workarounds:

- Create your own "Paste image" action which does whatever you want it to do with the clipboard contents.
- We could investigate adding new API on our side to control this behavior on your side. I cannot give you an estimate timeline for this though, the use case seems quite limited, few people want to embed images directly in the XML content. Some people who wanted to achieve the same thing preferred to have a zip document containing the XML and additional resources. We have APIs which can be called so that when that specific ZIP file is opened in Oxygen, the XML document from inside it automatically opened instead.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
david.badger
Posts: 25
Joined: Tue Feb 25, 2014 12:14 am

Re: Smart Paste for DOCX graphics

Post by david.badger »

Thanks for the information, Radu. We'll probably go in the "custom paste image" direction.
Post Reply