How to change pagesettings orientation in flexviewer?

Posted by: cjyap68 on 26 October 2018, 3:11 am EST

    • Post Options:
    • Link

    Posted 26 October 2018, 3:11 am EST

    I have a flex report designed in portrait orientation with custom papersize of width 9 inches and height 3.66 inches (about the size of a cheque). When I load it in flexviewer, the preview displays the report correctly in portrait mode. However, the Landscape button on the ribbon is always selected.

    If I print the report without changing the orientation, the report printed correctly in portrait mode but shifted to the right, so part of the report on the right is clipped.

    If I change the page orientation to portrait mode by clicking on the page setup button and select portrait options in the dialog box, and click OK button, then there is no problem with the printout. However, I do notice that if I click the page setup button again, the orientation on the page setup diaglog remains as landscape without change!

    Before printing, if I just click on the portrait button on the ribbon, then the report is printed in Landscape mode!

    I also notice that sometimes the orientation buttons on the ribbon is not in sync with the orientation options in the page setup dialog.

    I tried to do the following in code

        Dim ps As New PageSettings
        ps.Landscape = False
        flexviewer1.PageSettings = ps
        debug.print (flexviewer1.PageSettings.Landscape)
    

    And I always get true in debug window.

    Thanks in advance for any help.

  • Posted 27 October 2018, 12:55 am EST - Updated 4 October 2022, 2:03 am EST

    I created a sample flex report with custom paper size of width 9 inches and height 3.66 inches ( Papersize= custom, Custom height = 12240, custom width = 5280, orientation = portrait ),

    When I click the preview button in flexreport designer, the report is displayed correctly with portrait button on the ribbon selected. But if I click the page setup button. The page setup dialog shows “Landscape” option is selected. It is not in sync with the button on the ribbon.

    If I select portrait in the page setup dialog, the report is shown as below.

    It looks like there are some confusions over orientation when the paper width is longer than paper height.

    For A4 paper, if the width is shorter than height, it is considered as portrait. Otherwise it is considered as landscape

    For custom paper whereby paper height is shorter than paper width

    If the width is longer than the height, Is it considered as landscape or portrait?

  • Posted 30 October 2018, 6:57 am EST

    Hello,

    I would like to clear a few points first:

    a. If the width of the paper is longer than the height, it is considered as landscape. This is the reason why page setup dialog shows Landscape selected in these cases.

    b. The orientation buttons on the ribbon are not aligned to change the layout of the report as per the button click. This, however, can be done as per the formatting based script added to a report. Report layout created for Landscape cannot fit to portrait layout. Attached “rep.flxr” shows the change in orientation based on button click because of related script added to GlobalScripts.

    I could observe that on changing the paper size to the mentioned values, the report pages are rendered as cheque pages (tested with “categories.flxr”). However, the Portrait button on the ribbon is selected at this moment. In case we change it to Landscape, the text gets cut from the right edge (because of [b] stated above).

    If the report is printed in this case (when it is previewed after setting CustomWidth,CustomHeight), it is printed as in landscape because orientation under page setup is Landscape as the specified width is more than the height (as stated in [a] above).

    >>However, I do notice that if I click the page setup button again, the orientation on the page setup diaglog remains as landscape without change!

    This is an expected behaviour as per the explanation stated above.

    >>Before printing, if I just click on the portrait button on the ribbon, then the report is printed in Landscape mode!

    This is because of the specified custom size of the paper.

    >>I also notice that sometimes the orientation buttons on the ribbon is not in sync with the orientation options in the page setup dialog.

    To set orientation for a report (say, Portrait), two properties are set as follows:

    report.PageSettings.Landscape = false
    report.Layout.Orientation = OrientationEnum.Portrait
    

    Thus, setting them accordingly for your report would print it in the desired orientation.

    Note: “categories.flxr” is bound to C1NWind.mdb shipped with the product.

    Hope this addresses all your concerns.

    Let me know if you need further assistance.

    Best Regards,

    Esha

    Reports.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels