首页 > 解决方案 > 如何更改 Word Docx 的页码

问题描述

我有一个生成的 word 文档 (docx) 并且想在之后更改页码,以从数字 X 开始的方式。页码包含在 word 文档的页脚中。我需要在 XML 文件的哪个位置应用此更改?

我已将文档更改为从 4 号开始,并查看了 XML 代码。该元素<w:pgNumType w:start="4"/>已添加。但是如果我只手动将这部分添加到 XML 中,文档就会损坏。

添加“以数字 4 开头”之前的 document.xml 内容:

        <w:sectPr w:rsidR="00C17A11" w:rsidRPr="00CD0C83" w:rsidSect="00A86D42">
            <w:headerReference r:id="rId8" w:type="even"/>
            <w:headerReference r:id="rId9" w:type="default"/>
            <w:footerReference r:id="rId10" w:type="even"/>
            <w:footerReference r:id="rId11" w:type="default"/>
            <w:headerReference r:id="rId12" w:type="first"/>
            <w:footerReference r:id="rId13" w:type="first"/>
            <w:pgSz w:h="16838" w:w="11906"/>
            <w:pgMar w:bottom="851" w:footer="567" w:gutter="0" w:header="851" w:left="1304" w:right="567" w:top="828"/>
            <w:cols w:space="708"/>
            <w:docGrid w:linePitch="360"/>
        </w:sectPr>

添加“从数字 4 开始”后:

<w:sectPr w:rsidR="00C17A11" w:rsidRPr="00CD0C83" w:rsidSect="00CA253E">
  <w:headerReference w:type="default" r:id="rId8"/>
  <w:footerReference w:type="default" r:id="rId9"/>
  <w:pgSz w:w="11906" w:h="16838"/>
  <w:pgMar w:top="828" w:right="567" w:bottom="851" w:left="1304" w:header="851" w:footer="567" w:gutter="0"/>
  <w:pgNumType w:start="4"/>
  <w:cols w:space="708"/>
  <w:docGrid w:linePitch="360"/>
</w:sectPr>

标签: ms-wordopenxmlpage-numbering

解决方案


正如Josch提到的,你做的一切都是正确的。没有什么要添加到文档中的了。

我在 Word 中创建了一个 4 页的空文档,然后解压缩了 .wordx 文件的内容。

这是我的document.xml文件。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se wp14">
    <w:body>
        <w:p w:rsidR="00ED7F18" w:rsidRDefault="00ED7F18">
            <w:r>
                <w:br w:type="page"/>
            </w:r>
        </w:p>
        <w:p w:rsidR="00ED7F18" w:rsidRDefault="00ED7F18">
            <w:r>
                <w:lastRenderedPageBreak/>
                <w:br w:type="page"/>
            </w:r>
        </w:p>
        <w:p w:rsidR="00ED7F18" w:rsidRDefault="00ED7F18">
            <w:r>
                <w:lastRenderedPageBreak/>
                <w:br w:type="page"/>
            </w:r>
        </w:p>
        <w:p w:rsidR="0070592A" w:rsidRDefault="00ED7F18"/>
        <w:sectPr w:rsidR="0070592A" w:rsidSect="00ED7F18">
            <w:headerReference w:type="even" r:id="rId6"/>
            <w:headerReference w:type="default" r:id="rId7"/>
            <w:footerReference w:type="even" r:id="rId8"/>
            <w:footerReference w:type="default" r:id="rId9"/>
            <w:headerReference w:type="first" r:id="rId10"/>
            <w:footerReference w:type="first" r:id="rId11"/>
            <w:pgSz w:w="11906" w:h="16838"/>
            <w:pgMar w:top="1417" w:right="1417" w:bottom="1134" w:left="1417" w:header="708" w:footer="708" w:gutter="0"/>
            <w:pgNumType w:start="4"/>
            <w:cols w:space="708"/>
            <w:docGrid w:linePitch="360"/>
        </w:sectPr>
    </w:body>
</w:document>

更改以下行

<w:pgNumType w:start="4"/>

<w:pgNumType w:start="5"/>

然后拉回所有内容就可以了。

您可能正在将内容连同它们所在的文件夹一起压缩回去。

请确保 zip 文件具有以下文件夹/文件。

_rels
docProps
word
[Content_Types].xml

推荐阅读