asp.net (my previous question)의 보고서 뷰어에서 "인쇄"및 "내보내기"이벤트를 가로 채지 못했으므로. 이제 버튼을 사용하여 프로그래밍 방식으로이 두 함수를 트리거하려고합니다.프로그래밍 방식으로 보고서 뷰어에서 내보내기 및 인쇄 명령 실행
보고서 뷰어 asp.net에서이를 달성 할 수있는 사람이 있습니까? 이 컨트롤이 보이지 않도록 설정되어있는 보고서 뷰어에서 "인쇄"및 "PDF로 내보내기"를 실행하겠습니까?
asp.net (my previous question)의 보고서 뷰어에서 "인쇄"및 "내보내기"이벤트를 가로 채지 못했으므로. 이제 버튼을 사용하여 프로그래밍 방식으로이 두 함수를 트리거하려고합니다.프로그래밍 방식으로 보고서 뷰어에서 내보내기 및 인쇄 명령 실행
보고서 뷰어 asp.net에서이를 달성 할 수있는 사람이 있습니까? 이 컨트롤이 보이지 않도록 설정되어있는 보고서 뷰어에서 "인쇄"및 "PDF로 내보내기"를 실행하겠습니까?
ReportViewer1.PrintDialog()가 작동하는 것 같습니다. 나는 수출에 대해 잘 모르겠다.
수출 :
private void DoExport(string exportType) {
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
string filename;
byte[] bytes = reportViewer.LocalReport.Render(
exportType, null, out mimeType, out encoding,
out extension,
out streamids, out warnings);
filename = string.Format("report-{0:yyyy-MM-dd}.{1}", DateTime.Now, extension);
Response.ClearHeaders();
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
Response.ContentType = mimeType;
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}
protected void btnExportToExcel_Click(object sender, EventArgs e) {
DoExport("Excel");
}
protected void btnExportToPdf_Click(object sender, EventArgs e) {
DoExport("Pdf");
}
인쇄 확실하지 않음 (어쨌든 서버에서 클라이언트 측 기능을 실행할 수있는 방법;?)