Microsoft.Office.Interop.Word

Last post 07-10-2008 1:56 AM by TATWORTH. 28 replies.

Sort Posts:

  • Microsoft.Office.Interop.Word

    06-12-2008, 6:17 AM

    Hi all i am working on the Microsoft.Office.Interop.Word COM component. I need to find the line number of a found text. How do i go about doing this?. Please help me.

  • Re: Microsoft.Office.Interop.Word

    06-12-2008, 7:42 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 6,474

    Are you trying to use Word from an ASP.NET web page. It can be done (I have done it), but you will great problems setting all the required permissions to get it to work. This is why Word is not supported running behind an ASP.NET web page.

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Microsoft.Office.Interop.Word

    06-12-2008, 11:54 PM

    I am using windows application.I have the following requirements

    1. I need to find the text in the MS word document.

    2. I need to get the line number of that text.

    3. In the next line i need to write some text.

  • Re: Microsoft.Office.Interop.Word

    06-15-2008, 9:26 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 6,474

    >I am using windows application.I have the following requirements

    Are you using Winforms or Webforms?

    Which version or versions of word are you using? 

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Microsoft.Office.Interop.Word

    06-16-2008, 5:42 AM

    HI i am using Winforms, MS office word 2003 version, and i am using the namespace MS word 11.0 object library. Please do help me in resolving this issue..its very urgent

  • Re: Microsoft.Office.Interop.Word

    06-16-2008, 7:20 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 6,474

    >Hi I am using Winforms

    As you are using WinForms, you should be posting your question on the MSDN forums rather than here where it is for WebForms.

    One of the problems you will probably face is that of Com+ activation permissions. To set these, go:

    1. Start, Run, enter MMC, OK
    2. File, Add/Remove Snap-in
    3. Click Add
    4. Select Component Services, Add, Close
    5. Click OK
    6. Save you MMC for alter use.

    When you get a COM error, not the object class and find it in the COM explorer. Once found you can fix the permissions.

    I urge you to do this using a virtual machine if at all possible as you if make a copy of the VM before you start, you can very easily roll back.

     

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Microsoft.Office.Interop.Word

    06-16-2008, 7:27 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 6,474
    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Microsoft.Office.Interop.Word

    06-16-2008, 7:31 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 6,474
    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Microsoft.Office.Interop.Word

    06-16-2008, 8:16 AM

    How do i know about the object model on the word document

     

  • Re: Microsoft.Office.Interop.Word

    06-17-2008, 7:28 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 6,474

    >How do I know about the object model on the word document

    You will need to explore the Microsoft Documentation.

    Have you tried the example code from CodeProject? 

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Microsoft.Office.Interop.Word

    06-18-2008, 3:32 AM
    string str = @"D:\Canarys\Project\doc1.doc";

    object str1 = str;

    object missing = Missing.Value;

    Word.ApplicationClass wordApp = new Word.ApplicationClass();

    Word.Document doc = wordApp.Documents.Open(ref str1, 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);

    doc.Activate();

    object str2 = "Microsoft.Office.Interop.Word";

    //wordApp.Selection.Find.Execute(ref str2,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);

    //MessageBox.Show(Convert.ToString(wordApp.Selection.Find.Execute(ref str2,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)));

    //doc.Range(

    //Word.Sections sec1 = doc.Sections;

    //Word.Range rng = sec1.Range;

    //Word.Section sec2 = doc.Sections.Add();

    //Word.InlineShape ils = new Word.InlineShape();

    //ils = doc.InlineShapes.AddPicture(@"C:\Documents and Settings\geethan\My Documents\My Pictures\HLD.JPG", true, true, rng);

    //doc.Save();

    object wdWrap = Microsoft.Office.Interop.Word.WdFindWrap.wdFindStop;

    //object missing = System.Reflection.Missing.Value;

    object replaceAll = Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll;

     

    Word.
    Range storyRange;foreach (Word.Range oRange in doc.StoryRanges)

    {

    storyRange = oRange.Duplicate;

    do

    {

    Word.
    Range findRange = storyRange.Duplicate;if (findRange.Text != "")

    {

    findRange.Find.Text = "Microsoft.Office.Interop.Word";

    //findRange.Find.Replacement.Text = "";

    findRange.Find.Wrap = (Word.WdFindWrap)wdWrap;

    findRange.Find.Execute(

    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);

    object unit=Word.WdUnits.wdWord;//.wdCharacter;

    object count = 1;

    object type = Word.WdBreakType.wdLineBreak;

    if (findRange.Find.Found == true)

    {

    //object rng = findRange.GoTo(Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine,.Duplicate;

     

    findRange.Move(ref unit,ref count);//.MoveEnd(ref uni,ref count);//.Duplicate;//findRange.GoToNext(Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine);

    findRange.GoToNext(Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine);

    object rng1 = findRange.Duplicate;

    findRange.InlineShapes.AddPicture(@"C:\Documents and Settings\geethan\My Documents\My Pictures\HLD.JPG", ref missing, ref missing, ref rng1);//.GoToNext(Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine);

    }

    }

    storyRange = storyRange.NextStoryRange;

    }
    while (storyRange != null);

    }

  • Re: Microsoft.Office.Interop.Word

    06-18-2008, 7:08 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 6,474

    Geetha What do you need done with your code listing?

     

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Microsoft.Office.Interop.Word

    07-08-2008, 12:27 AM

    HI can u please tell me how to use this word PIA in ASP.net web page.Its very urgent

  • Re: Microsoft.Office.Interop.Word

    07-08-2008, 1:59 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 6,474

     Did you install the PIA according to the instructions?

    Have you run Word interactively on the Server? 

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Microsoft.Office.Interop.Word

    07-08-2008, 2:17 AM

    Yes i downloaded the oxppia.exe and run them and then installed register.bat this made the Microsoft.Office.Interop.Word.dll to install in GAC. But  i am not able to refer this in the website project. Please do help me

Page 1 of 2 (29 items) 1 2 Next >