Question:
How can I pick the right orientation (Portrait or Landscape) to print a Section Report from Elipse E3?
Solution:
To choose the print orientation for you report, access the section report’s configurations in Studio, and then click Configure Report.
This action will open a window. On it, select the option Printer Settings on the side bar. For Orientation, pick between Portrait and Landscape.
To edit this option at run time, you must change Orientation property on the report’s PageSettings. To do so, you must create a script in this report that alters its properties.
Example:
- Create an InternalTag (e.g.: Pagetype);
- In the report, access Script Editor window (button with white sheet and blue engine).
- Select ActiveReport Document and, inside ReportStart event, add the script to edit the following property, according to the desired orientations “rpt.PageSettings.Orientation”.
- Editor de scripts do relatório.
- Sub ActiveReport_ReportStart
- dim Application = Activator.CreateInstance(Type.GetTypeFromProgID("Reports.E3ApplicationLink"))
- Application.LinkWithApplication(rpt)
- 'Orientação da impressão
- If Application.GetViewerValue("PageType") = 1 then
- rpt.PageSettings.Orientation = GrapeCity.ActiveReports.Document.Section.PageOrientation.Portrait
- Else
- rpt.PageSettings.Orientation = GrapeCity.ActiveReports.Document.Section.PageOrientation.Landscape
- End If
- End Sub
- Script do E3 para alterar o tag de orientação.
- Sub CommandButton1_Click()
- IF MsgBox("Imprimir em modo paisagem?", vbQuestion+vbYesNo, "Orientação da página") = vbYes THEN
- Application.Item("PageType").Value = 2
- ELSE
- Application.Item("PageType").Value = 1
- End IF
- Set Report = Application.LoadReport("RelatorioSecaoDetalhado")
- Report.Print()
- End Sub