文檔金喜正規買球>>Aspose中文文檔>>在 NPOI 中使用標題
在 NPOI 中使用標題
Aspose.Words是一種高級Word文檔處理API,用于執行各種文檔管理和操作任務。API支持生成,修改,轉換,呈現和打印文檔,而無需在跨平臺應用程序中直接使用Microsoft Word。
Aspose API支持流行文件格式處理,并允許將各類文檔導出或轉換為固定布局文件格式和最常用的圖像/多媒體格式。
Aspose.Words
Document wordDocument = new Document("Convert Word Doc to Other Formats.doc"); HeaderFooterCollection headers = wordDocument.FirstSection.HeadersFooters; foreach (HeaderFooter header in headers) { if (header.HeaderFooterType == HeaderFooterType.HeaderFirst || header.HeaderFooterType == HeaderFooterType.HeaderPrimary || header.HeaderFooterType == HeaderFooterType.HeaderEven) Console.WriteLine(header.GetText()); }
點擊復制
NPOI
XWPFDocument wordDocument = new XWPFDocument(new FileStream("Working with Headers.doc", FileMode.Open)); IList<XWPFHeader> headers = wordDocument.HeaderList; foreach (XWPFHeader header in headers) { Console.WriteLine(header.Text); }
點擊復制
下載運行代碼
下載示例代碼