[Gambas-user] gb.report pagebreak?
JLichter
jlichter at ...20...
Tue Dec 29 01:10:05 CET 2009
I use Ubuntu 9.10 with Gambas 2.13 and I try the gb.report.
All is running good, however I can't create a page 2 or more in the
report.
Is it possible two create more pages (pagebreak)?
Thanks in advance,
jo42
Here my code:
___________________________________________________
' Gambas module file
PRIVATE hCon AS NEW Connection
PRIVATE hResult AS Result
PRIVATE hReport AS Report
PUBLIC SUB Main()
hcon.Close() ' sure is sure
hcon.host = "localhost"
hCon.User = "root"
hCon.Type = "mysql"
hcon.Name = "test"
hcon.Password = "mysql_password"
hcon.Open()
hResult = hcon.Find("test", "active=1", TRUE)
InitReport()
hcon.Close()
Report.Preview()
' GB 2.13 Error if more as 10 DS:
' The Program has stopped unexpectedly by raising signal #11
' (This is not a bug in your project, but a bug in the interpreter.)
' hint:
hReport.Clear()
END
PRIVATE SUB InitReport()
DIM hLabel AS ReportLabel
DIM hField AS ReportField
DIM hHbox AS ReportHBox
DIM hEmpty AS ReportHBox
DIM hVBox AS ReportVBox
DIM hSpecialField AS ReportSpecialField
Report.Size = "A4"
Report.LineStyle = line.Solid
Report.Padding = "1 cm"
Report.Resolution = Desktop.Resolution
' Header
hLabel = NEW ReportLabel(Report)
hLabel.Text = "REPORT TEST"
hLabel.Height = "2.5 cm"
hLabel.Alignment = Align.Center
hLabel.Font.Size = 25
hLabel.LineStyle = Line.Solid
hLabel.FillColor = Color.LightGray
hLabel.FillStyle = Fill.Solid
hVBox = NEW ReportVBox(Report)
hVBox.Height = "1 cm"
hReport = NEW Report(Report)
hReport.Expand = TRUE
'to do
'hReport.Count = hResult.Count
' Abstand zwischen den DS
hReport.Spacing = "0.2 cm"
FOR EACH hResult
hVBox = NEW ReportVBox(hReport)
hVBox.Height = "1.5 cm"
hVBox.Padding = "0.2 cm"
hVBox.LineStyle = Line.Solid
hHbox = NEW ReportHBox(hVBox)
hHbox.Height = "0.5 cm"
hLabel = NEW ReportLabel(hHbox)
hLabel.Text = "Name:"
hLabel.Width = "2 cm"
hLabel.Font.Bold = TRUE
hField = NEW ReportField(hHbox)
hField.MaxLength = 40
hField.LineStyle = Line.Solid
hField.Width = "4 cm"
hField.Font.Bold = TRUE
hField.Data = hResult!name
hEmpty = NEW ReportHBox(hHbox)
hEmpty.Expand = TRUE
hLabel = NEW ReportLabel(hHbox)
hLabel.Text = "Geburtstag:"
hField = NEW ReportField(hHbox)
hField.Width = "2 cm"
hField.Data = hResult!birth
hHbox = NEW ReportHBox(hVBox)
hHbox.Height = "0.5 cm"
hLabel = NEW ReportLabel(hHbox)
hLabel.Text = "Vorname:"
hLabel.Width = "2 cm"
hLabel.ForeColor = color.Gray
hField = NEW ReportField(hHbox)
hField.MaxLength = 40
hField.LineStyle = Line.Solid
hField.Width = "4 cm"
hField.Font.Italic = TRUE
hField.ForeColor = color.Gray
hField.Data = hResult!firstname
NEXT
hSpecialField = NEW ReportSpecialField(Report)
hSpecialField.Text = "Seite $PAGE / $NPAGE"
hSpecialField.Height = "1 cm"
hSpecialField.Alignment = align.Center
END
More information about the User
mailing list