开发者

Set ReportViewer to Legal Page Size at load using c#

I wrote a c# program that displays rdlc reports locally using the .net reportviewer. I can't figure开发者_运维知识库 out how to set page size to "Legal" instead of "Letter" when the reportviewer loads.

For example: This is how I refer to the reportviewer at load time to change the report path.

            reportViewer1.LocalReport.ReportPath = strRptResource.ToString();

Can I change the page setup to "Legal" using a similar syntax?

FYI, the margins and page size are already set properly in the rdlc file.


This setting is held in the RLDC file (the report definition XML file). You are able to set this when editing a Report, under Report Properties. You actually need to specify the Width and Height manually.

In order to do this during load time, you would need to load the RDLC file into memory, alter the value for Width and Height, then load the report with the altered report definition.


You page width and height must match the one the one you're aiming for . Be very cautious to be the exact size because if you don't, it might have problems with determining the paper type even if it's really close.

Also, if you're using centimeters as units in your applications, define the page witdh and height to inches instead. I had that problem more than once before.

If you want to changed it dinamically, then you can create a copy of the report, change the value you need (it's a xml base file so you can open it to see for yourself)

Check this for more info.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