小节

Word支持以下概念: section ,具有不同的页面布局设置。例如,这就是文档可以包含纵向布局的一些页面和横向布局的其他页面的方式。分隔符的实现方式与行、页和列分隔符完全不同。前者添加了一个 <w:pPr><w:sectPr> 元素添加到新节中的最后一段。后者插入一个 <w:br> 元素在运行中。

文档中的最后一节由 <w:sectPr> 元素显示为 <w:body> 元素。虽然此元素是可选的,但Word似乎为所有文件创建了它。由于大多数文件只有一个部分,最常见的情况是只有这一部分 <w:sectPr> 元素。

附加部分由 w:p/w:pPr/w:sectPr 元素。该段中的任何内容都是其定义的部分 <w:sectPr> 元素。下一节从下一段开始。

使用单词UI插入分节符时,将执行以下步骤:

  1. 下一次发生 <w:sectPr> 元素被复制并添加到当前段落中。(如果该段已经有了一个 <w:sectPr> 元素。)

  2. 在当前段落之后插入一个新段落。光标位置后出现的文本将移到新段落。

  3. 下一次发生的开始类型(例如下一页) <w:sectPr> 元素被更改以反映用户从UI选择的类型。

言语行为

  • 包含分节符(<w:sectPr>元素)的段落不会在Word UI中生成¶字形。

  • 分节符/双线直接出现在出现<w:sectPr>的段落文本之后。如果分节符段落没有文本,则在上一段的段落标记后立即显示指示行。

分析前后

包含两个段落的基线文件:

<w:body>
  <w:p>
    <w:r>
      <w:t>Paragraph 1</w:t>
    </w:r>
  </w:p>
  <w:p>
    <w:r>
      <w:t>Paragraph 2</w:t>
    </w:r>
  </w:p>
  <w:sectPr>
    <w:pgSz w:w="12240" w:h="15840"/>
    <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800"
             w:header="720" w:footer="720" w:gutter="0"/>
    <w:cols w:space="720"/>
    <w:docGrid w:linePitch="360"/>
  </w:sectPr>
</w:body>

在第1段中段落标记前插入奇数页部分:

<w:body>
  <w:p>
    <w:pPr>
      <w:sectPr>
        <w:pgSz w:w="12240" w:h="15840"/>
        <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800"
                 w:header="720" w:footer="720" w:gutter="0"/>
        <w:cols w:space="720"/>
        <w:docGrid w:linePitch="360"/>
      </w:sectPr>
    </w:pPr>
    <w:r>
      <w:t>Paragraph 1</w:t>
    </w:r>
  </w:p>
  <w:p/>
  <w:p>
    <w:r>
      <w:t>Paragraph 2</w:t>
    </w:r>
  </w:p>
  <w:sectPr w:rsidR="00F039D0" w:rsidSect="006006E7">
    <w:type w:val="oddPage"/>
    <w:pgSz w:w="12240" w:h="15840"/>
    <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800"
             w:header="720" w:footer="720" w:gutter="0"/>
    <w:cols w:space="720"/>
    <w:docGrid w:linePitch="360"/>
  </w:sectPr>
</w:body>

UI在新下一页的第一个位置显示空的¶标记。分节符指示器直接出现在段落1文本之后,中间没有¶标记。

在第2段的第一个字符前插入偶数页分节符:

<w:body>
  <w:p>
    <w:r>
      <w:t>Paragraph 1</w:t>
    </w:r>
  </w:p>
  <w:p>
    <w:pPr>
      <w:sectPr>
        <w:type w:val="oddPage"/>
        <w:pgSz w:w="12240" w:h="15840"/>
        <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800"
                 w:header="720" w:footer="720" w:gutter="0"/>
        <w:cols w:space="720"/>
        <w:docGrid w:linePitch="360"/>
      </w:sectPr>
    </w:pPr>
  </w:p>
  <w:p>
    <w:r>
      <w:lastRenderedPageBreak/>
      <w:t>Paragraph 2</w:t>
    </w:r>
  </w:p>
  <w:sectPr>
    <w:type w:val="evenPage"/>
    <w:pgSz w:w="12240" w:h="15840"/>
    <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800"
             w:header="720" w:footer="720" w:gutter="0"/>
    <w:cols w:space="720"/>
    <w:docGrid w:linePitch="360"/>
  </w:sectPr>
</w:body>

枚举

WD_SECTION_START

别名: WD_SECTION

WdSectionStart Enumeration on MSDN

连续(0)

连续断开。

新_列(1)

新建列分节符。

新建页面(2)

新建分页符。

偶数页(3)

偶数页分节符。

奇数页(4)

奇数页分节符。

WD_ORIENTATION

别名: WD_ORIENT

WdOrientation Enumeration on MSDN

景观(1)

横向定位。

纵向(0)

纵向定位。

架构摘要

