我们使用的示例 word 文档:
我们使用的示例 word 文档:

删除特定段落
using Spire.Doc;namespace RemoveParagh{class Program{static void Main(string[] args){//Instantiate a Document objectDocument document = new Document();//Load the Word documentdocument.LoadFromFile("Input.docx");//Remove the first paragraph from the first section of the documentdocument.Sections[0].Paragraphs.RemoveAt(0);//Save the documentdocument.SaveToFile("RemoveParagraph.docx", FileFormat.Docx2013);}}}
输出:

删除所有段落
using Spire.Doc;namespace RemoveParagh{class Program{static void Main(string[] args){//Instantiate a Document objectDocument document = new Document();//Load the Word documentdocument.LoadFromFile("Input.docx");//Remove paragraphs from every section in the documentforeach (Section section in document.Sections){section.Paragraphs.Clear();}//Save the documentdocument.SaveToFile("RemoveAllParagraphs.docx", FileFormat.Docx2013);}}}

欢迎下载|体验更多E-iceblue产品
获取更多信息请咨询在线客服 ;
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!