Crystal Report 13에서 개발 한 Crystal Report가 있지만 배포해야하는 서버에는 Crystal Report 10이 있습니다. 클라이언트는 직접 Crystal 보고서를 프린터로 인쇄하려고합니다. 그들은 PDF를 원하지 않지만 PDF로 잘 내보내고 있습니다. 그럼 Stackoverflow 친구의 도움으로 나는 아래의 코드를 작성하고 지금은 인쇄를 요구합니다. 내 코드는 다음과 같습니다 :Crystal 보고서를 Javascript로 인쇄하는 방법?
CrystalDecisions.CrystalReports.Engine.ReportClass clsReport = new CrystalDecisions.CrystalReports.Engine.ReportClass();
protected void Button3_Click(object sender, EventArgs e)
{
System.Windows.Forms.PrintDialog dialog1 = new System.Windows.Forms.PrintDialog();
dialog1.AllowSomePages = true;
dialog1.AllowPrintToFile = false;
dialog1.ShowDialog();
if (dialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
int copies = dialog1.PrinterSettings.Copies;
int fromPage = dialog1.PrinterSettings.FromPage;
int toPage = dialog1.PrinterSettings.ToPage;
bool collate = dialog1.PrinterSettings.Collate;
clsReport.PrintOptions.PrinterName = dialog1.PrinterSettings.PrinterName;
clsReport.PrintToPrinter(copies, collate, fromPage, toPage);
}
이 코드는 인쇄 대화 상자에서 인쇄 할 수 있지만이 서버에이 시스템을 배포 할 때 : 윈도우 서버 2008 R2 엔터프라이즈
를 오류가 발생합니다 메시지
The ShowDialog is not applicable with server
그래서, 지금은 또한 클라이언트 측에서 페이지를 인쇄 할 수있는 자바 스크립트 코드를 원하는. 그러나 나는 그것을 어떻게하는지 모른다. 그리고 어떻게 자바 스크립트에서 페이지의 버튼을 숨길 수 있습니다 인쇄 : window.print();
귀하의 도움이 가장 큰 것입니다. 내가 언급하고 싶습니다 : 인쇄에
function printCrystal() {
var printContent = document.getElementById('printReady');
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open();
printWindow.document.write('<HTML><HEAD></HEAD><BODY>'+printContent.innerHTML+'</BODY></HTML>');
printWindow.focus();
printWindow.print();
printWindow.close();
}
DIV 태그 : 내 시스템이
당신에게 (그리고 아마도 당신을 클라이언트)는 "Windows 개발"에서 "웹 개발"으로 생각을 분리해야합니다. ASP.NET 페이지에서 보고서를 표시하기 위해 무엇을 사용하고 있습니까? – Alexander
reportviewer를 사용하여 보고서를 표시합니다 – barsan
이 정보가 도움이됩니까? http://stackoverflow.com/questions/6465155/asp-net-crystal-report-viewer-print-button-not-working-in-asp-net – Alexander