<xsd:complexType name="CT_PPr">  <!-- denormalized -->
  <xsd:sequence>
    <!-- 34 others ... -->
    <xsd:element name="sectPr"    type="CT_SectPr"    minOccurs="0"/>
    <xsd:element name="pPrChange" type="CT_PPrChange" minOccurs="0"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="CT_SectPr">  <!-- denormalized -->
  <xsd:sequence>
    <xsd:choice minOccurs="0" maxOccurs="6"/>
      <xsd:element name="headerReference" type="CT_HdrFtrRef"/>
      <xsd:element name="footerReference" type="CT_HdrFtrRef"/>
    </xsd:choice>
    <xsd:element name="footnotePr"      type="CT_FtnProps"      minOccurs="0"/>
    <xsd:element name="endnotePr"       type="CT_EdnProps"      minOccurs="0"/>
    <xsd:element name="type"            type="CT_SectType"      minOccurs="0"/>
    <xsd:element name="pgSz"            type="CT_PageSz"        minOccurs="0"/>
    <xsd:element name="pgMar"           type="CT_PageMar"       minOccurs="0"/>
    <xsd:element name="paperSrc"        type="CT_PaperSource"   minOccurs="0"/>
    <xsd:element name="pgBorders"       type="CT_PageBorders"   minOccurs="0"/>
    <xsd:element name="lnNumType"       type="CT_LineNumber"    minOccurs="0"/>
    <xsd:element name="pgNumType"       type="CT_PageNumber"    minOccurs="0"/>
    <xsd:element name="cols"            type="CT_Columns"       minOccurs="0"/>
    <xsd:element name="formProt"        type="CT_OnOff"         minOccurs="0"/>
    <xsd:element name="vAlign"          type="CT_VerticalJc"    minOccurs="0"/>
    <xsd:element name="noEndnote"       type="CT_OnOff"         minOccurs="0"/>
    <xsd:element name="titlePg"         type="CT_OnOff"         minOccurs="0"/>
    <xsd:element name="textDirection"   type="CT_TextDirection" minOccurs="0"/>
    <xsd:element name="bidi"            type="CT_OnOff"         minOccurs="0"/>
    <xsd:element name="rtlGutter"       type="CT_OnOff"         minOccurs="0"/>
    <xsd:element name="docGrid"         type="CT_DocGrid"       minOccurs="0"/>
    <xsd:element name="printerSettings" type="CT_Rel"           minOccurs="0"/>
    <xsd:element name="sectPrChange"    type="CT_SectPrChange"  minOccurs="0"/>
  </xsd:sequence>
  <xsd:attribute name="rsidRPr"  type="ST_LongHexNumber"/>
  <xsd:attribute name="rsidDel"  type="ST_LongHexNumber"/>
  <xsd:attribute name="rsidR"    type="ST_LongHexNumber"/>
  <xsd:attribute name="rsidSect" type="ST_LongHexNumber"/>
</xsd:complexType>

<xsd:complexType name="CT_HdrFtrRef">
  <xsd:attribute  ref="r:id"                  use="required"/>
  <xsd:attribute name="type" type="ST_HdrFtr" use="required"/>
</xsd:complexType>

<xsd:simpleType name="ST_HdrFtr">
  <xsd:restriction base="xsd:string">
    <xsd:enumeration value="even"/>
    <xsd:enumeration value="default"/>
    <xsd:enumeration value="first"/>
  </xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="CT_SectType">
  <xsd:attribute name="val" type="ST_SectionMark"/>
</xsd:complexType>

<xsd:simpleType name="ST_SectionMark">
  <xsd:restriction base="xsd:string">
    <xsd:enumeration value="nextPage"/>
    <xsd:enumeration value="nextColumn"/>
    <xsd:enumeration value="continuous"/>
    <xsd:enumeration value="evenPage"/>
    <xsd:enumeration value="oddPage"/>
  </xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="CT_PageSz">
  <xsd:attribute name="w"      type="s:ST_TwipsMeasure"/>
  <xsd:attribute name="h"      type="s:ST_TwipsMeasure"/>
  <xsd:attribute name="orient" type="ST_PageOrientation"/>
  <xsd:attribute name="code"   type="ST_DecimalNumber"/>
</xsd:complexType>

<xsd:simpleType name="ST_PageOrientation">
  <xsd:restriction base="xsd:string">
    <xsd:enumeration value="portrait"/>
    <xsd:enumeration value="landscape"/>
  </xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="CT_PageMar">
  <xsd:attribute name="top"    type="ST_SignedTwipsMeasure" use="required"/>
  <xsd:attribute name="right"  type="s:ST_TwipsMeasure"     use="required"/>
  <xsd:attribute name="bottom" type="ST_SignedTwipsMeasure" use="required"/>
  <xsd:attribute name="left"   type="s:ST_TwipsMeasure"     use="required"/>
  <xsd:attribute name="header" type="s:ST_TwipsMeasure"     use="required"/>
  <xsd:attribute name="footer" type="s:ST_TwipsMeasure"     use="required"/>
  <xsd:attribute name="gutter" type="s:ST_TwipsMeasure"     use="required"/>
</xsd:complexType>

<xsd:simpleType name="ST_SignedTwipsMeasure">
  <xsd:union memberTypes="xsd:integer s:ST_UniversalMeasure"/>
</xsd:simpleType>

<xsd:complexType name="CT_Columns">
  <xsd:sequence minOccurs="0">
    <xsd:element name="col" type="CT_Column" maxOccurs="45"/>
  </xsd:sequence>
    <xsd:attribute name="equalWidth" type="s:ST_OnOff"/>
    <xsd:attribute name="space"      type="s:ST_TwipsMeasure"/>
    <xsd:attribute name="num"        type="ST_DecimalNumber"/>
    <xsd:attribute name="sep"        type="s:ST_OnOff"/>
</xsd:complexType>

<xsd:complexType name="CT_Column">
  <xsd:attribute name="w"     type="s:ST_TwipsMeasure"/>
  <xsd:attribute name="space" type="s:ST_TwipsMeasure"/>
</xsd:complexType>