C# 范围:将格式应用于范围中的子节

C# 范围:将格式应用于范围中的子节,c#,interop,ms-office,office-automation,word-automation,C#,Interop,Ms Office,Office Automation,Word Automation,我正在用c#编写一段代码,以便在MicrosoftWord文档中生成报告 我有一个包含两列的表 我选择第二列 oMainTable.单元格(currentRowNumber,2).范围 每次我必须在那个单元格中写东西时,我都会使用上面的代码,并结合文本属性insertparagration()、InsertAfter()等 现在让我们假设我有以下内容: 一些样品内容一些样品 内容一些样本内容一些 样本内容一些样本内容 一些样品内容一些样品 内容 New Paragraph Some samp

我正在用c#编写一段代码,以便在MicrosoftWord文档中生成报告

  • 我有一个包含两列的表
  • 我选择第二列

    oMainTable.单元格(currentRowNumber,2).范围

  • 每次我必须在那个单元格中写东西时,我都会使用上面的代码,并结合文本属性insertparagration()、InsertAfter()等

现在让我们假设我有以下内容:

一些样品内容一些样品 内容一些样本内容一些 样本内容一些样本内容 一些样品内容一些样品 内容

New Paragraph Some sample content Some sample content Some sample
New Paragraph Some sample content Some sample content Some sample
内容一些样本内容一些 样本内容一些样本内容 一些样本内容

Some Title1

New Paragraph Some sample content Some sample content Some sample
Some Title1
内容一些样本内容一些 样本内容一些样本内容 一些样本内容

Some Title1

New Paragraph Some sample content Some sample content Some sample
Some Title1
内容一些样本内容一些 样本内容一些样本内容 一些样本内容

Some Title1

New Paragraph Some sample content Some sample content Some sample
Some Title1
我想对一些标题1和一些标题2使用下划线和粗体斜体,这样它们就不适用于整个范围;并仅限于这两行文字

有什么帮助吗


谢谢

让我先做一个免责声明;-)“**这里介绍的解决方案是我的点击试验方法和头部撞击的结果**”

我在一个循环中做这个,所以每次我都要做Range.Select,否则我就得不到正确的选择


请建议更好的方法。

我已经解决了。.请参阅下面的ANWR。