Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Word 2010 automation

Word 2010 automation

Scheduled Pinned Locked Moved C#
csharptestingcollaborationtools
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Abhi Lahare
    wrote on last edited by
    #1

    What reference assembly I need to add to achieve word automation, a week back sysadmin install office 2010 bundle. Though I do not use C# at my work. and haven't code since last 3 yrs. I am trying to code some internal utilities for team and myself. TIA

    P 1 Reply Last reply
    0
    • A Abhi Lahare

      What reference assembly I need to add to achieve word automation, a week back sysadmin install office 2010 bundle. Though I do not use C# at my work. and haven't code since last 3 yrs. I am trying to code some internal utilities for team and myself. TIA

      P Offline
      P Offline
      Paladin2000
      wrote on last edited by
      #2

      Microsoft.Office.Interop.Word * EDIT * Also: Here is a sample...

      using Word = Microsoft.Office.Interop.Word;

      Word.Application _wordApp = new Word.ApplicationClass();
      object nullObj = System.Reflection.Missing.Value;
      object readOnly = true;
      object visible = false;
      object fileName = "some file name";
      object saveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;

      Word.Document _doc = _wordApp.Documents.Open(ref fileName, ref nullObj, ref readOnly,
      ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
      ref nullObj, ref visible, ref nullObj, ref nullObj, ref nullObj, ref nullObj);
      _doc.Activate();
      _doc.PrintOut(ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
      ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
      ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj);

      modified on Thursday, March 17, 2011 4:32 PM

      A 1 Reply Last reply
      0
      • P Paladin2000

        Microsoft.Office.Interop.Word * EDIT * Also: Here is a sample...

        using Word = Microsoft.Office.Interop.Word;

        Word.Application _wordApp = new Word.ApplicationClass();
        object nullObj = System.Reflection.Missing.Value;
        object readOnly = true;
        object visible = false;
        object fileName = "some file name";
        object saveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;

        Word.Document _doc = _wordApp.Documents.Open(ref fileName, ref nullObj, ref readOnly,
        ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
        ref nullObj, ref visible, ref nullObj, ref nullObj, ref nullObj, ref nullObj);
        _doc.Activate();
        _doc.PrintOut(ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
        ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
        ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj);

        modified on Thursday, March 17, 2011 4:32 PM

        A Offline
        A Offline
        Abhi Lahare
        wrote on last edited by
        #3

        Thanks Tim, I am missing Microsoft.Office.Interop.Word in MSVC 2005, COM assembly listing.Google did not gave me any good results.

        L 1 Reply Last reply
        0
        • A Abhi Lahare

          Thanks Tim, I am missing Microsoft.Office.Interop.Word in MSVC 2005, COM assembly listing.Google did not gave me any good results.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          I'd guess you have to download them. Maybe this Google result[^] helps. :)

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups