Page 1 of 3

How should i get the Paper type at runtime?

Posted: Wed Jul 11, 2007 8:38 am
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)

How should i get the Paper type at runtime?

Posted: Wed Jul 11, 2007 8:43 am
by Edward
Please examine Page.Height and Page.Width properties. These properties are represented in report's units (centimeters, inches).

Thank you.

How should i get the Paper type at runtime?

Posted: Wed Jul 11, 2007 11:04 pm
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 ?

How should i get the Paper type at runtime?

Posted: Thu Jul 12, 2007 10:35 am
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.

How should i get the Paper type at runtime?

Posted: Thu Jul 12, 2007 10:02 pm
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?

How should i get the Paper type at runtime?

Posted: Fri Jul 13, 2007 1:37 am
by Edward
Please download the latest prerelease version of the StimulReport.Net. This property we've added in 2007.2 version.

Thank you.

How should i get the Paper type at runtime?

Posted: Fri Jul 13, 2007 5:11 am
by satisht
How should i download StimulReport 2007.2

How should i get the Paper type at runtime?

Posted: Fri Jul 13, 2007 5:17 am
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.

How should i get the Paper type at runtime?

Posted: Mon Jul 16, 2007 12:45 am
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?

How should i get the Paper type at runtime?

Posted: Mon Jul 16, 2007 3:33 am
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.