word, 如何用 C# 读取word文档中文本的属性,如字体、文字大小、颜色、是否粗体等

wucairong 2005-01-25 12:49:24
C#读取word文档中的指定格式的内容,
目前我已经能从word中读出全部文本内容或指定段落的内容,
现在需要读出符合一定条件的内容,
如读出word文档中所有字体颜色为红色、字号为36号的文本内容,
请问如何实现,希望各位能给个实现的思路
...全文
756 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
xtaylin 2005-02-05
  • 打赏
  • 举报
回复
Office安装目录下有个“Word对象模型”
Microsoft Office\OFFICE11\2052\VBAWD10.CHM
programbcb 2005-02-04
  • 打赏
  • 举报
回复
大哥,有没有中文的资料啊
scdsun 2005-01-31
  • 打赏
  • 举报
回复
Word里最基础的处理单元是Range

Word.Cell cell=getCell();
cell.Range.Text="你的文本";


建议你阅读这篇文档:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_vsto2003_ta/html/wordobject.asp

这里介绍了使用.net编写Word程序的基本方法
programbcb 2005-01-30
  • 打赏
  • 举报
回复
不太会,帮你顶
Object matchCase = Type.Missing;
Object matchWholeWord = Type.Missing;
Object matchWildcards = Type.Missing;
Object matchSoundsLike = Type.Missing;
Object matchAllWordForms = Type.Missing;
Object format = Type.Missing;
Object replaceWith = Type.Missing;
Object replace = Type.Missing;
Object matchKashida = Type.Missing;
Object matchDiacritics = Type.Missing;
Object matchAlefHamza = Type.Missing;
Object matchControl = Type.Missing;
Find(find,findText,matchCase,matchWholeWord,matchWildcards,matchSoundsLike,matchAllWordForms,forward,wrap,format,replaceWith,replace,matchKashida,matchDiacritics,matchAlefHamza,matchControl);
yizhixiaozhu 2005-01-30
  • 打赏
  • 举报
回复
帮楼主顶
学习
krisguobin 2005-01-29
  • 打赏
  • 举报
回复
WordApp As New Word.Application
MyDoc As New Word.Document

这个我会!!!
techgopher 2005-01-29
  • 打赏
  • 举报
回复
通过Find(Range或Selection对象)对象来进行带格式查找。
沐NeMo 2005-01-27
  • 打赏
  • 举报
回复
引用 word library

定义 WordApp As New Word.Application
定义 MyDoc As New Word.Document
WordApp.Documents.Add
Set MyDoc = WordApp.ActiveDocument

MyDoc.Range.Font.Color = wdColorRed //红色
MyDoc.Range.Font.bold = True //粗体
MyDoc.Range.Font.Name = "Arial Narrow" //字体为 Arial Narrow ,或用"宋体"

5,174

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 Office开发/ VBA
社区管理员
  • Office开发/ VBA社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