在一个报告查看器 (rdlc) 中呈现多个报告
Render multiple reports in one report viewer (rdlc)
使用 ReportViewer 我想使用 rdlc 文件在一个 pdf 中呈现多个报告。
Byte pdfByte = Byte();
pdfByte = ReportViewer.LocalReport.Render("PDF", Nothing, mimeType, encoding, extensions, stream, warning);
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename=myfile." + extension);
Response.BinaryWrite(pdfByte);
Response.Flush();
Response.End();
这只会生成一份 pdf 格式的报告。但我想在一个 pdf 文件中呈现多个报告。
请帮助我。
最简单的方法是将所有报表设计为一个主报表的子报表。然后,默认情况下所有报告都将呈现在一个 PDF 中。
如果您不能将报告结构化为子报告,则有好消息也有坏消息...
坏消息:在框架中没有直接的方法来实现这一点。
好消息:使用 PDFsharp 第 3 方库是可能的。它是开源的并且可以免费使用,即使在商业应用程序中也是如此。
参见上一个问题:Rendering multiple .rdlc reports into a single PDF using PDFSharp
祝你好运!
我已经处理了几天这个问题,但我终于找到了解决方案。单击表单中的两个按钮之一将加载相应的报告。我希望它对那些感兴趣的人有用:)
Solution Name : GelirGiderYonetimi
private void giderBtn_Click(object sender, EventArgs e)
{
giderPnl.Visible = true; gelirPnl.Visible = false;
this.GiderTableAdapter.Fill(this.giderDS.Gider);
ReportDataSource r = new ReportDataSource("DataSet1", giderDS.Tables[0]);
this.reportViewer1.LocalReport.DataSources.Clear();
this.reportViewer1.LocalReport.DataSources.Add(r);
this.reportViewer1.LocalReport.ReportEmbeddedResource = "GelirGiderYonetimi.giderRapor.rdlc";
this.reportViewer1.LocalReport.Refresh();
this.reportViewer1.RefreshReport();
}
private void gelirBtn_Click(object sender, EventArgs e)
{
giderPnl.Visible = false; gelirPnl.Visible = true;
this.GelirTableAdapter.Fill(this.gelirDS.Gelir);
ReportDataSource r = new ReportDataSource("DataSet1", gelirDS.Tables[0]);
this.reportViewer1.LocalReport.DataSources.Clear();
this.reportViewer1.LocalReport.DataSources.Add(r);
this.reportViewer1.LocalReport.ReportEmbeddedResource = "GelirGiderYonetimi.gelirRapor.rdlc";
this.reportViewer1.LocalReport.Refresh();
this.reportViewer1.RefreshReport();
}
使用 ReportViewer 我想使用 rdlc 文件在一个 pdf 中呈现多个报告。
Byte pdfByte = Byte();
pdfByte = ReportViewer.LocalReport.Render("PDF", Nothing, mimeType, encoding, extensions, stream, warning);
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename=myfile." + extension);
Response.BinaryWrite(pdfByte);
Response.Flush();
Response.End();
这只会生成一份 pdf 格式的报告。但我想在一个 pdf 文件中呈现多个报告。
请帮助我。
最简单的方法是将所有报表设计为一个主报表的子报表。然后,默认情况下所有报告都将呈现在一个 PDF 中。
如果您不能将报告结构化为子报告,则有好消息也有坏消息...
坏消息:在框架中没有直接的方法来实现这一点。
好消息:使用 PDFsharp 第 3 方库是可能的。它是开源的并且可以免费使用,即使在商业应用程序中也是如此。
参见上一个问题:Rendering multiple .rdlc reports into a single PDF using PDFSharp
祝你好运!
我已经处理了几天这个问题,但我终于找到了解决方案。单击表单中的两个按钮之一将加载相应的报告。我希望它对那些感兴趣的人有用:)
Solution Name : GelirGiderYonetimi
private void giderBtn_Click(object sender, EventArgs e)
{
giderPnl.Visible = true; gelirPnl.Visible = false;
this.GiderTableAdapter.Fill(this.giderDS.Gider);
ReportDataSource r = new ReportDataSource("DataSet1", giderDS.Tables[0]);
this.reportViewer1.LocalReport.DataSources.Clear();
this.reportViewer1.LocalReport.DataSources.Add(r);
this.reportViewer1.LocalReport.ReportEmbeddedResource = "GelirGiderYonetimi.giderRapor.rdlc";
this.reportViewer1.LocalReport.Refresh();
this.reportViewer1.RefreshReport();
}
private void gelirBtn_Click(object sender, EventArgs e)
{
giderPnl.Visible = false; gelirPnl.Visible = true;
this.GelirTableAdapter.Fill(this.gelirDS.Gelir);
ReportDataSource r = new ReportDataSource("DataSet1", gelirDS.Tables[0]);
this.reportViewer1.LocalReport.DataSources.Clear();
this.reportViewer1.LocalReport.DataSources.Add(r);
this.reportViewer1.LocalReport.ReportEmbeddedResource = "GelirGiderYonetimi.gelirRapor.rdlc";
this.reportViewer1.LocalReport.Refresh();
this.reportViewer1.RefreshReport();
}