У меня есть веб-форма с выпадающим списком, текстовым полем и тремя кнопками. 1) создать отчет 2) распечатать 3) экспортировать в PDF
У меня есть printonebartest.rdlc в качестве отчета по умолчанию, привязанного к reportviewer1, который предназначен для того, чтобы пользователь мог правильно просматривать информацию, однако, когда я печатаю тот же отчет, html искажает макет, поэтому я создал другой отчет printonebartest1.rdlc, который масштабируется для печати информации. правильно, мой вопрос заключается в том, как я могу передать printonebartest1.rdlc в reportviewer1, когда нажата кнопка печати и экспорт в pdf.
Это код, который у меня есть для кнопки печати
protected void Print_Click(object sender, ImageClickEventArgs e)
{
IolaNetWeightWeb.BarTableAdapters.Product_Weight_Data_Sheet_QueryTableAdapter ds = new IolaNetWeightWeb.BarTableAdapters.Product_Weight_Data_Sheet_QueryTableAdapter();
ReportDataSource rds = new ReportDataSource("Bar_Product_Weight_Data_Sheet_Query", ds.GetData(DropDownList1.Text, DropDownList3.Text));
// Variables
Warning[] warnings;
string[] streamIds;
string mimeType = string.Empty;
string encoding = string.Empty;
string extension = string.Empty;
// Setup the report viewer object and get the array of bytes
ReportViewer viewer = new ReportViewer();
viewer.ProcessingMode = ProcessingMode.Local;
viewer.LocalReport.ReportPath = "printonebartest1.rdlc";
viewer.LocalReport.DataSources.Add(rds); // Add datasource here
byte[] bytes = ReportViewer1.LocalReport.Render("Pdf", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
// Now that you have all the bytes representing the PDF report, buffer it and send it to the client.
Response.Buffer = true;
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "inline; filename=PrintOneBar.pdf");
Response.BinaryWrite(bytes); // create the file
Response.Flush(); // send it to the client to download
}
несмотря на то, что я передаю printonebartest1.rdlc, он все еще использует printonebartest.rdlc. Я делаю что-то не так, мне нужно перепривязать источник данных или что-то в этом роде? пожалуйста, помогите, любая помощь приветствуется.