Page 1 of 1

How to access page size properties?

Posted: Mon May 16, 2011 9:37 pm
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



How to access page size properties?

Posted: Tue May 17, 2011 2:49 am
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.

How to access page size properties?

Posted: Thu May 19, 2011 7:52 pm
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




How to access page size properties?

Posted: Fri May 20, 2011 2:31 am
by Ivan
Hello,

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

Thank you.

How to access page size properties?

Posted: Fri May 20, 2011 5:01 am
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

How to access page size properties?

Posted: Mon May 23, 2011 1:32 am
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.