回复 3楼czlt的帖子
问题二:
1.调用js代码实现“导出”功能时,试发布后不能导出?
2.aspx.cs中导出功能代码如下,但是不能导出数据?
回复二:
1.调用js代码实现“导出”功能时,试发布后不能导出?
先检查一下是不是把所有的ActiveReports相关DLL都正常发布了,你可以尝试将C:\Program Files (x86)\Common Files\ComponentOne\ActiveReports 8 目录中的DLL都拷贝到你站点的bin目录下
2.aspx.cs中导出功能代码如下,但是不能导出数据?
后台导出时你没有指定Contractid和Report1两个参数的值,我想这是主要原因。- protected void btnExcel_Click(object sender, EventArgs e)
- {
- // 加载报表
- LoadReport(TextBox1.Text);
- GrapeCity.ActiveReports.PageReport report1 = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(Server.MapPath("PageReport1.rdlx")));
- report1.Report.ReportParameters[0].DefaultValue.Values.Clear();
- report1.Report.ReportParameters[0].DefaultValue.Values.Add(TextBox1.Text);
- report1.Report.ReportParameters[1].DefaultValue.Values.Clear();
- report1.Report.ReportParameters[1].DefaultValue.Values.Add("table1");
- report1.Report.ReportParameters[1].DefaultValue.Values.Add("table2");
- report1.Report.ReportParameters[1].DefaultValue.Values.Add("table3");
- // 打印
- GrapeCity.ActiveReports.Document.PageDocument _reportRuntime = new GrapeCity.ActiveReports.Document.PageDocument(report1);
- GrapeCity.ActiveReports.Export.Excel.Page.ExcelTransformationDevice _renderingExtension = new GrapeCity.ActiveReports.Export.Excel.Page.ExcelTransformationDevice();
- GrapeCity.ActiveReports.Rendering.IO.MemoryStreamProvider _provider = new GrapeCity.ActiveReports.Rendering.IO.MemoryStreamProvider();
- _reportRuntime.Render(_renderingExtension, _provider);
- Response.ContentType = "application/vnd.ms-excel";
- Response.AddHeader("content-disposition", "inline;filename=MyExport.xls");
- System.IO.MemoryStream ms = new System.IO.MemoryStream();
- _provider.GetPrimaryStream().OpenStream().CopyTo(ms);
- Response.BinaryWrite(ms.ToArray());
- Response.End();
- // 打印
- }
复制代码 |