public class OutExcel
{
public static void OutExcel_bb(DataTable dt, string thepath, string temppath, int TitleNum, string Title1)
{
//通过调用Excel的查询来实现数据的导出,按固定格式
//ds:执行的记录集;thepath:模板文件的路径;sql:执行的SQL语句;FileName:保存的文件名
//TitleNum:表头列的行数
Excel.Application excel;
Excel._Workbook xBk;
Excel._Worksheet xSt; //string Conn = "OLEDB;Provider=SQLOLEDB.1;Data Source=(local);Initial Catalog=xdtz;User ID=sa;Password=sa;Max Pool Size = 512";
string path = thepath;
excel = new Excel.Application();
excel.Visible = false;
excel.UserControl = true;
xBk = excel.Workbooks.Add(path);
xSt = (Excel._Worksheet)xBk.Worksheets.get_Item(); xSt.Cells[, ] = Title1;
int StartRow = TitleNum;
for (int i = ; i < dt.Rows.Count; i++)
{
for (int j = ; j < dt.Columns.Count; j++)
{
xSt.Cells[StartRow + i, j + ] = dt.Rows[i][j].ToString();
}
} xBk.SaveAs(temppath, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
excel.Visible = false; System.Runtime.InteropServices.Marshal.ReleaseComObject(xSt);
xSt = null;
xBk.Close(false, null, null);
System.Runtime.InteropServices.Marshal.ReleaseComObject(xBk);
xBk = null; excel.Workbooks.Close();
excel.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
excel = null;
System.GC.Collect();
} public static void OutExcel_bb(List<List<string>> lsts, string thepath, string temppath, string TitleName)
{
//通过调用Excel的查询来实现数据的导出,按固定格式
//ds:执行的记录集;thepath:模板文件的路径;sql:执行的SQL语句;FileName:保存的文件名
//TitleNum:表头列的行数
Excel.Application excel;
Excel._Workbook xBk;
Excel._Worksheet xSt; string path = thepath;
excel = new Excel.Application();
excel.Visible = true;
excel.UserControl = true;
xBk = excel.Workbooks.Add(path);
xSt = (Excel._Worksheet)xBk.Worksheets.get_Item(); xSt.Cells[, ] = TitleName;
int StartRow = ; for (int i = ; i < lsts.Count; i++)
{
List<string> lst = lsts[i];
int colspan = ;
for (int j = ; j < lst.Count; j++)
{
int ri = StartRow + i, ci = (j + ) + colspan;
if (lst[j].Contains("colspan"))
{
int cp = Convert.ToInt16(lst[j].Split(':')[]);
xSt.get_Range(xSt.Cells[ri, ci - ], xSt.Cells[ri, (ci - ) + (cp - )]).Merge(true);
colspan += cp - ;
}
else
{
xSt.Cells[ri, ci] = lst[j];
}
}
}
// xSt.get_Range(xSt.Cells[3, 1], xSt.Cells[3, 2]).Merge(true);
// xSt.get_Range(xSt.Cells[4, 1], xSt.Cells[4, 2]).Merge(true); xBk.SaveAs(temppath, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
excel.Visible = true; System.Runtime.InteropServices.Marshal.ReleaseComObject(xSt);
xSt = null;
xBk.Close(false, null, null);
System.Runtime.InteropServices.Marshal.ReleaseComObject(xBk);
xBk = null; excel.Workbooks.Close();
excel.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
excel = null;
System.GC.Collect(); }
public static void OutExecl_cc(string Str,string Title)
{
StringWriter sw = new StringWriter();
sw.WriteLine(Title);
sw.WriteLine(Str);
sw.Close(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(Title, System.Text.Encoding.UTF8) + ".xls");//中文
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
HttpContext.Current.Response.Write(sw);
HttpContext.Current.Response.End();
}
}

例:

 protected void btnsearch_Click(object sender, EventArgs e)
{
AspNetPager1.CurrentPageIndex = ;
DataLoad();
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TiaoJian == "")
TiaoJian = " 1=1 ";// and state = 1 if (this.hiddept.Value != "")
TiaoJian += " and deptid in(select id from dbo.Department where parentdept=" + this.hiddept.Value + ")";
if (this.txtname.Value != "")
TiaoJian += " and username like '%" + this.txtname.Value + "%'";
if (this.drop1.SelectedValue != "")
TiaoJian += " and state = " + this.drop1.SelectedValue + ""; DataSet ds = new BLL.Users().GetHMC(TiaoJian);
string tick = DateTime.Now.ToString("yyyyMMddHHmmssff");
string thepath = "Upload/temp/hmcgs.xls";
string temppath = MapPath("Upload/temp/") + tick + ".xls";
OutExcel(ds, thepath, temppath,,"花名册");
System.GC.Collect();
GetExcelFile(temppath,"花名册");
}
public void OutExcel(DataSet ds, string thepath, string temppath, int TitleNum, string Title1)
{
//通过调用Excel的查询来实现数据的导出,按固定格式
//ds:执行的记录集;thepath:模板文件的路径;sql:执行的SQL语句;FileName:保存的文件名
//TitleNum:表头列的行数
Excel.Application excel;
Excel._Workbook xBk;
Excel._Worksheet xSt; //string Conn = "OLEDB;Provider=SQLOLEDB.1;Data Source=(local);Initial Catalog=xdtz;User ID=sa;Password=sa;Max Pool Size = 512";
string path = MapPath(thepath);
excel = new Excel.Application();
excel.Visible = false;
excel.UserControl = true;
xBk = excel.Workbooks.Add(path);
xSt = (Excel._Worksheet)xBk.Worksheets.get_Item(); //xSt.Cells[2, 1] = Title1;
int StartRow = TitleNum + ;
for (int i = ; i < ds.Tables[].Rows.Count; i++)
{
xSt.Cells[StartRow + i, ] = (i + );
for (int j = ; j < ds.Tables[].Columns.Count; j++)
{
xSt.Cells[StartRow + i, j + ] = ds.Tables[].Rows[i][j].ToString();
}
} xBk.SaveAs(temppath, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
excel.Visible = false;
System.Runtime.InteropServices.Marshal.ReleaseComObject(xSt);
xSt = null;
xBk.Close(false, null, null);
System.Runtime.InteropServices.Marshal.ReleaseComObject(xBk);
xBk = null; excel.Workbooks.Close();
excel.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
excel = null;
System.GC.Collect();
} private void GetExcelFile(string temppath, string FileName)
{
System.IO.FileInfo file = new System.IO.FileInfo(temppath);
if (file.Exists)
{
Response.Clear();
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF8;
// 添加头信息,为"文件下载/另存为"对话框指定默认文件名 Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(FileName + "(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ").xls"));
// 添加头信息,指定文件大小,让浏览器能够显示下载进度
Response.AddHeader("Content-Length", file.Length.ToString());
// 指定返回的是一个不能被客户端读取的流,必须被下载
Response.ContentType = "application/ms-excel";
// 把文件流发送到客户端
Response.WriteFile(file.FullName);
// 停止页面的执行
Response.End();
} }

———————————————————————————————————————————————————————————————————————————

公共类:

public class ToExcell
{
/// <summary>
/// 执行存储过程
/// </summary>
/// <param name="PropName">存储过程名</param>
/// <param name="_params">参数</param>
/// <returns></returns>
public DataSet GetDataSet(string PropName, SqlParameter[] _params,int Id)
{
return DBUtility.NewDbHelperSQL.RunProcedure(PropName, _params, "tb1", Id);
} #region 下载报表
/// <summary>
///
/// </summary>
/// <param name="ds">查询出的数据</param>
/// <param name="ExcelFileName">excel名称</param>
public void MyXlsToExcelByDataSet(DataSet ds, string ExcelFileName)
{
DataTable dt = ds.Tables[];
XlsDocument xlsDocument = new org.in2bits.MyXls.XlsDocument();
xlsDocument.FileName = HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(ExcelFileName)) + "_" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now) + ".xls";
Worksheet worksheet = xlsDocument.Workbook.Worksheets.Add("sheet1");//Excel工作表名称
Cells cells = worksheet.Cells;
int columns = dt.Columns.Count;
for (int i = ; i < columns; i++)//列名
{
cells.Add(, (i + ), dt.Columns[i].ColumnName.ToString().Trim());
}
for (int j = ; j < dt.Rows.Count; j++)
{
for (int k = ; k < columns; k++)
{
cells.Add(j + , (k + ), dt.Rows[j][k].ToString().Trim());
}
}
xlsDocument.Send();
}
#endregion #region 下载报表
/// <summary>
///
/// </summary>
/// <param name="ds">查询出的数据</param>
/// <param name="ExcelFileName">excel名称</param>
/// <param name="rowName">对应的列名</param>
public void MyXlsToExcelByDataSet(DataSet ds, string ExcelFileName, string[] rowName)
{
DataTable dt = ds.Tables[];
XlsDocument xlsDocument = new org.in2bits.MyXls.XlsDocument();
xlsDocument.FileName = HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(ExcelFileName)) + "_" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now) + ".xls";
Worksheet worksheet = xlsDocument.Workbook.Worksheets.Add("sheet1");//Excel工作表名称
Cells cells = worksheet.Cells;
int columns = dt.Columns.Count;
for (int i = ; i < columns; i++)//列名
{
cells.Add(, (i + ), rowName[i].Trim());
}
for (int j = ; j < dt.Rows.Count; j++)
{
for (int k = ; k < columns; k++)
{
cells.Add(j + , (k + ), dt.Rows[j][k].ToString().Trim());
}
}
xlsDocument.Send();
}
#endregion #region 附件下载
/// <summary>
/// 附件下载方法
/// </summary>
/// <param name="fileName">文件名</param>
/// <param name="path">文件路径</param>
public void DownLoadFile(string fileName, string path)
{
HttpContext.Current.Response.BufferOutput = false; HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + DisposeFileName(fileName)); //HttpContext.Current.Server.UrlEncode(fileName));//防止中文名出现乱码
HttpContext.Current.Response.ContentType = "application/octstream";
HttpContext.Current.Response.CacheControl = "Private";
Stream stream = new FileStream(HttpContext.Current.Server.MapPath(path), FileMode.Open, FileAccess.Read, FileShare.Read);
HttpContext.Current.Response.AppendHeader("Content-length", stream.Length.ToString()); BinaryReader br = new BinaryReader(stream); byte[] bytes; for (int n = ; n < (br.BaseStream.Length / + ); n++)
{
bytes = br.ReadBytes();
HttpContext.Current.Response.BinaryWrite(bytes);
System.Threading.Thread.Sleep(); //休息一下,防止耗用带宽太多。
} stream.Close();
}
#endregion
#region 文件下载时文件名处理
/// <summary>
/// 文件下载时文件名处理
/// </summary>
/// <param name="FileName"></param>
/// <returns></returns>
protected string DisposeFileName(string FileName)
{
FileName = FileName.Replace(" ", "");//去掉空格
return FileName;
} #endregion
}

