【问题标题】:MS ReportViewer is not applying custom paper sizeMS ReportViewer 未应用自定义纸张大小
【发布时间】:2015-12-15 13:53:13
【问题描述】:

我在 C# winform 上开发了我的应用程序。我在 Visual Studio 2013 中设计了关于 rdlc 报告的报告。我正在使用报告查看器生成报告的预览并打印报告。

报告纸张尺寸是自定义纸张。即宽度:19cm x 高度:20cm。但是当我在报告查看器中看到我的报告时,它会在 A4 页面中显示报告。

我在设计模式下的报表属性中设置了页面大小。但这没有生效。

我尝试在运行时设置页面大小。但它也没有生效。

我试过这段代码。

System.Drawing.Printing.PageSettings PS = new System.Drawing.Printing.PageSettings();
                PS.PaperSize = new System.Drawing.Printing.PaperSize("Custom", (int)((19 * 0.393701) * 100), (int)((20 * 0.393701) * 100));
                PS.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
                PS.Landscape = false;


                RepViewer.SetPageSettings(PS);

有没有办法在 RDLC 报告和 MS 报告查看器中使用自定义纸张尺寸。

如果否,那么请建议任何应该免费的替代解决方案。

【问题讨论】:

  • 检查您的LocalReport 中的GetDefaultPageSettings() 值。
  • 还要检查传递给report.Render 方法的deviceinfo
  • 调用 GetDefaultPageSettings() 方法时出现此错误。 Microsoft.ReportViewer.WinForms.dll 中出现“Microsoft.Reporting.WinForms.MissingReportSourceException”类型的未处理异常附加信息:尚未指定报告定义的来源

标签: c# visual-studio-2013 reportviewer rdlc custom-pages


【解决方案1】:

我想你只是添加了这段代码结束代码,它会保存你上面自定义的代码:

[YourNameReportViewer].RefreshReport();

【讨论】:

    猜你喜欢
    • 2011-01-30
    • 1970-01-01
    • 2012-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多