cancel
Showing results for 
Search instead for 
Did you mean: 

CrystalReportViewer object ingores zoom factor settings in report files

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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

Former Member
0 Kudos

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

Answers (1)

Answers (1)

former_member183750
Active Contributor
0 Kudos

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]