我用程序新建了一个excel表,往里面添加了一些数据。此时我又想通过程序查看这个Excel表。这个该怎么实现?

解决方案 »

  1.   

    System.Diagnostics.Process.Start(fileName);
      

  2.   

    你理解错我的意思了,我是说我的程序在添加数据时已经在使用excel表,我再点击一个BUTTON去查看这个EXCEL表肯定是不行的。。所以这两个操作间我该怎么做才能执行第二个操作
      

  3.   

    不大明白LZ的意思..     把Excel  当数据库用?   - -|string strConn = "Provider=Microsoft.Jet.OleDb.4.0;" + "data source=" + strFileName + ";Extended Properties='Excel 8.0; HDR=YES; IMEX=1'";
                        string strExcel = string.Format("select * from [{0}$]", "Sheet1");
                        DataSet ds = new DataSet();                    string editType = "0";
                        bool IsError = false;
                        bool Check = true;
                        String tips = "";
                        ArrayList Alist = new ArrayList();
                        String sSRRQ = sqldata.ExecuteSQLReturn("select convert(varchar(10),getdate(),102)");
                        String sSRSJ = sqldata.ExecuteSQLReturn("select Convert(varchar(10),getdate(),108)");                    using (OleDbConnection conn = new OleDbConnection(strConn))
                        {
                            conn.Open();
                            OleDbDataAdapter adapter = new OleDbDataAdapter(strExcel, strConn);
                            adapter.Fill(ds, "Sheet1");
                            conn.Close();
                        }
      

  4.   

    查看修改前的还是修改之后的excel
      

  5.   

    那杀进程呢!添加完成后杀掉这个excel的进程!
    然后再做其他的操作!!
      

  6.   

            System.Windows.Forms.Application.DoEvents();
            object Nothing = System.Reflection.Missing.Value;
            object filename = FilePath + "\\" + docName;
            object docname = SavePath + "\\" + docName;
            //new一个word类对象
            Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
            //打开指定路径的word文档
            Microsoft.Office.Interop.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, ref Nothing);
    用类似打开word的方法打开excel不行吗