zoukankan      html  css  js  c++  java
  • Excel的导出操作

    下面的代码展示了如何将Excel内容显示到GridView中:
    aspx代码:

    .aspx

    .cs代码:
    protected void btnImport_Click(object sender, EventArgs e)
            
    {
                
    string Path = f_path.Value;
                
    string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Path + ";" + "Extended Properties=Excel 8.0;";
                OleDbConnection conn 
    = new OleDbConnection(strConn);
                conn.Open();
                
    string strExcel = "";
                OleDbDataAdapter myCommand 
    = null;
                DataSet ds 
    = null;
                strExcel 
    = "select * from [sheet1$]";
                myCommand 
    = new OleDbDataAdapter(strExcel, strConn);
                ds 
    = new DataSet();
                myCommand.Fill(ds, 
    "table1");

                gv_list.DataSource 
    = ds;
                gv_list.DataBind();

            }
  • 相关阅读:
    PHP xml_parser_create_ns() 函数
    PHP xml_parse_into_struct() 函数
    PHP xml_parse() 函数
    PHP xml_get_error_code() 函数
    PHP xml_get_current_line_number() 函数
    文本竖排组合 | text-combine-upright (Writing Modes)
    文本溢出 | text-overflow (Basic User Interface)
    文本渲染 | text-rendering (Scalable Vector Graphics)
    文本最终对齐 | text-align-last (Text)
    文本属性-风格 | text-emphasis-style (Text Decoration)
  • 原文地址:https://www.cnblogs.com/pw/p/583890.html
Copyright © 2011-2022 走看看