public void ToTxtAll(string userid)
{
try
{
DataSet ds = AppClient.App.HRUserManager.toText(userid);
string excelString = "编号\t姓名\t起始时间\t\t终止时间\t\t工作单位\t职务\t职级\n";
foreach (DataRow dr in ds.Tables[0].Rows)
{
excelString += dr["id"].ToString() + "\t" + dr["username"].ToString() + "\t" + dr["startdate"].ToString() + "\t";
excelString += dr["enddate"].ToString() + "\t" + dr["company"].ToString() + "\t" + dr["duty"].ToString() + "\t";
excelString += dr["post"].ToString() + "\n";
}
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = false;
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode("工作简历信息.txt"));
HttpContext.Current.Response.ContentType = "text/plain";
this.EnableViewState = false;
HttpContext.Current.Response.Write(excelString.ToString());
HttpContext.Current.Response.End();
}
catch (Exception ex)
{
ClientScript.RegisterClientScriptBlock(Page.GetType(), "提示", "<script>alert('导出数据出现错误!')</script>");
}
}