.NET读取Excel文件内容--导入,简单示例:

<%-- 前台--%>
<div> <%-- 文件上传控件 用于将要读取的文件上传 并通过此控件获取文件的信息--%> <asp:FileUpload ID="fileSelect" runat="server" /> <%-- 点击此按钮执行读取方法--%> <asp:Button ID="btnRead" runat="server" Text="ReadStart" /> </div>
后台获取
//声明变量(属性)
string currFilePath = string.Empty; //待读取文件的全路径 string currFileExtension = string.Empty; //文件的扩展名
//Page_Load事件 注册按钮单击事件
protected void Page_Load(object sender, EventArgs e) { this.btnRead.Click += new EventHandler(btnRead_Click); } //按钮单击事件 //里面的3个方法将在下面给出
protected void btnRead_Click(object sender, EventArgs e)
{
Upload(); //上传文件方法
if (this.currFileExtension == ".xlsx" || this.currFileExtension == ".xls")
{
DataTable dt = ReadExcelToTable(currFilePath); //读取Excel文件(.xls和.xlsx格式)
}
else if (this.currFileExtension == ".csv")
{
DataTable dt = ReadExcelWidthStream(currFilePath); //读取.csv格式文件
}
}

下面列出按钮单击事件中的3个方法

///<summary>
///上传文件到临时目录中
///</ummary>
private void Upload()
{
HttpPostedFile file = this.fileSelect.PostedFile;
string fileName = file.FileName;
string tempPath = System.IO.Path.GetTempPath(); //获取系统临时文件路径
fileName = System.IO.Path.GetFileName(fileName); //获取文件名(不带路径)
this.currFileExtension = System.IO.Path.GetExtension(fileName); //获取文件的扩展名
this.currFilePath = tempPath + fileName; //获取上传后的文件路径 记录到前面声明的全局变量
file.SaveAs(this.currFilePath); //上传
} ///<summary>
///读取xls\xlsx格式的Excel文件的方法
///</ummary>
///<param name="path">待读取Excel的全路径</param>
///<returns></returns>
private DataTable ReadExcelToTable(string path)
{
//连接字符串
string connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1';"; // Office 07及以上版本 不能出现多余的空格 而且分号注意
//string connstring = Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + path + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1';"; //Office 07以下版本 因为本人用Office2010 所以没有用到这个连接字符串 可根据自己的情况选择 或者程序判断要用哪一个连接字符串
using(OleDbConnection conn = new OleDbConnection(connstring))
{
conn.Open();
DataTable sheetsName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[]{null,null,null,"Table"}); //得到所有sheet的名字
string firstSheetName = sheetsName.Rows[][].ToString(); //得到第一个sheet的名字
string sql = string.Format("SELECT * FROM [{0}],firstSheetName); //查询字符串
OleDbDataAdapter ada =new OleDbDataAdapter(sql,connstring);
DataSet set = new DataSet();
ada.Fill(set);
return set.Tables[]; }
} ///<summary>
///读取csv格式的Excel文件的方法
///</ummary>
///<param name="path">待读取Excel的全路径</param>
///<returns></returns>
private DataTable ReadExcelWithStream(string path)
{
DataTable dt = new DataTable();
bool isDtHasColumn = false; //标记DataTable 是否已经生成了列
StreamReader reader = new StreamReader(path,System.Text.Encoding.Default); //数据流
while(!reader.EndOfStream)
{
string meaage = reader.ReadLine();
string[] splitResult = message.Split(new char[]{','},StringSplitOption.None); //读取一行 以逗号分隔 存入数组
DataRow row = dt.NewRow();
for(int i = ;i<splitResult.Length;i++)
{
if(!isDtHasColumn) //如果还没有生成列
{
dt.Columns.Add("column" + i,typeof(string));
}
row[i] = splitResult[i];
}
dt.Rows.Add(row); //添加行
isDtHasColumn = true; //读取第一行后 就标记已经存在列 再读取以后的行时,就不再生成列
}
return dt;
}

