Solved

Crystal Reports XI Viewer, size to percent or screen ?

Posted on 2006-11-30
7
781 Views
Last Modified: 2012-08-13

Hello, I have a vb .net 2003 application using CR XI viewer to display reports.  when the user increases the magnification, I increase the viewer width with the code below.  

I can only get it to work with the units in pixels: Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Pixel(800)
This will not work: Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Percentage(100)

If I use the percentage it sizes to 100 pixels instead of 100%.  Ive tried .Percentage(100) and .Percentage(100%)

Here's the code:  Every thing works but the case else.

    Private Sub crViewer1_ViewZoom(ByVal source As Object, ByVal e As CrystalDecisions.Web.ZoomEventArgs) Handles crViewer1.ViewZoom

        Me.crViewer1.BestFitPage = False

        Select Case e.NewZoomFactor

            Case 100
                Me.crViewer1.BestFitPage = True

            Case 125
                Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Pixel(1100)
                Me.crViewer1.Height = System.Web.UI.WebControls.Unit.Pixel(1100)

            Case 150
                Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Pixel(1400)
                Me.crViewer1.Height = System.Web.UI.WebControls.Unit.Pixel(1400)

            Case Else
                Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Percentage(100)
                Me.crViewer1.Height = System.Web.UI.WebControls.Unit.Percentage(100)

        End Select

    End Sub

this is the link that I used:
http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2016117&sliceId=&dialogID=10458781&stateId=1%200%2010460751

Thanks for any help.

0
Comment
Question by:sourcelink
  • 2
  • 2
7 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 18051079
It would probably be better to ask this in the VB.Net TA.

mlmcc
0
 
LVL 8

Expert Comment

by:mhunts
ID: 18062212
You could write a user function that takes the percentage as an input parameter, and converts it to pixels, then use the WebControls.Unit.Pixel technique.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18063907
0
 

Author Comment

by:sourcelink
ID: 18069660

Thanks mhunts for your response,

This is probably a dumb question, but how do I know on the server side, what the client resolution is?

Thanks!

0
 
LVL 8

Accepted Solution

by:
mhunts earned 500 total points
ID: 18072242
The server can't know what the client resolution is, unless the client passes it explicitly.

However, if you look at your program, which works, except for the else, you have:

125% mapping to a resolution of 1100 pixels
150% mapping to a resolution of 1400 pixels
else you want to map to 100%

So when you select 125% zoom, you're assuming that 100% resolution is 880 (1100 / 125%), and
when you select 150% zoom, you're assuming that 100% resolution is 933 (1400 / 150%)

Instead of the else statement you have, why don't you use either 880 or 933 as your 100% scaling, and use the pixel measurement. What I mean is:

            Case Else
                Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Pixel(800)
                Me.crViewer1.Height = System.Web.UI.WebControls.Unit.Pixel(800)

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question