解决方案 »

  1.   

    用免费版本的Spire.Doc吧,不用安装庞大的Office,直接对文件操作。你可以Spire.Doc装载一个Word模板,然后填充数据,就可以生成你想要的word文档。http://www.e-iceblue.com/Introduce/word-for-net-introduce.html
      

  2.   

    把word的格式用html显示,然后用流导出
     
    string  path=@"C:\Documents and Settings\Administrator\桌面\2.doc";
        FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write);  
                StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.GetEncoding("gb2312"));  
                string html = @"C:\Documents and Settings\Administrator\桌面\1.html";  
                sw.WriteLine(File.ReadAllText(html));  
                sw.Close();  到excel 也可以这样
      

  3.   

    先用word做好一个文档,排版好,预留下数据填充的位置,作为模板。导出的时候复制一份模板,在此基础上填入数据,保存。
      

  4.   


    能有更详细的案例吗? 因为您这种方式我没有做过.光一句"把word的格式用html显示,然后用流导出" 我很茫然.
      

  5.   


    能有更详细的案例吗? 因为您这种方式我没有做过.光一句"把word的格式用html显示,然后用流导出" 我很茫然.
    word要显示什么样,就用html显示什么样
      

  6.   

    用aspose.word 在word要插入数据的地方建好书签 然后程序控制向书签里放相应的数据
      

  7.   

    把Word文档中的表格数据导入到SQL Server数据库中
      private Word.Application G_wa;//定义Word应用程序字段
            private object G_missing = //定义G_missing字段并添加引用
                System.Reflection.Missing.Value;
            private Thread G_th;//定义线程字段
            private List<InstanceClass> G_List_InstanceClass = //定义数据集合字段并赋值
                new List<InstanceClass>();        private void btn_display_Click(object sender, EventArgs e)
            {
                btn_display.Enabled = false;
                ThreadPool.QueueUserWorkItem(//开始线程池
                    (pp) =>//使用lambda表达式
                    {
                        G_wa = new Microsoft.Office.Interop.Word.Application();//创建应用程序对象
                        G_wa.Visible = true;//CodeGo.net/
                        object P_Path = Directory.GetCurrentDirectory() + @"\Word.doc";
                        Word.Document P_Document = G_wa.Documents.Open(//打开Word文档
                            ref P_Path, ref G_missing, ref G_missing, ref G_missing
                            , ref G_missing, ref G_missing, ref G_missing, ref G_missing
                            , ref G_missing, ref G_missing, ref G_missing, ref G_missing
                            , ref G_missing, ref G_missing, ref G_missing, ref G_missing);
                        TrackData();//将Word数据更新到SQL
                    });
            }