解决方案 »

  1.   

    word里又没有<table>标记。
    你带想想办法吧表格跟其他内容区分开
      

  2.   

    net如何获取word文档的表格和表格里的内容
      

  3.   

    那如果把整个文档的内容全部获得怎么写
        public string GetDocumentBookData(string FileName)
        {
            Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
        
            object fileobj = FileName;
            object nullobj = System.Reflection.Missing.Value;
            //打开指定文件(不同版本的COM参数个数有差异,一般而言除第一个外都用
            Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Open(ref fileobj, 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
              );
            string  str = "";
          
            System.Collections.IEnumerator enu = wordApp.ActiveDocument.Tables.GetEnumerator();
           // Microsoft.Office.Interop.Word.Tables tb = doc.Content.Tables;
            while (enu.MoveNext())
            {
                
                Microsoft.Office.Interop.Word.Book bk = (Microsoft.Office.Interop.Word.Book)enu.Current;
                string str1 = bk.Range.Text;
                str += "" + bk.Name.ToString() + ":" + bk.Range.Text + "";
            }
           
            return str;    }
    只能获得标签的内容啊
      

  4.   

    难道不是foreach(Table t in doc.Tables)么?
      

  5.   

     Microsoft.Office.Interop.Word.Tables tb = doc.Content.Tables;
    这个获得不了吗
      

  6.   

    反正我现在就是想要获得整个word文档的内容,然后赋给另一个word文档,现在就需要如何获得word文档的内容
    各位大虾帮帮忙阿