我在写一段代码在c#生成一份报告中microsft word文档。

  • 我有一个表格的妇女参与发展的2列。
  • 我选择2列通过

    oMainTable.细胞(currentRowNumber,2).范围

  • 每次我有写一些东西在我用上述代码相结合的文本的财产,InsertParagraph(),新段落()等等等等

现在可以说我有这样的内容:

一些样品内容的一些样品 内容的一些样本内容一些 样品内容的一些样本内容 一些样品内容的一些样品 内容。

New Paragraph Some sample content Some sample content Some sample

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

Some Title1

New Paragraph Some sample content Some sample content Some sample

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

New Paragraph Some sample content Some sample content Some sample

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

Some Title1

我想要应用下划线和粗斜体为someTitle1和someTitle2使得它们不适用于整个范围;和保持有限的,这两个文本行只。

任何帮助吗?

感谢

有帮助吗?

解决方案

让我做一个声明的第一;-)"**解决方案提出这里是结果我的命中和审判做法和头部的敲打**"

    object srchText="Text to be searched and formatted differently from the rest of the range";
    oTable.Cell(countRow, 2).Range.Select();
    var selectUpdateComment=oTable.Cell(countRow, 2).Range.Application.Selection;
    selectUpdateComment.Find.Execute2007(ref srchText, ref missing, ref missing,
 ref missing, ref missing, ref missing, ref missing, ref missing,
 ref missing, ref missing, ref missing, ref missing, ref missing,
 ref missing, ref missing, ref missing, ref missing, ref missing,ref missing, ref missing);

    if(selectUpdateComment.Find.Found) {
        selectUpdateComment.Font.Bold=1;
        selectUpdateComment.Font.Underline=WdUnderline.wdUnderlineSingle;
    }

我这样做在一个循环所以每次我不得不这样做的范围内。选择,否则我不会得到正确的选择。

请提出更好的办法..

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top