【问题标题】:How to add page number to WordProccesingDocument OpenXml C#如何将页码添加到 WordProccesingDocument OpenXml C#
【发布时间】:2015-07-29 14:35:18
【问题描述】:

public static void AddNumeration(ref WordprocessingDocument finalDoc) {

        IEnumerable<FooterPart> foo = finalDoc.MainDocumentPart.FooterParts;

        int count = 1;
        foreach (FooterPart fp in foo){

        Footer f = new Footer();

        ParagraphProperties paragraphProperties1 = new ParagraphProperties(new SectionProperties(new PageNumberType { Start = 1 }));
        paragraphProperties1.NumberingProperties = NumberingProperties
        paragraphProperties1.Justification = new Justification() { Val = JustificationValues.Right };
        Run run1 = new Run();
        Text text1 = new Text();

        text1.Text = count.ToString();
        count++;
        run1.Append(text1);
        Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "00164C17", RsidRunAdditionDefault = "00164C17" };

        paragraph1.Append(paragraphProperties1);
        paragraph1.Append(run1);

        f.Append(paragraph1);

        fp.Footer = f;
     }


    }

此代码始终在每页的页脚部分显示数字 1。

【问题讨论】:

    标签: c# openxml page-numbering


    【解决方案1】:

    【讨论】:

    • 也就是说...如果您想购买 Spire.Doc for .NET 软件包,那么“Google 上的小搜索”可能会有所帮助
    猜你喜欢
    • 2023-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-05
    相关资源
    最近更新 更多