w:bidi (Bidirectional Paragraph Layout)
Sets the paragraph direction to right-to-left, enabling bidirectional text layout for Arabic, Hebrew, or other RTL scripts.
Parent elements
Description
w:bidi is a toggle property that sets the base writing direction of a paragraph to right-to-left (RTL). When active:
- The paragraph is laid out from right to left.
- Paragraph alignment values are mirrored (
leftmeans right-aligned,rightmeans left-aligned). - Indents and tab stops are measured from the right margin.
It is defined in ECMA-376 Part 1 §17.3.1.6.
This property does not affect individual runs within the paragraph — per-run directionality is controlled by w:rtl in w:rPr.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_OnOff |
true, false, 1, 0, on, off |
Sets paragraph to RTL layout. Omit to inherit. |
Examples
<!-- Arabic paragraph flowing right-to-left -->
<w:p>
<w:pPr>
<w:bidi/>
<w:jc w:val="right"/>
</w:pPr>
<w:r>
<w:rPr><w:rtl/></w:rPr>
<w:t>هذا نص عربي</w:t>
</w:r>
</w:p>
using DocumentFormat.OpenXml.Wordprocessing;
var para = new Paragraph(
new ParagraphProperties(
new BiDi(),
new Justification { Val = JustificationValues.Right }
),
new Run(
new RunProperties(new RightToLeftText()),
new Text("هذا نص عربي")
)
);
Notes
- For a fully RTL paragraph, set both
w:bidionw:pPrandw:rtlonw:rPrfor each run. w:jc w:val="right"in a bidi paragraph has the visual effect of left-aligned text (because the base direction is RTL).- The Unicode Bidi Algorithm (UBA) still applies within each run.