1. Adolfo Chairez Gallegos
  2. PowerBuilder
  3. Wednesday, 23 October 2024 17:40 PM UTC

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?

TotalPag

Hoja

Cola

 

Attachments (3)
Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 23 October 2024 18:28 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi, Adolfo -

A blank page when printing a DataWindow is typically caused by DWObjects (even invisible ones) that are outside of the page margins.

If you carefully examine the syntax returned in the ls_dw variable, do you see any column or text DWObjects having X,Y  coordinates and widths that would place the objects outside of a single printed page? You may wish to temporarily write the syntax to a file so that you can examine the syntax with an editor.

If would appear from the image of the printed page that you may be manipulating the DWObjects to produce a more readable report... is that what is going on? If so, you should take case to ensure all objects have been positioned correctly.

Best regards, John

Comment
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.