有没有办法用C#实现把WORD文档中某些已知字符串变成红色或者是加下划线

elixir2002 2005-03-21 08:57:20
有没有办法用C#实现把WORD文档中某些已知字符串变成红色或者是加下划线。起到打记的作用,
谢谢各位拉
...全文
416 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
elixir2002 2005-03-23
  • 打赏
  • 举报
回复
用tlbimp MSWORD9.OLB /out:Microsoft.Office.Word.dll生成一个dll


什么意思??
elixir2002 2005-03-22
  • 打赏
  • 举报
回复
我不给分是因为我还没搞懂吗
corbet 2005-03-22
  • 打赏
  • 举报
回复
顶上去!
lldwolf 2005-03-22
  • 打赏
  • 举报
回复
还不给分!!
rainlake 2005-03-22
  • 打赏
  • 举报
回复
用tlbimp MSWORD9.OLB /out:Microsoft.Office.Word.dll生成一个dll
lldwolf 2005-03-22
  • 打赏
  • 举报
回复
给分太慢会打击群众回答问题的积极性的^_^
elixir2002 2005-03-21
  • 打赏
  • 举报
回复
ha
readersm68 2005-03-21
  • 打赏
  • 举报
回复
Mark
gdami 2005-03-21
  • 打赏
  • 举报
回复
楼上正解 。
mark
lldwolf 2005-03-21
  • 打赏
  • 举报
回复
//引用 Microsoft Word 9.0 Object Library
Word.Application wApp = new Word.ApplicationClass();
wApp.Visible = true;

object WordFile = @"E:\Work\Tools\WindowsApplication1\bin\Debug\test.doc";
object ConfirmConversions = false;
object ReadOnly = false;
object AddToRecentFiles = false;
object PasswordDocument = "";
object PasswordTemplate = "";
object Revert = false;
object WritePasswordDocument = "";
object WritePasswordTemplate = "";
object Format = Word.WdOpenFormat.wdOpenFormatAuto;
object Encoding = Missing.Value;
object Visible = true;

Word.Document wDoc = wApp.Documents.Open(ref WordFile, ref ConfirmConversions, ref ReadOnly,
ref AddToRecentFiles, ref PasswordDocument, ref PasswordTemplate, ref Revert,
ref WritePasswordDocument, ref WritePasswordTemplate, ref Format, ref Encoding, ref Visible);
Word.Find find = wApp.Selection.Find;
find.ClearFormatting();

object FindText = "要标识的词";
object MatchCase = false;
object MatchWholeWord = true;
object MatchWildcards = false;
object MatchSoundsLike = false;
object MatchAllWordForms = false;
object Forward = true;
object Wrap = Word.WdFindWrap.wdFindStop;
object Find_Format = false;
object ReplaceWith = "";
object Replace = Word.WdReplace.wdReplaceNone;
object MatchKashida = false;
object MatchDiacritics = false;
object MatchAlefHamza = false;
object MatchControl = false;
while(find.Execute(ref FindText, ref MatchCase, ref MatchWholeWord, ref MatchWildcards, ref MatchSoundsLike,
ref MatchAllWordForms, ref Forward, ref Wrap, ref Find_Format, ref ReplaceWith, ref Replace, ref MatchKashida,
ref MatchDiacritics, ref MatchAlefHamza, ref MatchControl))
{
wApp.Selection.Font.Color = Word.WdColor.wdColorRed;
find.ClearFormatting();
}
elixir2002 2005-03-21
  • 打赏
  • 举报
回复
什么??
elixir2002 2005-03-21
  • 打赏
  • 举报
回复
没搞错
beibeilong 2005-03-21
  • 打赏
  • 举报
回复
帮忙顶
epimetheus 2005-03-21
  • 打赏
  • 举报
回复
有办法,我可以给你写一个Dll类。你直接用即可
心情解码 2005-03-21
  • 打赏
  • 举报
回复
:)








-
wwei69 2005-03-21
  • 打赏
  • 举报
回复
up
elixir2002 2005-03-21
  • 打赏
  • 举报
回复
up
cailsoft 2005-03-21
  • 打赏
  • 举报
回复
学习
conan19771130 2005-03-21
  • 打赏
  • 举报
回复
收藏

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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