User-1542157572 posted
Hi thank you i am able to refer to the dll finally. Now i have got an exception in the code saying "the command is not available" I ill send you the code please do verify it
1 protected void btnUpload_Click(object sender, EventArgs e)
2 {
3 if (FileUpload.HasFile)
4 {
5 if (FileUpload.PostedFile.FileName.EndsWith(".doc"))
6 {
7 string strFilename = FileUpload.PostedFile.FileName;
8 object objFileName=strFilename;
9 object missing =Missing.Value;
10 Word.ApplicationClass wordApp = new Word.ApplicationClass();
11 Word.Document doc = wordApp.Documents.Open(ref objFileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
12 doc.Activate();
13 object objWrap=Word.WdFindWrap.wdFindStop;
14 Word.Range storyRange;
15 foreach (Word.Range rng in doc.StoryRanges)
16 {
17 storyRange = rng.Duplicate;
18 do
19 {
20 Word.Range findRange = storyRange.Duplicate;
21 if (findRange.Text != "")
22 {
23 findRange.Find.Text = "Yours truly,";
24 findRange.Find.Wrap=(Word.WdFindWrap)objWrap;
25 (Here i will get the Exception)findRange.Find.ExecuteOld(ref missing, ref missing, ref missing, ref missing, ref missing,ref missing, ref missing, ref missing, ref missing, ref missing,ref missing);//, ref missing, ref missing, ref missing, ref missing);
26 if (findRange.Find.Found == true)
27 {
28 object objUnit = Word.WdUnits.wdWord;
29 object count=1;
30 object rngAdd = findRange.Duplicate;
31 findRange.Move(ref objUnit, ref count);
32 findRange.GoToNext(Word.WdGoToItem.wdGoToLine);
33 findRange.InlineShapes.AddPicture(@"C:\Documents and Settings\support\Desktop\canaryslogo.jpg", ref missing, ref missing, ref rngAdd);
34 }
35 }
36 storyRange = findRange.NextStoryRange;
37 }while(storyRange!=null);
38 }
39 }
40 }
41 }