using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
using Microsoft.Office.Interop;
namespace Mytest
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
            System.Windows.Forms.Application.Run(new Form1());
            object filename = "C:\\Documents and Settings\\jwang.WICRESOFT\\Desktop\\Intern\\mywork.doc";    //要打开的文档路径
            string strKey = "develop";      //要搜索的文本
            object MissingValue = Type.Missing;            Word.Application wp = new ApplicationClass();
            Word.Document wd = wp.Documents.Open(ref filename, ref MissingValue,
                           ref MissingValue, ref MissingValue,
                           ref MissingValue, ref MissingValue,
                           ref MissingValue, ref MissingValue,
                           ref MissingValue, ref MissingValue,
                           ref MissingValue, ref MissingValue,
                           ref MissingValue, ref MissingValue,
                           ref MissingValue, ref MissingValue);            if (wd.Content.Text.IndexOf(strKey) >= 0)
            {
                MessageBox.Show("文档中包含指定的关键字!", "搜索结果", MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show("文档中没有指定的关键字!", "搜索结果", MessageBoxButtons.OK);
            }        }
    }
}
用C#访问word文档,可是老是在word这里报错:
Error 2 The type or namespace name 'Word' could not be found (are you missing a using directive or an assembly reference?) C:\xxg\Mytest\Mytest\Program.cs 25 13 Mytest
非常希望大家帮助我,我找了一个下午资料都没找到