永利最大(官方)网站

Word控件Spire.Doc 【段落处理】教程(十八):在 C# 中从 Word 文档中删除段落

翻译|使用教程|编辑:胡涛|2022-06-01 10:40:57.670|阅读 63 次

概述:本文详细介绍了如何使用 Spire.Doc 和 C# 从 Word 文档中删除段落。 我们使用的示例 word 文档:

#慧都22周年庆大促·界面/图表报表/文档/IDE/IOT/测试等千款热门软控件火热促销中>>

相关链接:

 Spire.Doc 支持从 word 文档中删除特定段落以及所有段落。本文详细介绍了如何使用 Spire.Doc 和 C# 从 Word 文档中删除段落。

我们使用的示例 word 文档:

Spire.Doc for.NET 最新下载

在 C# 中从 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);
}
}
}

输出:

在 C# 中从 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 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);

}
}
}

在 C# 中从 Word 文档中删除段落


欢迎下载|体验更多E-iceblue产品

获取更多信息请咨询  ;技术交流Q群(767755948)


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@hmdbvip.cn


为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP
PM娱乐城网络现金网站(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) PM娱乐城最大(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 永利外围最新(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 网络权威朗驰娱乐大全(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 永利真人网上足球(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 利记最火十大网(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) boyu·博鱼权威网络足球(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) PM娱乐城网上足球(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新)