Results 1 to 4 of 4

Thread: landscape with Data Report !!!! ????? anywone with a magik Dll

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    DAKAR (Sénégal)
    Posts
    26

    Question landscape with Data Report !!!! ????? anywone with a magik Dll

    HI all

    anyone knows how to print a data report in landscape.


    Thanks


    BEST REGARDS
    Thoms

  2. #2
    jim mcnamara
    Guest
    Have you tried:

    Printer.Orientation = vbPRORLandscape

    And.

    This doesn't work with every printer, plus you have to know the actual command for the printer (like esc#0P to set landscape mode printing. The Escape api sends raw data to the printer -
    in other words GDI doesn't touch it like it does for everything else.

    Code:
    Declare Function Escape Lib "gdi32" Alias "Escape" ( _ 
               ByVal hdc As Long, _ 
               ByVal nEscape As Long, _ 
               ByVal nCount As Long, _ 
               ByVal lpInData As String, _ 
               lpOutData As Any _ 
    ) As Long 
     
    Dim i
    Const PASSTHROUGH = 19
    Dim outputdata as string
    Dim controlStr as String
    controlStr = |||chr(27) & whatever|| ' you have to know this part
                   it is not always an escape sequence.
    i= Escape( Printer.hdc, PASSTHROUGH, Len(controlStr), controlStr, vbNull)
    ' print your report here.

  3. #3
    Hyperactive Member
    Join Date
    Sep 2001
    Location
    Orlando
    Posts
    392

    Two Secrets

    I will tell you two secrets about the DataReport.
    1. You can't make it choose any page size you like.
    2. You can't display Images from a Database (But this has nothing to do with you problem).

    After a bit of research, I found that the Data Report Takes the Paper size from the default printer settings. So if you go to Settings->Printers and then choose the properties of your printer, you will have some option to change the paper size as well as the orientation. Change it to Landscape, and then run your project, what do you see?

    Now, this is not a solution, isn't it? To me, it is the biggest limitation of the DataReport.

    I found a work around though.
    You may display a message to the user when they try to run the DataReport, say something like "You must choose a Landscape Paper settings". And then bring up the default printer properties using the PrinterProperty API call. So far I remember, the call is something like..

    VB Code:
    1. PrinterProperties( Printer.Name )

    It is upto the user to select the Landscape from the dialog.
    This is still not a solution, I admit that.

    Please not that, changing the printer's paper orientation using the API or the Printer Objects Property doesn't work, this is because these methods do it for the application, and it doesn't change the default printer properties.

    Once again, the DataReport takes it from the Default Printer Properties.

    Hope it helps.
    Abu Haider
    ____________________________
    100% Data Validation for the MS DataGrid Control. Plus Support for Custom and Foreign Lists, DatePicker and much more...
    The DataGridEnhancer


    I often point to a place where the problem has been discussed, instead of giving you the code that solves it. This is for good, may be you will understand some day...

  4. #4
    Lively Member
    Join Date
    Sep 2001
    Location
    Western North Carolina
    Posts
    124

    Cool Report Orientation

    The quickest and easiest way that I have found to get the data report to print in landscape is as follows.

    Put this code in your click event or what ever command button fires the report off.

    DataReport1.Orientation = rptOrientLandscape

    2 things that You have to make sure of is:

    1- Make sure that the report is not larger than the width of the paper. The width is determined by combining the left margin, width, right margin.

    So I usually set the left and right margins at 720 twips (1/2"), and the width to 12000. This makes the total report width 13410. This is smaller than the maximum width of the paper. (16560 twips for 11 1/2" wide paper).

    2- Make sure that You put the page orientation code before You refresh the report.

    I hope this will be of some help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width