popy
asked on
printing stringgrid
hi all, i would like to print stringgrid, what i have do not make job correctly, my grid have linefeed and cariage return in some cells (#13#10), and the procedure i have dont not make it just making some square,, if someone can help me it would appreciate.....
thanks you
thanks you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wow, exactly what i looking for
thanks alot
thanks alot
ASKER
i have a question
i would like to bypass the preview, can i..???
i would like to bypass the preview, can i..???
Yes you should beable to in the options menu...
ASKER
procedure PrintGrid(sGrid: TStringGrid; sTitle: String);
var
X1, X2 : Integer;
Y1, Y2 : Integer;
TmpI : Integer;
F : Integer;
TR : TRect;
begin
Printer.Title:=sTitle;
Printer.BeginDoc;
Printer.Canvas.Pen.Color:=
Printer.Canvas.Font.Name:=
Printer.Canvas.Font.Size:=
Printer.Canvas.Font.Style:
Printer.Canvas.TextOut(0, 100, Printer.Title);
For F:=1 to sGrid.ColCount-1 do begin
X1:=0;
For TmpI:=0 to (F-1) do
X1:=X1+5*(sGrid.ColWidths[
Y1:=300;
X2:=0;
For TmpI:=1 to F do
X2:=X2+5*(sGrid.ColWidths[
Y2:=450;
TR:=Rect(X1, Y1, X2-30, Y2);
Printer.Canvas.Font.Style:
Printer.Canvas.Font.Size:=
Printer.Canvas.TextRect(TR
Printer.Canvas.Font.Style:
For TmpI:=1 to sGrid.RowCount-1 do begin
Y1:=150*TmpI+300;
Y2:=150*(TmpI+1)+300;
TR:=Rect(X1, Y1, X2-30, Y2);
Printer.Canvas.TextRect(TR
end;
end;
Printer.EndDoc;
end;