如果是npo生成的docx,那么需要用户手动保存过的,才会有正确的页数信息。

 

using System;
using System.IO;
using NPOI.HPSF;
using NPOI.XWPF.UserModel;
using System.IO;
using Microsoft.Win32;
using NPOI;

namespace todoc
{
    class Program
    {
        static void Main(string[] args)
        {

            XWPFDocument docx = new XWPFDocument(POIXMLDocument.OpenPackage("simple.docx"));

            int pages = docx.GetProperties().ExtendedProperties.GetUnderlyingProperties().Pages;
            Console.WriteLine(pages);


            Console.ReadKey();
            return;
       }
    }
}

  

相关文章:

  • 2021-10-12
  • 2022-12-23
  • 2022-01-29
  • 2021-09-22
  • 2021-11-18
  • 2022-12-23
  • 2021-11-25
  • 2021-07-05
猜你喜欢
  • 2021-12-25
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案