Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do <o:p> elements do anyway?

Tags:

html

ms-office

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

I'm interested to know:

  • Is there a resource that explains what <o:p> elements actually do
  • What other MSO elements are commonly injected
like image 974
zzzzBov Avatar asked Oct 18 '11 14:10

zzzzBov


People also ask

What is HTML and its uses?

HTML (HyperText Markup Language) is the code that is used to structure a web page and its content. For example, content could be structured within a set of paragraphs, a list of bulleted points, or using images and data tables.

What is the function of the P tag?

<p>: The Paragraph element. The <p> HTML element represents a paragraph. Paragraphs are usually represented in visual media as blocks of text separated from adjacent blocks by blank lines and/or first-line indentation, but HTML paragraphs can be any structural grouping of related content, such as images or form fields.

What is an element that does not have a closing tag called?

These elements are called empty elements. Empty elements do not have an end tag!


1 Answers

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.

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.

This makes lots of sense.

For your specific question.. the o in 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.

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

like image 90
Shadow Wizard Hates Omicron Avatar answered Oct 02 '22 06:10

Shadow Wizard Hates Omicron