w:pgSz (Page Size)
Specifies the width, height, and orientation of the page.
Parent elements
Description
w:pgSz sets the physical page dimensions and orientation for a section. It is defined in ECMA-376 Part 1 §17.6.13.
All measurements are in twips (1/20 of a point; 1440 twips = 1 inch). US Letter is w:w="12240" w:h="15840" (8.5×11”). A4 is w:w="11906" w:h="16838" (210×297 mm). When w:orient="landscape", applications swap width and height when rendering.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:w |
ST_TwipsMeasure |
Positive integer (twips). | Page width. |
w:h |
ST_TwipsMeasure |
Positive integer (twips). | Page height. |
w:orient |
ST_PageOrientation |
portrait (default), landscape |
Page orientation. When landscape, w:w > w:h is expected. |
w:code |
xsd:unsignedShort |
Printer paper type code. | Vendor-defined paper size code for printer hardware. |
Examples
<!-- A4 portrait -->
<w:pgSz w:w="11906" w:h="16838"/>
<!-- A4 landscape -->
<w:pgSz w:w="16838" w:h="11906" w:orient="landscape"/>
// A4 portrait
new PageSize { Width = 11906, Height = 16838 };
// A4 landscape
new PageSize { Width = 16838, Height = 11906, Orient = PageOrientationValues.Landscape };