I have been trying the following code to get the first line or first 20 characters of a paragraph using Microsoft office interop word 12
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();
It seems like not working How can i do this . I need to select the either first sentence or first 20 characters