Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy image (or bitmap with alpha) and Paste from clipboard into e.g. PowerPoint gives unexpected results (MSW) #24478

Open
simbu11 opened this issue Apr 16, 2024 · 2 comments
Labels

Comments

@simbu11
Copy link

simbu11 commented Apr 16, 2024

Bug description:

I'm experiencing an issue with copying an image (or bitmap with alpha) to the clipboard and then pasting it into PowerPoint (and other MS Office apps).

The issue can be seen in the wxImage sample (imagesample.exe):

  1. Choose Clipboard->Copy Image as wxImage
  2. Open PowerPoint and paste -> nothing happens (I tried paste special too). The behaviour seems independent of whether the copied image has an alpha channel.

Pasting DOES work in the Image sample Clipboard->Paste image as wxImage, and also in the Paint.net editor I have installed. If I subsequently choose Edit->Copy in Paint.net, I can paste the image directly into PowerPoint.

Choosing Copy test image as wxBitmap in imagesample.exe can then be pasted into PowerPoint when there is no alpha channel (i.e. the sample's test image). If the bitmap has an alpha channel, however, alpha seems to be lost when pasting into PowerPoint (shown by black background and pure black pixels where there was partial transparency in the wxBitmap.

Expected vs observed behaviour:

Although it is possible to paste the image into e.g. Paint.net, and from there into PowerPoint, it sure would be nice to be able to paste directly from my wx app into PowerPoint (as that is used by many users for presenting results).

Platform and version information

  • wxWidgets version you use: 3.2.4 master at commit 91de986 (28 Jan 2024)
  • wxWidgets port: wxMSW
  • OS and its version: Windows 11 Version 10.0.22631 Build 22631
@PBfordev
Copy link
Contributor

I can reproduce issue when using "Copy image as wxImage" with GIT master using Microsoft 365 MSO Version 2403 and others on Windows 10. Some programs can paste (Word, LibreOffice Write, GIMP), some cannot (Excel, PowerPoint, Paint, IrfanView).

NirSoft InsideClipboard reports the clipboard format used as PNG regardless of the test image file format. I did not have time to look into this any further.

@vadz vadz added the MSW label Apr 18, 2024
@vadz
Copy link
Contributor

vadz commented Apr 18, 2024

This is weird because copying an image from Excel itself puts it on clipboard in several formats including PNG (also JFIF and GIF for some reason, as well as CF_BITMAP), but when we put it on clipboard in this format it indeed doesn't want to paste it.

We probably should make the data available in CF_BITMAP (or CF_DIB? or both?) formats too, it shouldn't be really difficult to do.

For now please use wxBitmapDataObject as workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants