Setting printer paper size in VB.Net for rdlc report

眉间皱痕 提交于 2019-11-30 21:45:05

In order to change the default format (A4) of a report, you must change the report properties to accept a custom paper size.

Set PaperSize By GUI

Step 1

Open your report and right click (on the gray pane, not the report itself) to select "Report Properties"

Step 2

Choose Landscape for your orientation and select a custom paper size. Specify your width and height as well.


Programmatically Set PaperSize

  1. Paper Size should be the size in inches multiplied by 100
  2. Width: The width of the paper, in hundredths of an inch
  3. Height: The height of the paper, in hundredths of an inch

Here is the code I used to programmatically set a custom paper size to my report

ReportViewer1.PrinterSettings.DefaultPageSettings.PaperSize = new PaperSize("Custom", 650, 325)

**Note: Don't forget, you may need to use the code ReportViewer1.RefreshReport() if it doesn't work.*

For more information, visit MSDN's PaperSettings.PaperSize page

wael mrabet

I solved the issue by setting the report properties - setting up page size by inches, after that setting up the width 3.0in and height 8.3in the problem is solved.

Dim page As XmlElement = AddElement(reportSection, "Page", Nothing)

        'landscape
        AddElement(page, "PageHeight", "8.5in")
        AddElement(page, "PageWidth", "11in")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!