Sebagai contoh
buatlah Form dengan ukuran Width: 1024, Height: 600 atau ukurannya
sesuai dengan keinginan anda, yang penting hasil tampilannya nanti
nyaman dilihat.
Pada Tool Box pilih
Object ReportView untuk di taruh di papan Form. Jika Object
ReportView belum ada di Tool Box, maka harus di aktifkan dulu library
Report pada: Project > Property > Component > gb.Report2
diaktifkan/Centang. Lalu kembali ke Tool Box untuk mengambil
ReportView.
Sertakan juga dua
tombol untuk memperbesar (Zoom Out) dan memperkeci (Zoom In) supaya
untuk lebih dapat melihat hasilnya.
Ukuran Panjang-Lebar
ReportView1 sesuaikan aja dengan kenyamanan anda.
Hasilnya jika
langsung dijalankan seperti berikut :
Tanpa ada tampilan
kertas
Dasar menampilkan
kertas pada ReportView:
' Gambas class file
Private Report1 As
Report
Public Sub
Form_Open()
Report1 = New
Report As "Report1"
ReportView1.Report
= Report1
End
Jika dijalankan maka
akan tampak tampilan kertas pada ReportView.
Ok, kita lanjut pada
tahap berikutnya berdasarkan kode diatas.
' Gambas class file
Private Report1 As
Report
Private Printer1 As
New Printer
Private ReportHBox1
As ReportHBox
Private ReportVBox1
As ReportVBox
Private ReportLabel1
As ReportLabel
Private ReportLabel2
As ReportLabel
Private ReportLabel3
As ReportLabel
Private ReportLabel4
As ReportLabel
Private ReportLabel5
As ReportLabel
Private UkuranZoom
As Short
Public Sub
Form_Open()
'Instansiasi
Report1 = New
Report
ReportLabel1 = New
ReportLabel(Report1)
ReportHBox1 = New
ReportHBox(Report1)
ReportVBox1 = New
ReportVBox(Report1)
ReportLabel2 = New
ReportLabel(ReportHBox1)
ReportLabel3 = New
ReportLabel(ReportHBox1)
ReportLabel4 = New
ReportLabel(ReportVBox1)
ReportLabel5 = New
ReportLabel(ReportVBox1)
ReportLabel1.Text
= "Ini teks pada ReportLabel1"
ReportLabel1.BackGround = ReportBrush.Color(&H00FFFF)
ReportLabel2.Text
= "Ini teks pada ReportLabel2"
ReportLabel2.Width
= 200
ReportLabel2.Height = 20
ReportLabel2.BackGround = ReportBrush.Color(&H9EC5EC)
ReportLabel3.Text
= "Ini teks pada ReportLabel3"
ReportLabel3.Width
= 500
ReportLabel3.Height = 20
ReportLabel3.BackGround = ReportBrush.Color(&HC0C0C0)
ReportLabel4.Text
= "Ini teks pada ReportLabel4"
ReportLabel4.Width
= 200
ReportLabel4.Height = 20
ReportLabel4.BackGround = ReportBrush.Color(&H00FFFF)
ReportLabel5.Text
= "Ini teks pada ReportLabel5"
ReportLabel5.Width
= 200
ReportLabel5.Height = 50
ReportLabel5.BackGround = ReportBrush.Color(&H9EC5EC)
Report1.Padding.Left = 20
Report1.Padding.Top = 20
Printer1.Paper =
Printer1.A3
Print
Printer1.PaperWidth 'Uji Coba melihat hasi
Print
Printer1.PaperHeight
Report1.Paper =
Printer1.Paper
Print
Report1.Width 'Uji Coba melihat hasi
Print
Report1.Height
ReportView1.Report
= Report1
End
Public Sub
Perbesar_Click()
Inc UkuranZoom
ReportView1.Zoom =
UkuranZoom
End
Public Sub
Perkecil_Click()
Dec UkuranZoom
ReportView1.Zoom =
UkuranZoom
End
Hasil:
Dari skrip diatas
silahkan coba di otak-atik untuk mengetahui efeknya dari
masing-masing kode.
Mungkin sementara
sampai disini dulu, Yang penting kena dasar-dasar tampilan laporan. InsyaAllah kedepan akan dilanjutkan sebagai
pembahasan pelengkap, tentunya tahap demi tahap.