ActiveReport报表导出为Excel格式问题

gdsdyl gdsdyl 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在运行时第一次是可以在浏览器中显示Excel表格,以后就显示空的Excel表格,好象打开的是一个空的网页文件.
网页代码是:
private void Page_Load(object sender, System.EventArgs e)
{
ActiveReport rpt = new rptClientInfo();
try
{
rpt.Run(false);
}
catch (Exception eRunReport)
{
// Failure running report, just report the error to the user:
Response.Clear();
Response.Write("<h1>Error running report:</h1>");
Response.Write(eRunReport.ToString());
return;
}

Response.ContentType = "application/xls";

Response.AddHeader("content-disposition","inline; filename=MyXLS.XLS");

XlsExport xls = new XlsExport();
System.IO.MemoryStream memStream = new System.IO.MemoryStream();
xls.Export(rpt.Document, memStream);
Response.BinaryWrite(memStream.ToArray());
Response.End();
rpt.Dispose();
}

请用过相似控件的朋友给点提示!
...全文
评论 1
收藏 已收藏
分享
返回顶部
gdsdyl
.NET社区 62,272 成员 668,968 内容