Prevent Word 2010 from saving o:gfxdata base64 or uuencoded VML?

时光毁灭记忆、已成空白 提交于 2019-12-04 13:36:15

Attribute o:ogfxdata is poorly documented in the web. According to your investigations, it's some kind of compatibility extra information.

You can delete those attributes in your template using OpenTBS. The cleaning can be done once on your template without any merging, and then save the cleaned template as a new template. Or you can perform the cleaning each time you open the template.

Cleaning the DOCX file:

while ($x = clsTbsXmlLoc::FindStartTagHavingAtt($TBS->Source, 'o:gfxdata', 0) ) {
  $x->ReplaceAtt('o:gfxdata', '');
  $TBS->Source = str_replace(' o:gfxdata=""', '', $TBS->Source);
}

Note that the class clsTbsXmlLoc is provided with OpenTBS and is undocumented. The code should work since OpenTBS 1.8.0. (which is currently in stable beta version).

I've noticed that since attributes o:gfxdata are deleted, they do not come back immediately when you edit the docx.

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