Html <o:p> 元素有什么作用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7808968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 11:09:41  来源:igfitidea点击:

What do <o:p> elements do anyway?

htmlms-office

提问by zzzzBov

I've been running into some (standard) issues with Microsoft Office injecting its nasty markup into some html after forwarding an email via Outlook.

我遇到了一些(标准)问题,Microsoft Office 在通过 Outlook 转发电子邮件后将其讨厌的标记注入到某些 html 中。

I'm interested to know:

我有兴趣知道:

  • Is there a resource that explains what <o:p>elements actually do
  • What other MSO elements are commonly injected
  • 是否有解释<o:p>元素实际作用的资源
  • 通常注入哪些其他 MSO 元素

回答by Shadow Wizard is Ear For You

Couldn't find any official documentation (no surprise there) but according to this interesting article, those elements are injected in order to enable Word to convert the HTML back to fully compatible Word document, with everything preserved.

找不到任何官方文档(这并不奇怪),但根据这篇有趣的文章,注入这些元素是为了使 Word 能够将 HTML 转换回完全兼容的 Word 文档,并保留所有内容。

The relevant paragraph:

相关段落:

Microsoft added the special tags to Word's HTML with an eye toward backward compatibility. Microsoft wanted you to be able to save files in HTML complete with all of the tracking, comments, formatting, and other special Word features found in traditional DOC files. If you save a file in HTML and then reload it in Word, theoretically you don't loose anything at all.

微软着眼于向后兼容性,在 Word 的 HTML 中添加了特殊标签。Microsoft 希望您能够以 HTML 格式保存文件,并具有传统 DOC 文件中的所有跟踪、注释、格式和其他特殊 Word 功能。如果你用 HTML 保存一个文件,然后在 Word 中重新加载它,理论上你根本不会丢失任何东西。

This makes lots of sense.

这很有意义。

For your specific question.. the oin the <o:p>means "Office namespace" so anything following the o:in a tag means "I'm part of Office namespace" - in case of <o:p>it just means paragraph, the equivalent of the ordinary <p>tag.

对于您的具体问题.. oin 的<o:p>意思是“Office 命名空间”,因此o:in a 标记后面的任何内容都表示“我是 Office 命名空间的一部分”- 在这种情况下,<o:p>它仅表示段落,相当于普通<p>标记。

I assume that every HTML tag has its Office "equivalent" and they have more.

我假设每个 HTML 标签都有它的“等效”Office,而且它们还有更多。