问题描述:
桌面端打印报表模板
问题回答:
桌面端您直接走这一段程序即可:
- GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport();
- pageReport.Document.LocateDataSource += new GrapeCity.ActiveReports.LocateDataSourceEventHandler(Document_LocateDataSource);
- GrapeCity.ActiveReports.PrinterSettings printerSettings = new GrapeCity.ActiveReports.PrinterSettings();
- printerSettings.ShowPrintDialog = true;
- printerSettings.Printer.PaperSize.Width = 8;
- printerSettings.Printer.PaperSize.Height = 5;
- printerSettings.Printer.Landscape = true;
- printerSettings.Printer.DefaultPageSettings.Landscape = true;
- printerSettings.Printer.PrinterName = @"\\xa-printer\XA-205-Lobby";//打印机名
- printerSettings.Printer.PrinterName = @"Microsoft Print to PDF";
- pageReport.Load(new System.IO.FileInfo(@"Reports\Untitled.rdlx"));
- GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(pageReport);
- pageDocument.LocateDataSource += new GrapeCity.ActiveReports.LocateDataSourceEventHandler(Document_LocateDataSource);
- pageDocument.Print(printerSettings);
复制代码 然后pageDocument.Print(printerSettings);不抛出错误,就没什么问题
|