[转]Asp.Net下导出/导入规则的Excel(.xls)文件
2007-04-03 10:22
573 查看
DataTable中的数据导出Excel文件
public static void Export(System.Web.UI.Page page,System.Data.DataTable tab,string FileName)
private static bool DownFile(System.Web.HttpResponse Response,string fileName,string fullPath)
将指定Excel文件中的数据转换成DataTable
public static System.Data.DataTable Import(string filePath)
private static DataTable GetDataTableFromString(string tmpHtml)
public static string RemoveString(string tmpHtml,string remove)
private static string RemoveStringHead(string tmpHtml,string remove)
private static string GetSheetName(string filePath)
private static int GetSheetIndex(byte[] FindTarget,byte[] FindItem)
{
int index=-1;
int FindItemLength=FindItem.Length;
if(FindItemLength<1) return -1;
int FindTargetLength=FindTarget.Length;
if((FindTargetLength-1)<FindItemLength) return -1;
for(int i=FindTargetLength-FindItemLength-1;i>-1;i--)
{
System.Collections.ArrayList tmpList=new System.Collections.ArrayList();
int find=0;
for(int j=0;j<FindItemLength;j++)
{
if(FindTarget[i+j]==FindItem[j]) find+=1;
}
if(find==FindItemLength)
{
index=i;
break;
}
}
return index;
}
public static void Export(System.Web.UI.Page page,System.Data.DataTable tab,string FileName)
private static bool DownFile(System.Web.HttpResponse Response,string fileName,string fullPath)
将指定Excel文件中的数据转换成DataTable
public static System.Data.DataTable Import(string filePath)
private static DataTable GetDataTableFromString(string tmpHtml)
public static string RemoveString(string tmpHtml,string remove)
private static string RemoveStringHead(string tmpHtml,string remove)
private static string GetSheetName(string filePath)
private static int GetSheetIndex(byte[] FindTarget,byte[] FindItem)
{
int index=-1;
int FindItemLength=FindItem.Length;
if(FindItemLength<1) return -1;
int FindTargetLength=FindTarget.Length;
if((FindTargetLength-1)<FindItemLength) return -1;
for(int i=FindTargetLength-FindItemLength-1;i>-1;i--)
{
System.Collections.ArrayList tmpList=new System.Collections.ArrayList();
int find=0;
for(int j=0;j<FindItemLength;j++)
{
if(FindTarget[i+j]==FindItem[j]) find+=1;
}
if(find==FindItemLength)
{
index=i;
break;
}
}
return index;
}
相关文章推荐
- Asp.Net下导出/导入规则的Excel(.xls)文件
- Asp.Net下导出/导入规则的Excel(.xls)文件
- Asp.Net下导出/导入规则的Excel(.xls)文件
- asp.net导出/导入规则的Excel(.xls)文件
- Asp.Net下导出/导入规则的Excel(.xls)文档
- ASP.NET中导入和导出标准Excel文件(转)
- (解决办法)ASP.NET导出Excel,打开时提示“您尝试打开文件'XXX.xls'的格式与文件扩展名指定文件不一致
- ASP.NET中导入和导出标准Excel文件(转)
- asp.net 导出excel(xls)文件 资料 --- 之一: xml文件格式导出
- [导入]Asp.net 2.0 GridView数据导出Excel文件(示例代码下载)
- asp.net 生成导出word表单 ,导出excel; dataTable生成xls文件,返回前台下载;asp.net启动excel错误 80070005;excel-xls columnName 不能改变; 读写excel的开源利器NPOI; 设置excel Cell的数据类型;
- [导入]ASP.NET 2.0中将 GridView 导出到 Excel 文件中
- ASP.NET导出Excel,打开Excel文件时提示“您尝试打开文件'XXX.xls'的格式与文件扩展名指定文件不一致”
- ASP.NET 导入导出原始规格的 Excel 文件
- ASP.NET中导入和导出标准Excel文件
- asp.net从数据库导出数据到word、excel、txt文本文件
- asp.net中通过html格式导出excel文件
- Asp.NET导出Excel文件乱码解决若干方法 (转)
- Asp.Net MVC 使用FileResult导出Excel数据文件
- Asp.Net MVC 使用FileResult导出Excel数据文件