简体   繁体   English

OpenXML:为什么会有这些<mc:Choice>和<mc:Fallback> docx 文件中的元素?

[英]OpenXML: why are there these <mc:Choice> and <mc:Fallback> elements in docx files?

I see these two and elements, each containing a element, in docx/document.xml files.我在 docx/document.xml 文件中看到这两个和元素,每个元素都包含一个元素。 they seem to duplicate pictures in some way in the docx.他们似乎在 docx 中以某种方式复制了图片。 Why is there not one per picture?为什么每张图没有一个? I'm trying to replace pictures programmatically.我正在尝试以编程方式替换图片。 using openxml 2.5.使用 openxml 2.5。

Once, we had an problem that our report was not properly displayed on customer that have Word 2007.有一次,我们遇到了一个问题,即我们的报告无法在使用 Word 2007 的客户上正确显示。

So, it turns out that we used some features that were added in Word 2010, and that's why the content wasn't properly displayed.因此,事实证明我们使用了 Word 2010 中添加的一些功能,这就是内容无法正确显示的原因。 <mc:Choice> and <mc:Fallback> help us solved that issue. <mc:Choice><mc:Fallback>帮助我们解决了这个问题。 We created this content using features that are in Word 2007 and put it into <mc:Fallback> element.我们使用 Word 2007 中的功能创建了此内容,并将其放入<mc:Fallback>元素中。 <mc:Choice> is an element that allows you to specify some kind of predicate when we go to the fallback element. <mc:Choice>是一个元素,当我们转到回退元素时,它允许您指定某种谓词。

Your docx file contain fallback elements because in case it will be opened in some older version of Word.您的 docx 文件包含备用元素,因为它会在某些较旧版本的 Word 中打开。 If you don't care about that, you can remove that elements.如果你不关心这个,你可以删除这些元素。

Why is there not one per picture?为什么每张图没有一个?

It's not possible to create one generic fallback element for every picture.不可能为每张图片创建一个通用的后备元素。 So, that's why every picture has own fallback element.所以,这就是为什么每张图片都有自己的后备元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM