Поделиться через


PageBorders Class

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

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Wordprocessing.PageBorders

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

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(TopBorder))> _
<ChildElementInfoAttribute(GetType(BottomBorder))> _
<ChildElementInfoAttribute(GetType(LeftBorder))> _
<ChildElementInfoAttribute(GetType(RightBorder))> _
Public Class PageBorders _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As PageBorders
[ChildElementInfoAttribute(typeof(TopBorder))]
[ChildElementInfoAttribute(typeof(BottomBorder))]
[ChildElementInfoAttribute(typeof(LeftBorder))]
[ChildElementInfoAttribute(typeof(RightBorder))]
public class PageBorders : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • TopBorder <w:top>

  • LeftBorder <w:left>

  • BottomBorder <w:bottom>

  • RightBorder <w:right>

[ISO/IEC 29500-1 1st Edition]

17.6.10 pgBorders (Page Borders)

This element specifies the page borders for each page in this section. Each child element of the pgBorders element specifies a specific of border (left, right, bottom, or top).

[Example: Consider a page that specifies a dashed line border around each of the four sides of the page, as follows:

DocumentFormat.OpenXml.Wordprocessing.PageBorders-

This page border setting would be specified using the following WordprocessingML:

<w:pgBorders w:offsetFrom="page">
<w:top w:val="dashed" w:sz="4" w:space="24" w:color="auto" />
<w:left w:val="dashed" w:sz="4" w:space="24" w:color="auto" />
<w:bottom w:val="dashed" w:sz="4" w:space="24" w:color="auto" />
<w:right w:val="dashed" w:sz="4" w:space="24" w:color="auto" />
</w:pgBorders>

The four page borders are each uniquely defined by the top, left, bottom, and right elements, respectively. Global settings that define the placement of all page borders are stored on the pgBorders element directly. end example]

Parent Elements

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

Child Elements

Subclause

bottom (Bottom Border)

§17.6.2

left (Left Border)

§17.6.7

right (Right Border)

§17.6.15

top (Top Border)

§17.6.21

Attributes

Description

display (Pages to Display Page Borders)

Specifies the pages in this section on which the page border shall be printed.

If this attribute is omitted, then the page borders shall be displayed on all pages in this section (equivalent to a value of allPages).

[Example: Consider a section in a document for which the page border must only be printed on the first page. This setting is specified using the following WordprocessingML:

<w:pgBorders w:display="firstPage">

</w:pgBorders>

The display attribute specifies that only the first page must display the page border defined for this section. end example]

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

offsetFrom (Page Border Positioning)

Specifies how the relative positioning of the page borders shall be calculated.

If the value of this attribute is page, then the space attribute on each page border shall be interpreted as the distance from the edge of the page that shall be left before the page border.

If the value of this attribute is text, then the space attribute on each page border shall be interpreted as the distance from the text margins that shall be left before the page border.

[Example: Consider the following WordprocessingML fragment:

<w:pgBorders w:offsetFrom="page">
<w:top w:val="dashed" w:space="24" />
<w:left w:val="dashed" w:space="24" />
<w:bottom w:val="dashed" w:space="24"/>
<w:right w:val="dashed" w:space="24"/>
</w:pgBorders>

This fragment specifies that the page borders must be indented 24 points from the page extents.

This is distinct from the following fragment with identical space attribute values:

<w:pgBorders w:offsetFrom="text">
<w:top w:val="dashed" w:space="24" />
<w:left w:val="dashed" w:space="24" />
<w:bottom w:val="dashed" w:space="24"/>
<w:right w:val="dashed" w:space="24"/>
</w:pgBorders>

In this case, the page borders is offset by 24 points, but in this case, that offset is calculated relative to the text margins. end example]

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

zOrder (Z-Ordering of Page Border)

Specifies whether the page border is positioned above or below intersecting texts and objects in this document.

[Example: Consider a document in which the page border must be displayed below any intersecting text as follows:

DocumentFormat.OpenXml.Wordprocessing.PageBorders-

This setting is specified by setting the zOrder attribute to back, which specifies that the page border must be display behind all intersecting text and objects. end example]

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

[Note: The W3C XML Schema definition of this element’s content model (CT_PageBorders) 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

PageBorders Members

DocumentFormat.OpenXml.Wordprocessing Namespace