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

[转]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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: