Reputation: 43
I am working on an VSTO AddIn for PowerPoint. One of the AddIn's features is to add life web pages on slides.
In the previous versions of PPT I could simply do:
var browserShape = slide.Shapes.AddOLEObject(
x, y, width, height,
"Shell.Explorer.2"
) as PowerPoint.Shape;
But now with PowerPoint 2016 I get an OLE exception.
Is there a new (maybe even better) way to place working web pages on slides? What changed? Why doesn't the old way work anymore?
So how do I add life web pages to slides in PowerPoint 2016? Please note that I don't have a way to force my customers to install some other plugin.
Thanks in advance.
Upvotes: 0
Views: 1305
Reputation: 3225
Did this work in 2013, but now fails in 2016? I ask because MS made a pretty big change from 2010 to 2013 that would cause this, but as far as I know there wasn't really any ~additional~ relevant changes since then.
I maintain a product I wrote that uses dynamically generated PowerPoint presentations that include (among other things) live webpages (using a VSTO plugin I wrote that enables the live webpage functionality).
Here's the code I use to insert the web browser object into the slide:
slide.Shapes.AddOLEObject(0, 0, presentation.PageSetup.SlideWidth, presentation.PageSetup.SlideHeight, "Shell.Explorer.2");
That's basically the same as yours.
The difference is probably http://support.microsoft.com/kb/2793374 where MS decided to disable the web browser control for security reasons, which my system attempts to re-enable writing the relevant registry keys, and then going one step further with http://msdn.microsoft.com/en-us/library/ee330730%28VS.85%29.aspx#browser_emulation to update the browser emulation to a more recent version of IE (I think it defaults to 7 or 9 or something - I update it to IE11 so it supports HTML5 and a bunch of other stuff that the older IE browsers do terribly).
It's up to you how you do it - you could manually get your clients to run a .reg file to patch a machine once, or you could try and do it inside the app itself (my advice: that's a lot of work due to privilege elevation being required to write to those registry keys).
Assuming 32bit office, the basic idea though is:
[SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\COM Compatibility\{8856F961-340A-11D0-A96B-00C04FD705A2}]"Compatability Flags"=dword:00000000
[SOFTWARE\Wow6432Node\Microsoft\Office\16.0\Common\COM Compatibility\{8856F961-340A-11D0-A96B-00C04FD705A2}]"Compatability Flags"=dword:00000000
[SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]"POWERPNT.EXE"=dword:00002711
(or higher - that codes for IE10, there's also 00002AF8 and 00002AF9 which code for IE11 with varying levels of strictness).Obviously MS disabled this for a reason, so it's up to you how much you care about security and how dangerous re-enabling this may be.
On a personal level, from one VSTO developer to another, I am so sorry for you :D
Upvotes: 0