将图像从 Firefox 拖放到 Microsoft Powerpoint
我正在尝试制作一个网页,允许用户将图像拖放到 Microsoft Office 应用程序中,特别是 Powerpoint。
默认情况下(从 FF3.5 开始),当图像被删除时,Firefox 将插入源 URL,而不是图像本身。添加以下 Javascript/jQuery 代码(源自 https://developer.mozilla.org/En/ DragDrop/Drag_Operations),
$('img').attr('draggable', true).bind('dragstart', function (event) {
event.originalEvent.dataTransfer.effectAllowed = 'copy';
});
将作品从 Firefox 拖放到 Word 和 Excel,但不能拖放到 PowerPoint。有关所发生情况的示例,请参阅 http://slides.html5rocks.com/#drag-and -下降。我已经用 FF3.6 和 FF9 对此进行了测试。
我怎样才能让它与 PowerPoint 一起使用?
I am trying to make a web page which allows users to drag and drop images into Microsoft Office applications, specifically Powerpoint.
By default (as of FF3.5), Firefox will insert the source URL when an image is dropped rather than the image itself. After adding the following Javascript/jQuery code (derived from https://developer.mozilla.org/En/DragDrop/Drag_Operations),
$('img').attr('draggable', true).bind('dragstart', function (event) {
event.originalEvent.dataTransfer.effectAllowed = 'copy';
});
dragging and dropping works from Firefox to Word and Excel, but not to PowerPoint. For an example of what happens, see http://slides.html5rocks.com/#drag-and-drop. I have tested this with FF3.6 and FF9.
How can I make it work with PowerPoint?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需将其拖放到 ppt 幻灯片的边界之外(以确保您没有拖放到预定义的文本框上),然后释放鼠标按钮 - 无需编码!
Firefox 拖动会将图像放在 ppt 幻灯片的中心。
Just drag'n'drop outside the boundaries of the ppt slide (to make sure you're not dropping on a predefined textbox) - and release the mouse button -no coding needed!
Firefox drag will drop the image at the center of te ppt slide.
现状
遗憾的是,您无法在浏览器和应用程序中执行任何操作来启用对 PowerPoint 的支持。
这是 PowerPoint 中需要在源代码级别支持的内容(如果您不将图像拖放到现有元素上,而是将其拖放到您想要将其拖放到的幻灯片框架之外 - 但可能取决于版本)。
如果它(仍然出于某种原因)不支持 drop 的图像部分,而只支持链接(并且如果没有提供用于更改此行为的选项),那么除了希望 Microsoft 能够更新 PowerPoint 并提供此支持之外,别无他法。未来, - 或 - 如果需要,请检查以下选项以获得解决方法:
加载项
您可以考虑编写加载项(或者可能只使用宏 - 您可能需要对于宏,将安全性降低到中等 [PDF])对于 PowerPoint,将采用删除的链接并将其替换为链接引用的图像。
这里是一个让您开始制作加载项的地方(如果这是一个)可行的选择。
这是一个商业框架,使创建加载项变得非常简单。
(在这方面的免责声明:我在这里假设这将是可能的,因为添加-诸如这样的,它允许您在 PP 内显示实时网页)。
管道/工作流程
还可以选择在管道中注入第三方应用程序来进行图像的屏幕快照,并将其自动插入到 PP 中。
SnagIt 就是这样一个应用程序(可能还有其他应用程序),它有免费的扩展,允许您可以将“snags”直接与 PowerPoint 集成。
或者(也许是太明显的选项):只需在浏览器中复制图像并将其粘贴到 PowerPoint 中。
Status quo
Sadly there is nothing you can do from within your browser and the application to enable drop support for PowerPoint.
This is something that needs to supported at source level in PowerPoint (and it seem to be if you don't drop the image on an existing element but right outside the slide frame you want to drop it onto - but probably depending on version).
If it (for some reason still) does not support the image part of the drop but just the link (and if there is no option provided for changing this behavior) there is little to do but to hope Microsoft will update PowerPoint with this support in the future, - or - check the following options for work-arounds if needed:
Add-ins
You can look into writing an add-in (or possibly just use a macro - you might need to lower security to medium [PDF] for macros) for PowerPoint that will take the link that is dropped and replace it with the image the link refers to.
Here is one place to get you started making add-ins if this is a viable option.
Here is a commercial framework that makes creating add-ins very simple.
(disclaimer in this regard: I am here assuming this will be possible due to add-ins such as this which allow you to show a live web page inside PP).
Pipe-line / work process
There is also the option of injecting a third-party applications in the pipe-line to do screen snapshots of the image and have it inserted automatically into PP.
SnagIt is such an application (and there are probably others) and it has free extensions that will allow you to integrate "snags" directly with PowerPoint.
Or (the perhaps too obvious option): simply copy the image in browser and paste it into PowerPoint.
您的 Powerpoint 版本是什么?
这非常重要,因为可能缺乏图像格式支持。
如果是这种情况,您的代码需要添加最低版本警告。
还可以要求将图像转换为合适的格式。
甚至可能出现这样的情况:您使用的 Powerpoint 版本不可能以您想要的方式支持此功能。
你可以尝试使用html代码。
这段代码可能会帮助你:
http://classroomtech.org.uk/2008/08/拖放 in-powerpoint/
其他可能性是带有图像链接的 OLE 对象。
可以检查其他执行类似操作的 Microsoft 应用程序如何处理事情。
如果这不起作用,您可以尝试生成一个 OLE 对象,其中包含指向其中图像的链接。
What is your version of Powerpoint?
It's very important because image format support may be lacking.
If that's the case your code needs a minimum version warning addition.
Could also ask to convert image to suitable format.
It may even be the case that it's impossible to the version of Powerpoint you're using to support this in the way you want.
You could try to use html code.
This code might help you:
http://classroomtech.org.uk/2008/08/drag-and-drop-in-powerpoint/
Other possibilities are OLE object with a link to a image.
Could check how other Microsoft applications, that do something similar, handle things.
If that doesn't work you could try to generate an OLE object with a link to the image in it.