wfwt3000 2010-10-14 12:20
浏览 383
已采纳

数据导入到txt中怎么没有换行,程序中的“/n”不管用,怎么回去?求解?

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>");
        }
    }
  • 写回答

2条回答 默认 最新

  • ayling520 2010-10-15 13:54
    关注

    解决了,居然不给分。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器