找回密码
 立即注册

QQ登录

只需一步,快速开始

冬眠兔兔

注册会员

1

主题

2

帖子

59

积分

注册会员

积分
59
最新发帖
冬眠兔兔
注册会员   /  发表于:2019-7-5 14:29  /   查看:3399  /  回复:3
1金币
使用版本:ActiveReportsNET11-v11.3.14330.1
VS版本:VS2017
开发语言:C# WinForm开发 Framework4.6.1
Report类型:SectionReport
现象:VS内预览模式导出的PDF()和使用代码PdfExport p = new PdfExport(); p.Export(section.Document, @"D:\123.pdf");导出的PDF,文字表示时有些微的差距。
内预览模式导出的PDF:
使用代码Export的PDF:

Report对象是同一个,是不是p.Export之前需要设定什么属性?

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

3 个回复

倒序浏览
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2019-7-5 14:44:13
沙发
你的报表设置的字体是什么字体,建议使用字体是微软雅黑。然后你使用的导出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);
复制代码


回复 使用道具 举报
冬眠兔兔
注册会员   /  发表于:2019-7-5 15:46:58
板凳
本帖最后由 冬眠兔兔 于 2019-7-5 15:52 编辑
KearneyKang 发表于 2019-7-5 14:44
你的报表设置的字体是什么字体,建议使用字体是微软雅黑。然后你使用的导出PDF的代码是哪个建议使用这个:
...

我使用的是字体是【MS 明朝】(项目需要,我使用的是日文版的ActiveReport)
然后我导出PDF用的代码是:
SectionReport section = new RP7331301();
section.ShowParameterUI = false;           
section.DataSource = dtTable;
section.Run();
PdfExport p = new PdfExport();
p.Export(section.Document, @"D:\123.pdf");
另外我使用的是SectionReport ,版主大大提供的方法也能使用么?
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2019-7-5 17:58:54
地板
都是可以的,但是关于日文版本这块,我这边没办法根据你的日文版本做一个验证,实在不好意思
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部