我一直在尝试以下代码来使用 Microsoft office interop word 12 获取段落的第一行或前 20 个字符
Microsoft.Office.Interop.Word.Application w = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document doc;
int iParaStart = Para.Range.Start;
Para.Range.Text = "A big Paragraph Comes here …….";
Para = doc.Paragraphs.Add();
int iParaEnd = Para.Range.End;
// to select the first sentance code tried
doc.Range(iRangeStart,iRangeEnd).Sentences.First.Select();
doc.Range(iRangeStart,iRangeEnd).Sentences.First.Shading.BackgroundPatternColor=WdColor.wdColorOrange;
// to get the characters code tried
doc.Range(iRangeStart,iRangeStart+20).Select();
好像不工作我该怎么做。我需要选择第一句话或前 20 个字符