I am creating a DataWindow type FreeFrom using the instruction SystaxFromSQL, here the instructions:
ls_dw = Sqlca.SyntaxFromSQL(ls_query,"Style(Type=Form)",ls_err)
if Len(ls_err) > 0 then
MessageBox("Error Syntax", ls_err, StopSign!)
Return
end if
dw_boletowinper.CREATE(ls_dw,ls_err)
if Len(ls_err) > 0 then
MessageBox("Error Create", ls_err, StopSign!)
Return
end if
dw_boletowinper.SetTransObject(Sqlca)
So far so good, then I define the page properties:
dw_boletowinper.Object.DataWindow.Print.Orientation = 2 //Vertical
dw_boletowinper.Object.DataWindow.Print.Margin.Top = 3
dw_boletowinper.Object.DataWindow.Print.Margin.Bottom = 3
dw_boletowinper.Object.DataWindow.Print.Margin.Right = 3
dw_boletowinper.Object.DataWindow.Print.Margin.Left = 3
dw_boletowinper.Object.DataWindow.Print.Paper.Size = 1 //Letter size
I define the size of the bands:
dw_boletowinper.modify("DataWindow.Header.Height=0")
dw_boletowinper.modify("DataWindow.Detail.Height=3816")
dw_boletowinper.modify("DataWindow.Summary.Height=0")
dw_boletowinper.modify("DataWindow.Footer.Height=0")
To print i do this:
dw_boletowinper.Object.DataWindow.Printer = "HP LaserJet MFP M232-M237 PCLm"
dw_boletowinper.Object.DataWindow.Print.Page.Range = "1"
dw_boletowinper.Print(True,False)
Visually I retrieve 1 page but when I print, 3 pages are printed, one with data and 2 totally blank.
with data and 2 totally blank
The pagenumber variable in the printpage event is 1.
But the pageprinted variable in the printend event is 3.
I don't understand what is happening, any suggestions?