文檔半島外圍網上直營>>E-iceblue中文文檔>>從 Word 文檔中刪除段落
                從 Word 文檔中刪除段落
Spire.Doc for .NET是一款專門對 Word 文檔進行操作的 .NET 類庫。在于幫助開發人員無需安裝 Microsoft Word情況下,輕松快捷高效地創建、編輯、轉換和打印 Microsoft Word 文檔。擁有近10年專業開發經驗Spire系列辦公文檔開發工具,專注于創建、編輯、轉換和打印Word/PDF/Excel等格式文件處理,小巧便捷。
E-iceblue 功能類庫Spire 系列文檔處理組件均由中國本土團隊研發,不依賴第三方軟件,不受其他國家的技術或法律法規限制,同時適配國產操作系統如中科方德、中標麒麟等,兼容國產文檔處理軟件 WPS(如 .wps/.et/.dps 等格式
Spire.Doc for.NET 最新下載
技術交流Q群(767755948)
Spire.Doc 支持從 word 文檔中刪除特定段落以及所有段落。本文詳細介紹了如何使用 Spire.Doc 和 C# 從 Word 文檔中刪除段落。
我們使用的示例 word 文檔:
 
 
刪除特定段落
using Spire.Doc;
namespace RemoveParagh
{
class Program
{
static void Main(string[] args)
{
//Instantiate a Document object
Document document = new Document();
//Load the Word document
document.LoadFromFile("Input.docx");
//Remove the first paragraph from the first section of the document
document.Sections[0].Paragraphs.RemoveAt(0);
//Save the document
document.SaveToFile("RemoveParagraph.docx", FileFormat.Docx2013);
}
}
}
輸出:
	 
 
刪除所有段落
using Spire.Doc;
namespace RemoveParagh
{
class Program
{
static void Main(string[] args)
{
//Instantiate a Document object
Document document = new Document();
//Load the Word document
document.LoadFromFile("Input.docx");
//Remove paragraphs from every section in the document
foreach (Section section in document.Sections)
{
section.Paragraphs.Clear();
}
//Save the document
document.SaveToFile("RemoveAllParagraphs.docx", FileFormat.Docx2013);
}
}
}
	 
 
歡迎下載|體驗更多E-iceblue產品

 QQ交談
QQ交談 在線咨詢
在線咨詢 
                 
                
 渝公網安備
            50010702500608號
渝公網安備
            50010702500608號
             
            
 客服熱線
客服熱線