找回密码
 立即注册

QQ登录

只需一步,快速开始

lc3w

初级会员

6

主题

27

帖子

334

积分

初级会员

积分
334
lc3w
初级会员   /  发表于:2019-1-7 09:33  /   查看:2994  /  回复:5
本帖最后由 lc3w 于 2019-1-7 17:56 编辑

ActiveReport9
1、监控打印的页数进度,报表提供了PrintProgress,但不知道如何知道当前打印的页数是多少页

2、导出为pdf时,提示 "Your Trial period has expired.",但用View预览导出不会出现这个提示,一切正常
                rptSimpleMain rpt = new rptSimpleMain();
                rpt.Run();
                GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport pdfexp = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
                pdfexp.Security.Encrypt = true;
                pdfexp.Security.Use128Bit = true;
                pdfexp.Security.UserPassword ="123456";
                pdfexp.Export(rpt.Document, @"d:\\aaa.pdf");



5 个回复

倒序浏览
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2019-1-7 10:50:24
沙发
你好,你的项目是C/S端的项目还是B/s端的
回复 使用道具 举报
lc3w
初级会员   /  发表于:2019-1-7 10:56:52
板凳
KearneyKang 发表于 2019-1-7 10:50
你好,你的项目是C/S端的项目还是B/s端的

C/S Winform
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2019-1-7 18:17:48
地板
静默打印参考这个实例:https://gcdn.grapecity.com.cn/fo ... &extra=page%3D1

打印代码
  1. string file_name = @"..\..\PageReport1.rdlx";
  2. GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(file_name));
  3. GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(pageReport);
  4. pageDocument.Print(true, true, false);
复制代码
静默的话就修改下 pageDocument.Print(true,true,false)三个里面的true或者false

导出PDF的代码:
  1. // Provide the page report you want to render.
  2. System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\PageReport1.rdlx");
  3. GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);

  4. // Create an output directory.
  5. System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyPDF");
  6. outputDirectory.Create();

  7. // Provide settings for your rendering output.
  8. GrapeCity.ActiveReports.Export.Pdf.Page.Settings pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();

  9. // Reduce the report size and report generation time.
  10. pdfSetting.OptimizeStatic = true;

  11. // Set the rendering extension and render the report.
  12. GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
  13. GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));

  14. // Overwrite output file if it already exists
  15. outputProvider.OverwriteOutputFile = true;

  16. pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting);
复制代码


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
lc3w
初级会员   /  发表于:2019-1-8 12:00:59
5#
本帖最后由 lc3w 于 2019-1-8 12:05 编辑

我的报表是ActiveReport9区域报表(基于代码)的,不是rdlx,不知道如何处理。另个复制你上段代码也提示OptimizeStatic属性不存在

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2019-1-8 14:45:30
6#
换一种导出的方法:
  1. // Export the report in HTML format.
  2. GrapeCity.ActiveReports.Export.Html.Section.HtmlExport HtmlExport1 = new GrapeCity.ActiveReports.Export.Html.Section.HtmlExport();
  3. HtmlExport1.Export(MyDocument, Application.StartupPath + "\\HTMLExpt.html");

  4. // Export the report in PDF format.
  5. GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport1 = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
  6. PdfExport1.Export(MyDocument, Application.StartupPath + "\\PDFExpt.pdf");

  7. // Export the report in RTF format.
  8. GrapeCity.ActiveReports.Export.Word.Section.RtfExport RtfExport1 = new GrapeCity.ActiveReports.Export.Word.Section.RtfExport();
  9. RtfExport1.Export(MyDocument, Application.StartupPath + "\\RTFExpt.rtf");

  10. // Export the report in text format.
  11. GrapeCity.ActiveReports.Export.Xml.Section.TextExport TextExport1 = new GrapeCity.ActiveReports.Export.Xml.Section.TextExport();
  12. TextExport1.Export(MyDocument, Application.StartupPath + "\\TextExpt.txt");

  13. // Export the report in TIFF format.
  14. GrapeCity.ActiveReports.Export.Image.Tiff.Section.TiffExport TiffExport1 = new GrapeCity.ActiveReports.Export.Image.Tiff.Section.TiffExport();
  15. TiffExport1.Export(MyDocument, Application.StartupPath + "\\TIFFExpt.tiff");

  16. // Export the report in XLSX format.
  17. GrapeCity.ActiveReports.Export.Excel.Section.XlsExport XlsExport1 = new GrapeCity.ActiveReports.Export.Excel.Section.XlsExport();
  18. // Set a file format of the exported excel file to Xlsx to support Microsoft Excel 2007 and newer versions.
  19. XlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx;
  20. XlsExport1.Export(MyDocument, Application.StartupPath + "\\XLSExpt.xlsx");                  
复制代码
这上面是导出的几种方法
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部