Newsgroup: it.comp.lang.visual-basic
Titolo: [2?] Datareport e pagine orizzontali

Non riesco a generare il report con datareport perchè mi dice che i dati
sono troppi. Pensavo che ci fosse la possibilità di settare òa pagina in
orizzontale, ma non ho trovato nulla per poter fare cio'. Allora o provato
con l'oggetto printer ma nulla di fatto.
Come posso fare per impostare la pagina orizzontale con data report in modo
che i miei dati ci stiano tutti????
Ringrazio anticipatamente
Marius

 wrote in message
qtEJ3.21550$nP6.2...@typhoon.libero.it...


 wrote in message
hmOJ3.24193$nP6.2...@typhoon.libero.it...


Penso che nel codice tu possa impostare il valore.
Prova a vedere tra le proprietą del data report nell'help.

 Marius
Io ho fatto cosi' e funziona......
Mettere nel MODULO:
Option Explicit
Private Const CCHDEVICENAME = 32
Private Const CCHFORMNAME = 32
Private Const STANDARD_RIGHTS_REQUIRED = &HF0000
Private Const PRINTER_ACCESS_ADMINISTER = &H4
Private Const PRINTER_ACCESS_USE = &H8
Private Const PRINTER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or 
PRINTER_ACCESS_ADMINISTER Or PRINTER_ACCESS_USE)
Private Const DM_MODIFY = 8
Private Const DM_IN_BUFFER = DM_MODIFY
Private Const DM_COPY = 2
Private Const DM_OUT_BUFFER = DM_COPY
Private Const DM_DUPLEX = &H1000&
Public Const DMDUP_SIMPLEX = 1
Private Const DMDUP_VERTICAL = 2
Private Const DMDUP_HORIZONTAL = 3
Private Const DM_ORIENTATION = &H1&
Private Type DEVMODE
    dmDeviceName As String * CCHDEVICENAME
    dmSpecVersion As Integer
    dmDriverVersion As Integer
    dmSize As Integer
    dmDriverExtra As Integer
    dmFields As Long
    dmOrientation As Integer
    dmPaperSize As Integer
    dmPaperLength As Integer
    dmPaperWidth As Integer
    dmScale As Integer
    dmCopies As Integer
    dmDefaultSource As Integer
    dmPrintQuality As Integer
    dmColor As Integer
    dmDuplex As Integer
    dmYResolution As Integer
    dmTTOption As Integer
    dmCollate As Integer
    dmFormName As String * CCHFORMNAME
    dmLogPixels As Integer
    dmBitsPerPel As Long
    dmPelsWidth As Long
    dmPelsHeight As Long
    dmDisplayFlags As Long
    dmDisplayFrequency As Long
    dmICMMethod As Long        '// SOLO x Windows 95
    dmICMIntent As Long        '// SOLO x Windows 95
    dmMediaType As Long        '// SOLO x Windows 95
    dmDitherType As Long       '// SOLO x Windows 95
    dmReserved1 As Long        '// SOLO x Windows 95
    dmReserved2 As Long        '// SOLO x Windows 95
End Type
Private Type PRINTER_DEFAULTS
    pDatatype As String
    pDevMode As Long
    DesiredAccess As Long
End Type
Private Declare Function OpenPrinter Lib "winspool.drv" Alias 
"OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault 
As PRINTER_DEFAULTS) As Long
Private Declare Function SetPrinter Lib "winspool.drv" Alias 
"SetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pPrinter As 
Any, ByVal Command As Long) As Long
Private Declare Function GetPrinter Lib "winspool.drv" Alias 
"GetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pPrinter As 
Any, ByVal cbBuf As Long, pcbNeeded As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" 
(hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter 
As Long) As Long
Private Declare Function DocumentProperties Lib "winspool.drv" Alias 
"DocumentPropertiesA" (ByVal hwnd As Long, ByVal hPrinter As Long, ByVal 
pDeviceName As String, ByVal pDevModeOutput As Any, ByVal pDevModeInput 
As Any, ByVal fMode As Long) As Long
Public Sub SetOrientation(NewSetting As Long, chng As Integer)
    Dim PrinterHandle As Long
    Dim PrinterName As String
    Dim pd As PRINTER_DEFAULTS
    Dim MyDevMode As DEVMODE
    Dim Result As Long
    Dim Needed As Long
    Dim pFullDevMode As Long
    Dim pi2_buffer() As Long
 
    PrinterName = Printer.DeviceName
    If PrinterName = "" Then
        Exit Sub
    End If
 
    pd.pDatatype = vbNullString
    pd.pDevMode = 0&
 
    pd.DesiredAccess = PRINTER_ALL_ACCESS
 
    Result = OpenPrinter(PrinterName, PrinterHandle, pd)
 
    Result = GetPrinter(PrinterHandle, 2, ByVal 0&, 0, Needed)
    ReDim pi2_buffer((Needed \ 4))
    Result = GetPrinter(PrinterHandle, 2, pi2_buffer(0), Needed, Needed)
 
    pFullDevMode = pi2_buffer(7)
 
    Call CopyMemory(MyDevMode, ByVal pFullDevMode, Len(MyDevMode))
 
    MyDevMode.dmDuplex = NewSetting
    MyDevMode.dmFields = DM_DUPLEX Or DM_ORIENTATION
    MyDevMode.dmOrientation = chng
 
    Call CopyMemory(ByVal pFullDevMode, MyDevMode, Len(MyDevMode))
 
    ' CAMBIARE ''Form1.hwnd'' con il nome del DATAREPORT
    Result = DocumentProperties(Form1.hwnd, PrinterHandle, PrinterName, 
ByVal pFullDevMode, ByVal pFullDevMode, DM_IN_BUFFER Or DM_OUT_BUFFER)
 
    Result = SetPrinter(PrinterHandle, 2, pi2_buffer(0), 0&)
 
    Call ClosePrinter(PrinterHandle)
 
    Dim p As Printer
    For Each p In Printers
        If p.DeviceName = PrinterName Then
            Set Printer = p
            Exit For
        End If
    Next p
    Printer.Duplex = MyDevMode.dmDuplex
End Sub
Nella Form:
Private Sub Command1_Click()
  ' ORIZZONTALE
  Call SetOrientation(DMDUP_SIMPLEX, 2)
  ' VERTICALE
  'Call SetOrientation(DMDUP_SIMPLEX, 1)
  Report.Show
End Sub
Ciao da Francesca!