Hi, I have one input word document file with content like Cost of 1 (1 Jan 2017 -12 Jan 2017): 50 Rs . Cost of 2(3 Jan 2017 -12 Jan 2017): 60 Rs . Cost of 3(5 Jan 2017 -12 Jan 2017): 20 Rs . Cost of 4(6 Jan 2017 -12 Jan 2017): 10 Rs . Cost of 5(8 Jan 2017-12 Jan 2017): 90 Rs .
public Range GetRange(object findText, object LastText) { Range range1 = doc.Content; range1.Find.Execute(findText); range1.Find.Execute(findText); Range range2 = doc.Content; range2.Find.Execute(LastText); range2.Find.Execute(LastText); if (range2.Start > range1.Start) { Range rng = doc.Range(range1.Start, range2.End); return rng; } else return null; }
var content= inputWord.GetRange("Cost of 1", "Rs.");
for(int i=1;i<6;i++) { var content= inputWord.GetRange(String.Format("Cost of {0}", i), "Rs."); //your code here }
int i= 1; do { var content= inputWord.GetRange(String.Format("Cost of {0}", i), "Rs."); //your code here i+=1; } while(content!=null);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)