日期:2014-05-19  浏览次数:20941 次

这段代码什么意思啊VSTO
if   (this.Paragraphs.Count   >   0)//为什么这里的this.Paragraphs.Count   提示我找不到Paragraphs呢。
{
Word.Range   par   =   this.Paragraphs[Paragraphs.Count].Range;
{
Word.Range   singleSent   =   par.Sentences[2];
if   (singleSent   !=   null   &&   singleSent.Words   !=   null   &&
singleSent.Words.Count   >   0)
{
for   (int   i   =   1;   i   <   singleSent.Words.Count;   i++)
{
if   (singleSent.Words[i].Text.ToLower().Trim()   ==
“documents”)
{
Word.Range   removeChar   =   singleSent.Words[i];
removeChar.Delete(ref   missing,   ref   missing);
//delete   and   add   customizations
removeChar.InsertAfter(“   document’s   “);
removeChar.Font.Name   =   “Arial”;
removeChar.Font.Size   =   10F;
removeChar.Font.Color   =
Word.WdColor.wdColorDarkRed;
removeChar.Underline   =
Word.WdUnderline.wdUnderlineDash;
}
}
}
}
}

------解决方案--------------------
这是一段处理WORD的程序,大概是设字体,你添加了OFFICE引用了吗