示例完整代码,上传EXCEL并导入

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;
using System.Data.OleDb; public partial class Tools_test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
//资料导入点击事件
protected void Button1_Click(object sender, EventArgs e)
{
string clientid = Session["fileName"].ToString();
string CustTypeMax ="";
string CustTypeMin = "";
string CustTypeSub = "";
string sbResult = ExeclData(clientid, CustTypeMax, CustTypeMin, CustTypeSub);
alert("导入成功!");
}
private void alert(string str)
{ Page.ClientScript.RegisterStartupScript(this.GetType(), " ", "<script>alert('" + HttpUtility.UrlDecode(str) + "')</script>");
} //上传文件
protected void Button2_Click(object sender, EventArgs e)
{
string strFileName = InputAffixFile.Value.Trim();//文件名
string strFileSize = (Convert.ToInt32(InputAffixFile.PostedFile.ContentLength.ToString()) / ).ToString();//文件大小
string strFileType = strFileName.Substring(strFileName.LastIndexOf(".") + ).ToLower();//文件类型
string fileName = "";
string FilePath = "";
if (strFileName != "")
{
if (strFileType == "jpg" || strFileType == "psd" || strFileType == "swf" || strFileType == "gif " || strFileType == "bmp " || strFileType == "png " || strFileType == "xls" || strFileType == "doc" || strFileType == "pdf" || strFileType == "rar" || strFileType == "zip" || strFileType == "txt" || strFileType == "chm" || strFileType == "rtf" || strFileType == "docx" || strFileType == "wps" || strFileType == "xlsx" || strFileType == "et" || strFileType == "ppt" || strFileType == "pptx" || strFileType == "dps")
{
fileName = DateTime.Now.ToString("yyyMMddHHmmss") + "." + strFileType; ;//文件重命名
Session["fileName"] = fileName;
FilePath = System.Web.HttpContext.Current.Server.MapPath("~") + "//Upload//file";
InputAffixFile.PostedFile.SaveAs(FilePath + "/" + fileName);
Response.Write("<Script Language=JavaScript>alert(\"上传文件成功!\")</Script>");
}
else
{
Response.Write("<Script Language=JavaScript>alert(\"上传文件失败!\")</Script>");
}
}
else
{
Response.Write("<Script Language=JavaScript>alert(\"请选择上传文件!\")</Script>");
}
}
//资料导入方法
public static string ExeclData(string clientid, string CustTypeMax, string CustTypeMin, string CustTypeSub)
{
{
//获取上传的菜单名称和路径
string tempMenPath = System.Web.HttpContext.Current.Server.MapPath("~") + "Upload\\file\\" + clientid;//
StringBuilder sbResult = new StringBuilder("");
string strconn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + tempMenPath + ";Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\"";
//string strconn = "Provider=Microsoft.Jet.OleDb.4.0; Data Source=" + tempMenPath + "; Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strconn);
conn.Open();
string sql;
sql = "SELECT * FROM [Sheet1$]";
DataSet objDS = new DataSet();
OleDbDataAdapter objadp = new OleDbDataAdapter(sql, conn);
objadp.Fill(objDS);
DataTable MenDt = objDS.Tables[];
conn.Close();
int result = ;
foreach (DataRow dr in MenDt.Select())
{
try
{
Cms.BLL.C_article bllarticle = new Cms.BLL.C_article();
Cms.Model.C_article modelarticle = new Cms.Model.C_article();
modelarticle.parentId = Convert.ToInt32(dr[].ToString());//栏目id
modelarticle.title = dr[].ToString();//标题
modelarticle.englishtitle = "";//英文标题
modelarticle.orderNumber = Convert.ToInt32(dr[].ToString());//排序 modelarticle.artFrom = "";
modelarticle.photoUrl = dr[].ToString();//缩略图
modelarticle.intro = dr[].ToString();//简介
modelarticle.content = dr[].ToString();//内容 modelarticle.seoTitle = dr[].ToString();//seo标题
modelarticle.seoKeyword = dr[].ToString();//seo关键词
modelarticle.seoDescription = dr[].ToString();//seo描述
modelarticle.isRecommend = Convert.ToInt32(dr[].ToString());//推荐
modelarticle.isChannel = "";//栏目推荐 modelarticle.isHidden = Convert.ToInt32(dr[].ToString());//是否隐藏
modelarticle.isCheck = Convert.ToInt32(dr[].ToString());//是否审核发布
modelarticle.isHot = Convert.ToInt32(dr[].ToString());//是否热门文章 modelarticle.isTop = Convert.ToInt32(dr[].ToString());//是否置顶
modelarticle.hits = Convert.ToInt32(dr[].ToString());//点击量
modelarticle.expClass = "";//
modelarticle.editTime = DateTime.Now;//最后编辑时间
modelarticle.updateTime = DateTime.Now;//添加时间 modelarticle.txtLinkUrl = "";//URL链接
modelarticle.txtsource = dr[].ToString();//信息来源
modelarticle.txtauthor = dr[].ToString();//文章作者 if (dr[].ToString() == "")
{ result = bllarticle.Add(modelarticle);
sbResult.Append("[" + dr[].ToString() + "]增加成功 <br />");
}
else
{
result = bllarticle.Add(modelarticle);
if (result > )
{
sbResult.Append("增加成功 <br />");
}
else
{
sbResult.Append("增加失败 <br />");
}
}
}
catch
{
continue;
}
} return sbResult.ToString();
//更新到数据库中
}
}
}

