[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gambas-bugtracker] Bug #2949: Bug gb.report2 Page Break


http://gambaswiki.org/bugtracker/edit?object=BUG.2949&from=L21haW4-

Comment #1 by Fabien BODARD:

The ForceNewPage property of a Container element simply indicates that this element will be started on a new page systematically. Changing its value during the process will not really have any effect.

The object repetition system is a bit wonky.

I advise you instead to make a function that generates objects dynamically on the fly depending on your content.

In the _New() function you simply call your generate function.

exemple of dynamic report generation:

 Dim hPanel As ReportPanel
  Dim hHBox1 As ReportHBox
  Dim hLine As ReportLine
  Dim hLblIlot As ReportLabel
  Dim hVBox2 As ReportVBox
  Dim i As Integer
    
    hVBox2 = New ReportVBox(Me)
    hVBox2.Raise
  hVBox2.Border.Width = "0.1mm"
 hVBox2.Padding = ReportPadding["2mm"]
  hVBox2.Height = "2.7cm"
  hVBox2.Margin.Bottom = "4mm"
  hVBox2.BoxShadow.XOffset = "1mm"
  hVBox2.BoxShadow.YOffset = "1mm"
  hVBox2.BoxShadow.Color = Color.Gray
  hVBox2.Margin.Right = "2mm"
  hLblIlot = New ReportLabel(hVBox2)
  hLblIlot.Text = "Parcellaire 2024"
  hLblIlot.Font = Font["Times,13,Bold"]
  hLblIlot.Alignment = Align.Center
  hLblIlot.Margin.Bottom = "2mm"
  hLblIlot = New ReportLabel(hVBox2)
  hLblIlot.Text = "Date :"
  hLblIlot = New ReportLabel(hVBox2)
  hLblIlot.Expand = True
  hLblIlot = New ReportLabel(hVBox2) As "LblTotal"
  hLblIlot.Alignment = Align.Right
  hLblIlot.Font.Grade = -2

  hVBox = New ReportVBox(ReportHBox1)
   hHBox1 = New ReportHBox(hVBox)
  hVBox.Expand = True
  hHBox1.Height = "1cm"
  hHBox1.Fixed = True
  hLblIlot = New ReportLabel(hHBox1)
  hLblIlot.Expand = True
  For i = 0 To 18
    hLblIlot = New ReportLabel(hHbox1)
    hLblIlot.Width = "0.7cm"
    hLblIlot.Border.Width = "0.1mm"
    hLblIlot.Rotate = 45
    hLblIlot.Font = Font["Arial, -4"]
    hLblIlot.Text = Format(DateAdd(Date(2024, 5, 6), gb.Week, i), "dd/mm")
  Next

  Connections["Connection1"].Open
  hResult = db.Exec("select * from ilots2024")

  hVBox.Expand = True
  For Each hResult
    
    AddIlot(hResult!nom, hResult!ref_ilot)  'Other function to create the ilot grid
    If hResult.Index = hResult.Max Then Break
    hLblIlot = New ReportLabel(hVBox)
    hLblIlot.Height = "2mm"
    hLblIlot.Expand = True
  Next


----[ Gambas bugtracker-list is hosted by https://www.hostsharing.net ]----