简体   繁体   中英

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. they seem to duplicate pictures in some way in the docx. Why is there not one per picture? I'm trying to replace pictures programmatically. using openxml 2.5.

Once, we had an problem that our report was not properly displayed on customer that have 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. <mc:Choice> and <mc:Fallback> help us solved that issue. We created this content using features that are in Word 2007 and put it into <mc:Fallback> element. <mc:Choice> is an element that allows you to specify some kind of predicate when we go to the fallback element.

Your docx file contain fallback elements because in case it will be opened in some older version of 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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