文檔首頁>>Aspose中文文檔>>刪除頁眉和頁腳
刪除頁眉和頁腳
Aspose.Words是一種高級(jí)Word文檔處理API,用于執(zhí)行各種文檔管理和操作任務(wù)。API支持生成,修改,轉(zhuǎn)換,呈現(xiàn)和打印文檔,而無需在跨平臺(tái)應(yīng)用程序中直接使用Microsoft Word。
Aspose API支持流行文件格式處理,并允許將各類文檔導(dǎo)出或轉(zhuǎn)換為固定布局文件格式和最常用的圖像/多媒體格式。
VSTO
Word.Document doc = Application.Documents.Open("Add Headers and Footers.doc"); Globals.ThisAddIn.Application.ActiveDocument.Sections[1].Headers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Paragraphs.Last.Range.Delete(); Globals.ThisAddIn.Application.ActiveDocument.Sections[1].Footers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Paragraphs.Last.Range.Delete();
點(diǎn)擊復(fù)制
Aspose.Words
Document doc = new Document("Remove Headers and Footers.doc"); foreach (Section section in doc) { section.HeadersFooters.RemoveAt(0); HeaderFooter footer; // Primary footer is the footer used for odd pages. footer = section.HeadersFooters[HeaderFooterType.FooterPrimary]; if (footer != null) footer.Remove(); } doc.Save("Remove Headers and Footers.doc");
點(diǎn)擊復(fù)制
下載示例代碼