Hi,
I try to open a word document in a desktop app by office plugin. All it is ok. I copy an inlineshape and try to paste in a canvas. The PictureAvailable is True but the canvas stay empty. Here the code:
Var NomeFile As String
Var f As FolderItem
NomeFile = “c:\tmp\example.doc”
f = New FolderItem(NomeFile)
Dim Word As New WordApplication
Dim doc As WordDocument
This looks like its an old bug with Windows and the clipboard. You are correct, the picture from Microsoft Word is on the clipboard, and can be used by other programs.
Xojo doesn’t seem to see a picture although one clearly exists. I used code at Clipboard Documentation
…And there was no picture in the ClipPic picture:
…And the clipboard printed ‘This code has run’ even though there is no picture in the clipboard:
I am not sure what to tell you. Maybe someone from Xojo can shed some light on this?
Hi Jeff,
I think the image is a bitmap, I prepare the word document with copy and paste from mspaint.
If I copy from Xojo and paste in mspaint it is ok.
If I copy in mspaint and paste in Xojo it is ok.
If I copy from Xojo and paste in Xojo it is not work.
Var cb As New Clipboard
For i=1 To doc.InlineShapes.Count
sh = doc.InlineShapes(i)
sh.Range.CopyAsPicture
If cb.PictureAvailable Then
Canvas1.Backdrop=cb.Picture
End If
The code above may work only once (the New Clipboard declaration is poutside of the Loop)… explorate with the debugger how it really behave.
Hi Emile,
sorry, yes in Xojo I copy by the office Plug-in with sh.Range.CopyAsPicture.
But if I paste in mspaint after this instruction I see the image correctly.
By the debugger I see always picture like nil exactly like Eugene show.
I can explain why Copy / Paste wroeks here and not there. But It will takes me time and I needed to iuse Google Translate…
To make the long story short, what you copy is not in a Xojo known format.
Search an application that returns the Clipboard contents (in Windows) as types… and you will start to have a clue.
Think: using Firefox, copy an image; it may or may not be pasted somewhere but can always be pasted elsewhere ! Once I checked what was in the Clipboard, I understand the trouble. I all cases, it was an image, but the trouble was the kind of image.
So, in the debugger, check the Clipboard contents once you copied the object from the Office document: if it is a Picture, you can see it in the debugger (click in Contents): if not, you get your answer.
PictureAvailable returns True because there is a Picture; apparently, that Picture cannot be displayed in Xojo.
BTW: What are the Xojo and Windows (+ Office) versions you’re using ? You may fall into an old and corrected bug…
Hi,
I use InsideClipboard, and this the mspaint copy content
and this is the content of the Xojo office plugin content
I think I need to select the correct object.
Have you an idea about it to suggest?