您的位置:首页 > 编程语言 > ASP

C# winform 导出导入Excel/Doc 完整实例教程 使用Aspose.Cells.dll——第三篇

2010-02-06 22:01 1196 查看
C# winform 导出导入Excel/Doc 完整实例教程 使用Aspose.Cells.dll——第三篇

[转】   http://hi.baidu.com/%BA%CE%B3%B1/blog/item/ae00a0efb22effe4cf1b3e61.html

 

 

迟的我会上传一份全面的 C# winform开发教程,若有需要留意下噢。

Excel导入

private void 导入ToolStripMenuItem_Click(object sender, EventArgs e)        {            string localFilePath = "";                        //点了保存按钮进入             if (openFileDialog1.ShowDialog() == DialogResult.OK)// openFileDialog1不要再问我这是什么!            {                //获得文件路径                 localFilePath = openFileDialog1.FileName.ToString();}            AsposeExcel tt = new AsposeExcel(localFilePath);            DataTable dt;            try             {                dt = tt.ExcelToDatatalbe();            }            catch (Exception ex)            {                                return;            }        //有了datatable你自己就可以DIY啦,下面是我自己的你不用理if (ddlResidence.SelectedValue == "违章确认")            {                if (dt.Rows[0][9].ToString() != "违章确认")                {                                    return;                }                row = dt.Rows.Count;                if (row <= 0) return;                for (int i = 0; i < dt.Rows.Count; i++)                {                    bllviola.Up_Confirmed_ByVnum(dt.Rows[i][6].ToString(), dt.Rows[i][9].ToString());                }                this.GridView1.DataSource = dt;                GridView1.DataBind();        } 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息