Excel导入导出,生成和下载Excel报表、附件等操作--ASP.NET的更多相关文章

  1. 基于EPPlus和NPOI实现的Excel导入导出

    基于EPPlus和NPOI实现的Excel导入导出 CollapseNav.Net.Tool.Excel(NuGet地址) 太长不看 导入 excel 文件流将会转为 ExcelTestDto 类型的 ...

  2. Java Excel 导入导出(一)

    本文主要描述通过java实现Excel导入导出 一.读写Excel三种常用方式 1.JXL——Java Excel开放源码项目:读取,创建,更新 2.POI——Apache POI ,提供API给Ja ...

  3. JAVA实现Excel导入/导出【转】

    JAVA实现Excel导入/导出[转] POI的下载与安装 请到网站http://www.apache.org/dyn/closer.cgi/poi/右击超链接2.5.1.zip下载压缩包poi-bi ...

  4. Excel导入导出(篇二)

    <body> <h3>一.Excel导入</h3> <h5>.模板下载:<a href="UpFiles/TemplateFiles/学 ...

  5. ASP.NET 之 常用类、方法的超级总结,并包含动态的EXCEL导入导出功能,奉上类库源码

    实用类:UtilityClass 包含如下方法 判断对象是否为空或NULL,如果是空或NULL返回true,否则返回false 验证手机号是否正确 13,15,18 验证邮箱 验证网址 MD5加密,返 ...

  6. 一个基于POI的通用excel导入导出工具类的简单实现及使用方法

    前言: 最近PM来了一个需求,简单来说就是在录入数据时一条一条插入到系统显得非常麻烦,让我实现一个直接通过excel导入的方法一次性录入所有数据.网上关于excel导入导出的例子很多,但大多相互借鉴. ...

  7. JeeSite中Excel导入导出

    在各种管理系统中,数据的导入导出是经常用到的功能,通常导入导出以Excel.CSV格式居多.如果是学习的过程中,最好是自己实现数据导入与导出的功能,然而在项目中,还是调用现成的功能比较好.近期一直使用 ...

  8. java jxl excel 导入导出的 总结(建立超链接,以及目录sheet的索引)

    最近项目要一个批量导出功能,而且要生成一个单独的sheet页,最后后面所有sheet的索引,并且可以点击进入连接.网上搜索了一下,找到一个方法,同时把相关的excel导入导出操作记录一下!以便以后使用 ...

  9. JAVA Excel导入导出

    --------------------------------------------方式一(新)-------------------------------------------------- ...

  10. [.Net] Excel导入导出各种方式分析

    1.引言 1.1解决哪些问题   现在很多公司用的导出基本上采用的通过gridView导出excel,此种导出存在以下几种问题 1.数据量大的时候有时导出有时会让浏览器卡死,因为导出的excel不是真 ...

