Can't paste dynamically generated image from any browser to MS Word

纵饮孤独 提交于 2020-02-04 01:31:26

问题


I have an application that generates an image and then pushes this to the browser. The image displays with absolutely no difficulty, and can also be saved by right clicking, and can be pasted without issue into applications such as Gimp but cannot be pasted into MS Word. I fiddled with all aspects of the application to make sure that content-types and all other headers are correct, but this has no effect on being able to paste in the image.


回答1:


The solution is a little strange. It is related to the apparent fact that MS Word actually re-downloads the image from the web based on the contents of the "HTML Format" format stored in the clipboard. Because of this, issues with the URL can cause the image to not paste correctly.

In my case, the URL was too long. I was passing a lot of parameters to my application and the URL string exceeded 255 characters. It looks like the magic number is 253. So, if you can't seem to copy dynamically generated images into MS Word, this could be your issue.

Also, since MS Word is doing a request against the URL for the image, it will also fail (although in a stranger way) if your application uses a self-signed SSL certificate, because MS Word will fail when trying to connect securely.



来源:https://stackoverflow.com/questions/23572244/cant-paste-dynamically-generated-image-from-any-browser-to-ms-word

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!