做对WORD文档读取时会经常对定位有问题,在msdn中有一个WordApp的小程序,本文就以它为例
准备:初学者对找WORD控件有很大问题,要在对office 2003中添加/更改对Net的支持
对word文档的读取定位小问题
然后加入using Microsoft.Office.Interop.Word;
这样就可以引用word功能了
现在是定位问题,要对某段字符进行改变
    start = 37; end =40;
    range=Word_doc.Range(ref start, ref end);
     range.Font.Bold=16;
    range.Font.Color=WdColor.wdColorLavender;
意思是将第37和40个字符之间的字符修改bold 和color
注意:换行键算一个字符,空格不算
下面全部给出源代码,大家可以在第130行修改试验
  1对word文档的读取定位小问题using System;
  2对word文档的读取定位小问题using System.Diagnostics;
  3对word文档的读取定位小问题using System.Runtime.InteropServices;
  4对word文档的读取定位小问题using System.Reflection;
  5对word文档的读取定位小问题using System.Collections;
  6对word文档的读取定位小问题using System.Threading;
  7对word文档的读取定位小问题using Microsoft.Office.Interop.Word;
  8对word文档的读取定位小问题
  9对word文档的读取定位小问题namespace Microsoft.Samples.Interop.WordApp
 10

相关文章:

  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2021-12-09
  • 2021-07-31
  • 2022-12-23
猜你喜欢
  • 2021-04-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-10
  • 2022-12-23
  • 2021-05-08
相关资源
相似解决方案