Skip to Content
author's profile photo Former Member
Former Member

CrystalReportViewer object ingores zoom factor settings in report files

Dear Crystal Report Professionals,

we use in our software Crystal Reports for Visual Studio 2010 SP1 (version 13.0.2000.0). The reports we create with Crystal Reports 2011. Within the designer there can be called a report options dialog. Under this dialog there is an attribute called "start preview pages with" where the zoom factor can be adjusted and saved in the report file.

Under this option you can select page with, total view or whole page. However, this setting is ignored when the report is shown over the CrystalReportViewer object. The viewer object shows the report only with a factor of 100%. Can the property determined within the ReportDocument object and transmitted to the viewer?

Many thanks in advance!

Dirk M.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Sep 29, 2011 at 02:15 PM

    Hi Dirk,

    Search the SDK help chm file which you can get from help.sap.com:

    Remarks

    Use this method to change the zoom level of the CrystalReportViewer control. Use 1 to fit the entire width of the page (but not the entire page) or 2 to fit the entire page in the window.

    This example shows how to zoom the report to a given scale.

    Visual Basic Copy Code

    Private Sub ZoomReport(ByVal myZoomScale As Integer)

    CrystalReportViewer.Zoom(myZoomScale)

    End Sub

    C# Copy Code

    private void ZoomReport(int zoomScale)

    {

    crystalReportViewer.Zoom(zoomScale);

    }

    Any other number sets the zoom factor to 25%.

    And yes I realize you want to get it... still looking...

    Nothing found, so it appears the developers never exposed a way to get it.

    Al I can suggest is you manually save the value in the Summary Info, of the file menu, and add a value to the Comments line. Then you can get the value and set it using the above code when viewing....

    Add your request to get it from the Report Properties to [ Idea Place|http://www.sdn.sap.com/irj/scn/idea-place]

    Thank you

    Don

    Edited by: Don Williams on Sep 29, 2011 7:19 AM

    Edited by: Don Williams on Sep 29, 2011 8:26 AM

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Luther,

      hello Don,

      thanks for your reply. We have decided to use a formula field in the report to store the zoom factor. At runtime we read the value from the report and set it over the zoom function from the viewer. So we can continue to put in the Summary Info properties the actual informations.

      The following function returns the zoom factor as a result:

      Private Function GetZoomFactor() As Integer

      Dim intZF As Integer

      Try

      intZF = CType(objReportDocument.DataDefinition.FormulaFields(FORMULA_NAME_ZOOM_FACTOR).Text, Integer)

      Catch

      intZF = -1

      End Try

      Return intZF

      End Function

      The constant FORMULA_NAME_ZOOM_FACTOR defines the name of the formula field which we have defined in the report. -1 means that the formula field was not found.

      Best regards

      Dirk

  • Posted on Sep 29, 2011 at 01:48 PM

    Hello Dirk

    This sounds like it should be possible - we may be looking at a bug, but let me test it and get back.

    Ludek

    Follow us on Twitter http://twitter.com/SAPCRNetSup

    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.