I am parsing and massaging existing HTML files created by Word (the files cannot be recreated). The HTML files with embedded images include conditional formatting for the vml enabled browsers similar to the following:
<!--[if gte vml 1]>
<v:shape
id="_x0000_i1042" type="#_x0000_t75" style='width:24pt;height:24pt'>
<v:imagedata src="test_files/image002.png" o:title="Text-HighlightColor-icon_32x32"/>
</v:shape>
<![endif]-->
<![if !vml]>
<img width=32 height=32 src="test_files/image002.png" v:shapes="_x0000_i1042">
<![endif]>
I load the HTML file into an instance of the IHTMLDocument2
object. Since IE supports VML, it parses out the <img>
tag above leaving only shape
and imagedata
tags. I would prefer to ignore all vml specific tags and work only with the <img>
tag.
Is there any way to disable the VML support (similar to IHTMLDocument2.desgnMode = "On"
to disable scripts) programmatically?
What Word generates is called "Conditional comments". More specifically, we have here "Downlevel-hidden conditional comments" which take the following form:
The
expression
uses operators and "Version vectors". In general, these vectors refer to "IE" and are used to handle HTML compatiblity issues.But you can use custom version vectors:
Since VML is itself an (embedded) add-on, you can play with
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Version Vector\VML
key and/or the 32-bit one on a 64-bit OSHKEY_LOCAL_MACHINE\Software\WOW6432Node\Microsoft\Internet Explorer\Version Vector\VML
. Apparently, completely deleting the key fixed your problem.