Apache OpenOffice (AOO) Bugzilla – Issue 60445
Clipboard paste issue with images from vs.net
Last modified: 2008-02-02 01:54:59 UTC
Images copied to the clipboard from vs.net 1.1 & 2.0 programs cannot be copied into Open Office Programs as the paste icon or paste special icons do not appear. The code from Visual studio 2005 is thus: Dim bmp2 As System.Drawing.Bitmap = bmp 'bmp is another bitmap object already in existence Clipboard.SetImage(bmp2) 'setImage takes an image object which bitmap inherits from 'another way of pasting to clipboard also does'nt work Dim dataObj As DataObject = New DataObject dataObj.SetData(DataFormats.Bitmap, True, bmp) 'dataformats.bitmap is "CF_BITMAP" according to MSDN Clipboard.SetDataObject(dataObj, True) The above code will place the image onto the clipboard and it is retrievable by other programs (such as Adobe Photoshop, wordpad, corel draw, MS office etc.) just not open office. When other formats are copied onto the clipboard such as CF_HTML of CF_TEXT it works fine just not images. from interrogating the clipboard at runtime (using the code below) it appears to have copied two items to the clipboard, A System.Drawing.Bitmap followed by a Bitmap. Not sure if that's relevant or not. Dim o As DataObject = Clipboard.GetDataObject Dim s As String For Each s In o.GetFormats MsgBox(s) Next sorry it's not much to go on but it would be a great help if it could get fixed as it's getting annoying copying the image into painbrush then recopying it to the clipboard
Reassigned to ES.
@AMA: can you help reproducing this?
@sebcrabbe: Please provide complete macro including bitmap so that we can directly reproduce the problem by executing your demo
hi, here is an example routine that illustrates it, you should be able to paste an image into a wordpad or office document afterwards, but not openoffice Private Sub makebmp(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles makebmpc.Click Try 'a very simple test routine to illustrate issue 'note you may need to import system.drawing 'the below makes use of GDI+ calls wrapped up in .net objects 'create a bitmap and get a handle on the graphcis Dim bmp As Bitmap 'a bitmap class object bmp = New Bitmap(250, 250) 'specifiy size Dim gr As Graphics = Graphics.FromImage(bmp) 'create a graphics object from the bitmap 'draw stuff on the bitmap Dim r As New Rectangle(10, 100, 230, 50) gr.Clear(Color.Wheat) gr.DrawRectangle(Pens.DarkBlue, r) gr.FillRectangle(Brushes.LightBlue, r) gr.DrawString("A very simple test", New Font("Arial Black", 14), Brushes.Blue, r) gr.Dispose() 'create a dataobject Dim dataObj As DataObject = New DataObject 'add the bitmap dataObj.SetData(DataFormats.Bitmap, True, bmp) 'copy it to the clipboard Clipboard.SetDataObject(dataObj, True) 'now try and paste it into a document. you can under wordpad, microshaft office etc. 'but the paste icon does not appear in openoffice Catch ex As Exception MsgBox(ex.Message) End Try End Sub
ama->es: No, sorry. You need someone with Visual Basic and StarOffice installed to confirm this. I didn't found a developer with installed Visual Basic (and StarOffice). So I cannot help to confirm this problem.
I can confirm this issue occurs with Paint .NET (free) and Openoffice I copy something in Paint .NET and there is nothing to paste in oo.org, yet ms paint will allow it. I use a workaround of pasting into Visio then copying and pasting into oo.org!
Just to add, if it occurs with paint .net as well it'll be a .net issue and not a visual basic issue as such. (all the .net languages compile up to microsoft intermediate language (MSIL) anyway) Perhaps someone could try and alter + compile the code as C# to confirm it?
Dup of confirmed http://qa.openoffice.org/issues/show_bug.cgi?id=85661. Please move your votes and CC. *** This issue has been marked as a duplicate of 85661 ***
Closing.