阻止Word 2010保存o:gfxdata base64或uuencoded VML? [英] Prevent Word 2010 from saving o:gfxdata base64 or uuencoded VML?

查看:543
本文介绍了阻止Word 2010保存o:gfxdata base64或uuencoded VML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.docx文件,其中包含多个插入了图像的绘图画布以及在Word 2010中绘制的某些线条和箭头.我正在使用没有兼容模式的2010格式.

I am working with .docx files containing several drawing canvases with images inserted and some lines and arrows drawn in Word 2010. I am using 2010 format with no compatibility mode.

Word在每个v:shapev:group元素中插入一个o:gfxdata属性,并用ascii编码的内容填充该属性.根据我的阅读,它可能是描述v:shapev:group的VML的副本.我不知道我是否只想查找什么内容,但是我无法确定该数据的用途,因为将其删除对我在Word 2003、2007或2010中阅读或编辑文档的能力没有明显影响

Word inserts an o:gfxdata attribute into each v:shape and v:group element and fills it with ascii encoded something. From what I have read it may be a copy of the VML describing the v:shape or v:group. I don't know if I just don't know what to look for, but I cannot determine what this data is for as its removal has no apparent effect on my ability to read or edit the document in Word 2003, 2007, or 2010.

它确实将document.xml膨胀到几乎(所需)大小的两倍.这相当会减慢OpenTBS的处理速度,因此,如果可能的话,我想将其删除.有谁知道一种告诉Word 2010退出保存这些额外数据的方法?或它是干什么的?除了

It does swell the document.xml to almost twice the (apparent) necessary size. This considerably slows OpenTBS' processing so I would like to remove it, if possible. Does anyone know of a way to tell Word 2010 to quit saving this extra data? Or what it is for? I have really struggled to find any documentation on it beyond this post.

这是一个示例.docx . document.xml约为141KB,OpenTBS平均花费10.35秒来创建一个包含此文件作为子模板的文件21次.如果删除所有o:ogfxdata属性,文件大小将减少到〜37KB,而OpenTBS只需2.99秒即可生成相同的文件.

Here is a sample .docx. The document.xml is ~141KB and OpenTBS takes an average of 10.35 seconds to create a file that includes this as a subtemplate 21 times. If I remove all of the o:ogfxdata attributes, the file size is reduced to ~37KB and OpenTBS takes only 2.99 seconds to produce the same file.

经过进一步调查,看来删除o:gfxdata可能会导致安装了较旧兼容性包的Word 2003对该文件产生反对,并出现以下错误:

After further investigation, it appears the removal of the o:gfxdata may cause Word 2003 with an older Compatibilty Pack installed, to object to the file with the following error:

"这是兼容性包的预发行版本,可以打开 预发行版Office 2007文件.你想检查一个新的 版本的兼容包?"

"This is a pre-release version of the Compatibility Pack and can open pre-release Office 2007 files only. Do you want to check for a newer version of the Compatibility Pack?"

我已经能够通过安装更新​​的兼容性包来打开文件-尽管它会提示用户有关不兼容性的信息并转换文件以打开它.这不会损坏我的文件,但是需要注意.

I have been able to open the file by installing a newer compatibility pack - though it prompts the user about the incompatibility and converts the file in order to open it. This does not damage my file, but it is something to look out for.

推荐答案

属性o:ogfxdata在网络上的文献很少. 根据您的调查,这是某种兼容性的额外信息.

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

您可以使用OpenTBS删除模板中的那些属性. 可以对模板进行一次清理,而无需进行任何合并,然后将清理后的模板另存为新模板.或者,您可以在每次打开模板时执行清洁.

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.

清理DOCX文件:

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

请注意,类clsTbsXmlLoc是OpenTBS附带的,未记录. 自OpenTBS 1.8.0起,该代码应该可以使用. (当前处于稳定的Beta版本).

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).

我注意到,由于删除了属性o:gfxdata,因此当您编辑文档时它们不会立即返回.

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

这篇关于阻止Word 2010保存o:gfxdata base64或uuencoded VML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