How should i get the Paper type at runtime?

Stimulsoft Reports.NET discussion
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

How should i get the Paper type at runtime?

Post by satisht »

If i set the paper type at runtime for all pages ? Then how should i get the paper type at runtime? (letter,A4,etc)
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How should i get the Paper type at runtime?

Post by Edward »

Please examine Page.Height and Page.Width properties. These properties are represented in report's units (centimeters, inches).

Thank you.
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

How should i get the Paper type at runtime?

Post by satisht »

Only this is the way to get the type of paper ? Can i get directly type of paper ? means which paper type i have set in report ?
Guest
Posts: 182
Joined: Tue Jun 06, 2006 8:04 am

How should i get the Paper type at runtime?

Post by Guest »

For get type information you can use:

Code: Select all

StiPage page = report.Pages[0];
and later you can use

Code: Select all

page.PaperSize.ToString()
for access to the page type

Also you can set page type by the following code, for example:

Code: Select all

StiPage page = report.Pages[0];
page.PaperSize = System.Drawing.Printing.PaperKind.A5;
For access information about page type from designer you can use, for example:

Code: Select all

{Page1.PaperSize}
Thank you.
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

How should i get the Paper type at runtime?

Post by satisht »

I have used same code in vb
Dim page As StiPage = Report.Pages(0)

But there is no property like
'page.papersize'

Is there any another way to get the paper type?
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How should i get the Paper type at runtime?

Post by Edward »

Please download the latest prerelease version of the StimulReport.Net. This property we've added in 2007.2 version.

Thank you.
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

How should i get the Paper type at runtime?

Post by satisht »

How should i download StimulReport 2007.2
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How should i get the Paper type at runtime?

Post by Edward »

Please follow the link:

http://www.stimulsoft.com/DownloadsSR.aspx

Then you should select "StimulReport.Net 2007.07.12 D2005"

If you are registered user, then you should enter your registration data here:

http://www.stimulsoft.com/RegisteredUse ... ?login=yes
and then please follow the link:
http://www.stimulsoft.com/RegisteredUsers.aspx

Thank you.
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

How should i get the Paper type at runtime?

Post by satisht »

Using form As Stimulsoft.Report.Render.StiPreviewForm = New Stimulsoft.Report.Render.StiPreviewForm(Report)
Dim stiPreview As Stimulsoft.Report.Render.StiPreviewControl = form.PreviewControl
Dim tb As StiToolBar = stiPreview.ToolBar
Dim btnSave As StiToolButton = TryCast(tb.Controls.Item("tbSave"), StiToolButton)
Dim btnExport As StiToolButton = TryCast(tb.Controls.Item("tbExport"), StiToolButton)
btnExport.Image = btnSave.Image
Report.Render()
Report.Compile()
form.ShowDialog()
Dim page As StiPage = Report.Pages(0)
MessageBox.Show(page.PaperSize.ToString)
End Using

I have used above code to to get the paper type at the time of closing the report if I set the page size to A4 or letter but still I get only custom type. How should i resove this problem?
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How should i get the Paper type at runtime?

Post by Edward »

You should reference a CompiledReport object instead of the Report object if you working with report after compilation.
Please modify your code in the following way:

Code: Select all

Dim page As StiPage = report.CompiledReport.Pages(0)
page.PaperSize = Printing.PaperKind.A5
MessageBox.Show(page.PaperSize.ToString)
Report.Render()
form.ShowDialog()
If you modify a report template (Report template directly) with a new page size then you should call Compile method of the Report to apply changes.

Thank you.
Post Reply