随机推荐

  1. Android开发之高效加载Bitmap

    一.概述 在Android开发中,我们经常与Bitmap打交道,而对Bitmap的不恰当的操作经常会导致OOM(Out of Memory).这篇文章我们会介绍如何高效地在Android开发中使用Bi ...

  2. 封印术:shadow dom

    置顶文章:<纯CSS打造银色MacBook Air(完整版)> 上一篇:<鼠标滚动插件smoovejs和wowjs> 作者主页:myvin 博主QQ:851399101(点击Q ...

  3. 总结一下工作中遇到的NPOI以及在ASP.NET MVC中的使用

    1.前言 相信大家在工作中经常要遇到一些导入导出Execl操作.学习贵在分享,分享使人快乐,园子里的前辈已经有很多好的文章,鄙人也是能力有限,在这里把这些好的文章总结,方便以后再工作中使用. NPOI ...

  4. 翻译-微服务API Gateway

    原文地址:http://microservices.io/patterns/apigateway.html,以下是使用google翻译对原文的翻译. 让我们想象一下你正在建立一个使用微服务模式的网上商 ...

  5. cookie的操作

    比如这样如果一个网站上有两个域名的时候,我们需要考虑,两个域名下的cookie. 我们所说的跨域只的就是lesport.com和le.com js的cookie是不能跨域的,为了防止过大. js增加删 ...

  6. C#基础知识系列六(静态类和静态类成员)

    静态类 静态类与非静态类基本相同,但存在一个区别:静态类不能实例化. 也就是说,不能使用 new 关键字创建静态类类型的变量. 因为没有实例变量,所以要使用类名本身访问静态类的成员. 例如,如果名为 ...

  7. 第一课:js命名空间的介绍,js对象的扩展以及js数组化

    1.命名空间: js里面的命名空间就是使用对象的属性来扩展的.比如,用户定义一个A对象,A对象下面有B属性和C属性,同时B属性和C属性又是对象.因此A={B:{},C:{}},这时用户就可以在B对象和 ...

  8. angular实例教程(用来熟悉指令和过滤器的编写)

    angular的插件太少了,  所以很多指令和过滤器都要自己写,  所以对指令传进来的参数, 以及angular编译的流程更加熟悉才行写出好的插件, 有些简单的指令是参考angularUI里面, 作为 ...

  9. iOS--隐藏和显示TabBar的方法

    1.隐藏TabBar: - (void)hideTabBar { if (self.tabBarController.tabBar.hidden == YES) { return; } UIView  ...

  10. Ibatis对日期的处理

    最近在项目中出现两种情况(因为项目比较早,经历各个版本的改动,所有设计不一致),第一种:数据库中某一字段为Date类型,对应的bean中的类型为java.util.Date,所有在对应的映射中会出现字 ...