在C#的例子中就有,你如果安装了VS.net的话,你可以在帮助里找到这个例子。

解决方案 »

  1.   

    添加Diagnostic的引用
    Process.Start("c:\\*.doc");
    就可以用word打开要编辑的文件
      

  2.   

    to perilla(紫苏):
    能不能说得详细些呢?谢谢
      

  3.   

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoffdev/html/vsofficedev.asp
      

  4.   

    to:hbxtx(xy) @_@`都是E文:<
    有没有中文的?..:(
      

  5.   

    利用Automation,可以完成对Word文档的各种复杂操作,包括文档的生成、修改、统计字数等等等等。在MSDN里面可以参考“Working with Microsoft Word Objects”一文。对于你提出的问题,我写了下面一段例子代码仅供参考:private void menuItem2_Click(object sender, System.EventArgs e)
    {
    Object Nothing=System.Reflection.Missing.Value;
    object filename=@"c:\test.doc"; Word.Application wordApp=new Word.ApplicationClass();
    Word.Document wordDoc=wordApp.Documents.Open(ref filename,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing);

    this.textBox1.Text+="\r\n"+wordDoc.Paragraphs.Last.Range.Text.ToString();
    this.textBox1.Text+="\r\n"+wordDoc.Tables.Item(1).Cell(1,1).Range.Text.ToString(); wordDoc.Close(ref Nothing, ref Nothing, ref Nothing);
    wordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
    }private void menuItem3_Click(object sender, System.EventArgs e)
    {
    Object Nothing=System.Reflection.Missing.Value;
    object filename=@"c:\test.doc"; Word.Application wordApp=new Word.ApplicationClass();
    Word.Document wordDoc=wordApp.Documents.Add(ref Nothing,ref Nothing,ref Nothing,ref Nothing);

    Word.Table table=wordDoc.Tables.Add(wordApp.Selection.Range,2,3,ref Nothing,ref Nothing);
    table.Cell(1,1).Range.Text="1892730987098";
    wordDoc.Paragraphs.Last.Range.Text="Hello"; wordDoc.SaveAs(ref filename,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing);
    wordDoc.Close(ref Nothing, ref Nothing, ref Nothing);
    wordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
    }在这段例子里面,menuItem3_Click()函数新建了一个Word文档,并在里面插入了一个表格和一段文字。表格的大小是两行三列,最左上的cell里面的内容是"1892730987098",后面一段文字的内容是"Hello"。其大致如下:+---------------+--------------+--------------+
    | 1892730987098 |              |              |
    +---------------+--------------+--------------+
    |               |              |              |
    +---------------+--------------+--------------+
    Hello上面的例子代码中,menuItem2_Click()完成的工作就是打开上面创建的Word文档,并读取表格的第一个cell的内容以及下面一段文字的内容,然后将其显示在this.textBox1中。您可以试试看上面这段例子代码,运行前需要在项目的Reference里面添加Microsoft Word 10.0 Object Library。
      

  6.   

    string xx,yy;
    Word.ApplicationClass oWord = new Word.ApplicationClass();
    Word.Document oDoc;
    Word.Range oRange;
    Word.Table otable;
    Word.Selection  oselection;
    object a = Missing.Value;
    object b = Missing.Value;
    object filename=@"c:\test.doc";
    oDoc = oWord.Documents.Open(ref filename,ref a,ref a,ref a,ref 
    //or oDoc = oWord.Documents.Add(ref a,ref a,ref a,ref a);
    a,ref a,ref a,ref a,ref a,ref a,ref a,ref a);  
    oWord.Visible = true;
    oDoc = oWord.ActiveDocument
    oRange = oDoc.Range(ref a,ref b);
    oRange.Rows.Count = 9;
    oRange.Select;
    xx =oRange.Text;  
    otable = oDoc.Tables.Item(1); 
    otable.Select;
    yy = otable.Cell(0,1).Range.Text;
      

  7.   

    to:pursuer(pursuer) 
    太感谢了!!我下去试试,等一下给你回话:)
      

  8.   

    to:pursuer(pursuer)问一下,Microsoft Word 10.0 Object Library这个东西是什么?如何添加再说得详细点好吗?谢谢了!