I.2 Shared (WordprocessingML and DrawingML)

I.2 Shared (WordprocessingML and DrawingML)

Office Open XML provides markup which is used to provide bidirectional support within its constituent markup languages. This markup is used identically across its constituent languages, in order to ensure that its functionality is clearly indicated as common.

Specifically, the following properties are shared between both WordprocessingML and DrawingML, in order to provide identical bidirectional support:

At the paragraph level, the bidi element in WordprocessingML (17.6.1) and the rtl attribute in Drawing ML (21.1.2.2.7) specifies whether the base direction of the text within the paragraph is left-to- right or right-to-left. This element overrides the paragraph level; rules P2 and P3 of the “Unicode Bidirectional Algorithm” (see HL1 in the Unicode Standard Annex #9).

Element

Section

Description

cs

17.3.2.7 and 21.1.2.3.1

Treats the run as complex script run regardless of the content of the run.

Element

Section

Description

lang

17.3.2.20 and 21.1.2.3.9

rtl

17.3.2.30 and 21.1.2.2.8

Since Arabic and Hebrew require different behavior for equation layout, the “lang” attribute is used to determine the resolution of the following neutral characters: the plus sign (+), the minus sign (-), and the solidus (/).

For Arabic, these characters behave just as any other neutral character and can be impacted by the RTL property. Whereas for Hebrew, these characters are treated as numeral separators. Therefore, they will be resolved as EN (European Number) when surrounded by numerals.

For example:

This shall generate the following layout:

If lang is set to ar-SA, the text would layout as:

Specifies the reading order of the character run to be right-to-left, this controls the visual layout of the run. It is important to note the following: - This element should not be used with strong LTR characters. The behavior resulting from using this element with a strong LTR character is unspecified. - Unlike Unicode’s embedding control characters, this element cannot be nested, instead it behaves as a toggle between LTR and RTL character runs. Therefore, it doesn’t increase the embedding level of the character runs beyond 0 or 1. The only exception is when numerals exist within a RTL character run in a LTR paragraph then these numerals will implicitly be embedding level 2. - This element is particularly useful when applications need to support the common scenario of users toggling the method of text entry from LTR to RTL. For example, typing characters using the English keyboard, then switching to Arabic or Hebrew and typing additional characters. Since many directional-neutral characters are common between these languages, this tag helps to disambiguate the reading order of these neutral characters using the direction of the keyboard language rather than of the surrounding characters.

Element

Section

Description

This element provides information used to resolve the classifications of individual characters. Characters in RTL runs will be resolved as strong right-to-left characters or as numerals, while characters in LTR runs will be resolved as strong left-to-right characters or as numerals. Once this is determined, the line is displayed subject to the recommendation of the “Unicode Bidirectional Algorithm” (see HL3 in the Unicode Standard Annex #9) in reordering the resolved levels.

For example, to control the layout of a quote in the middle of a left-to-right paragraph (assume the lower-case text is English and the upper-case text is Arabic or Hebrew).

The RTL and LTR elements resolves the classification of this run as follows:

Which generates the following levels:

Which generates the following text layout:

Last updated on