PageSize Class

Page Size.When the object is serialized out as xml, its qualified name is w:pgSz.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Wordprocessing.PageSize

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
Public Class PageSize _
    Inherits OpenXmlLeafElement
'Usage
Dim instance As PageSize
public class PageSize : OpenXmlLeafElement

Remarks

[ISO/IEC 29500-1 1st Edition]

17.6.13 pgSz (Page Size)

This element specifies the properties (size and orientation) for all pages in the current section.

[Example: Consider a section that must be printed on A4 paper. The WordprocessingML for this paper size is as follows:

<w:pgSz w:w="11907" w:h="16839" />

This output states that all pages in this section must be 11907 twentieths of a point wide (11907 twentieths of a point = 8.269") and 16839 twentieths of a point high (16939 twentieths of a point = 11.694"). end example]

Parent Elements

sectPr (§17.6.17); sectPr (§17.6.18); sectPr (§17.6.19)

Attributes

Description

code (Printer Paper Code)

Specifies an optional value which can be used to store an identifier for the current paper size.

This code is stored solely to show a description for the current paper size. This setting should not be used to determine the target paper size (i.e. if the w and h attributes are omitted, this setting has no meaning).

[Example: Consider the following WordprocessingML fragment:

<w:pgSz w:w="12240" w:h="15840" w:code="240" />

The code attribute specifies a value of 240, whichis, since the w and h attributes specify a page size of 8.5 inches by 11 inches, can be used to determine the appropriate user label for this paper size – for example, “Letter” or “8.5 by 11”. The attribute code specifies that the producing application’s unique identifier value for this paper size was 240.

This value does not itself determine the paper size, regardless of the presence of the w and h attributes. end example]

The possible values for this attribute are defined by the ST_DecimalNumber simple type (§17.18.10).

h (Page Height)

Specifies the height (in twentieths of a point) for all pages in the current section.

[Example: Consider the following WordprocessingML:

<w:pgSz w:w="15840" w:h="12240" />

All pages in this section are displayed on a page that is 12240 twentieths of a point (8.5") tall. end example]

The possible values for this attribute are defined by the ST_TwipsMeasure simple type (§22.9.2.14).

orient (Page Orientation)

Specifies the orientation of all pages in this section.

This information is used to determine the actual paper size to use on the printer.

[Example: Pages 11" wide by 8.5" long in landscape mode use 8.5"x11" paper, because the width and height are reversed for pages in this landscape section with respect to the printed page. end example]

This implies that the actual paper size width and height are reversed for pages in this section. If this attribute is omitted, then portrait shall be implied.

[Example: Consider the following WordprocessingML:

<w:pgSz w:w="15840" w:h="12240" w:orient="landscape" />

Although the page width is 11", and page height is 8.5", according to the w and h attributes, because the orient attribute is set to landscape, pages in this section are printed on 8.5x11" paper in landscape mode. end example]

The possible values for this attribute are defined by the ST_PageOrientation simple type (§17.18.65).

w (Page Width)

This attribute indicates the width (in twentieths of a point) for all pages in the current section.

[Example: Consider the following WordprocessingML:

<w:pgSz w:w="15840" w:h="12240" />

All pages in this section are displayed on a page that is 15840 twentieths of a point (11") wide. end example]

The possible values for this attribute are defined by the ST_TwipsMeasure simple type (§22.9.2.14).

[Note: The W3C XML Schema definition of this element’s content model (CT_PageSz) is located in §A.1. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

PageSize Members

DocumentFormat.OpenXml.Wordprocessing Namespace