How to access page size properties?

Stimulsoft Reports.NET discussion
Post Reply
RickyHuang
Posts: 68
Joined: Tue Feb 09, 2010 3:16 am
Location: Taiwan

How to access page size properties?

Post by RickyHuang »

I want to write code to change the following page size settings and rebuild the report.
Could you tell me if there's an object or how to access them thru code? Thanks~

Image


Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

How to access page size properties?

Post by Ivan »

Hello,

You can use the following code, for example:

Code: Select all

            foreach (StiPage page in report.Pages)
            {
                page.PaperSize = PaperKind.A5;
                page.Orientation = StiPageOrientation.Landscape;
                page.Margins = new StiMargins(1, 1, 1, 1);
            }
            report.Render();
Thank you.
RickyHuang
Posts: 68
Joined: Tue Feb 09, 2010 3:16 am
Location: Taiwan

How to access page size properties?

Post by RickyHuang »

Hi

If I render the report twice with different settings and then bind with the viewer, it would not render the second setting, only the first.
How do I make it take the second setting?

Thanks



Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

How to access page size properties?

Post by Ivan »

Hello,

We couldn't reproduce this bug.
Can you please send us a simple test project, which reproduces the issue?

Thank you.
RickyHuang
Posts: 68
Joined: Tue Feb 09, 2010 3:16 am
Location: Taiwan

How to access page size properties?

Post by RickyHuang »


this is my code
StiReport1.Pages(0).PaperSize = Printing.PaperKind.A5
StiReport1.Pages(0).Height = "21.6"
StiReport1.Pages(0).Width = "14"
StiReport1.Render()

StiReport1.Pages(0).PaperSize = Printing.PaperKind.A5
StiReport1.Pages(0).Height = "5"
StiReport1.Pages(0).Width = "5"
StiReport1.Render()
StiViewerControl1.Report = StiReport1
I can't upload attachment. When the report is displayed in the viewer it's not showing as 5 x 5.

------------------------------------------------------------------------------------------------------------
Another problem I'm having is when I bring up the viewer to see my custom form, it shows the custom form like below:

Image

But then when I change the page size and rebuild the report, the custom form only displays the title bar.

Image
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

How to access page size properties?

Post by Alex K. »

Hello,

Please try to modify your code:

Code: Select all

StiReport1.Pages(0).PaperSize = Printing.PaperKind.A5
StiReport1.Pages(0).Height = 5
StiReport1.Pages(0).Width = 5
StiReport1.Render()
StiViewerControl1.Report = StiReport1
Thank you.
Post Reply