Fórum Imprimir StringGrid com varias páginas #532169
18/09/2015
0
Alguem pode me ajudar como alterar ou nova rotina para imprimir um stringgrid com o 'zebrado' e todas as páginas?
Tenho a rotina abaixo que imprime perfeitamente para minha aplica~ção,mas só até 40 Rows.
Tenho a rotina abaixo que imprime perfeitamente para minha aplica~ção,mas só até 40 Rows.
var
X1, X2,Pagina,Ymax,BottomMargin: Integer;
Y1, Y2, TopMargin,Y: Integer;
TmpI: Integer;
F: Integer;
TR: TRect;
begin
if not printdialog1.Execute then exit;
Ymax := Printer.PageHeight - BottomMargin;
Printer.Title := StringGrid1.Cells[7,1];
Printer.BeginDoc;
Printer.Canvas.Pen.Color := 0;
Printer.Canvas.Font.Name := 'Times New Roman';
Printer.Canvas.Font.Size := 12;
Printer.Canvas.Font.Style := [fsBold];
Printer.Canvas.TextOut(0, 100, Printer.Title);
TopMargin := 300;
BottomMargin := 300;
Y := TopMargin;
for F := 0 to StringGrid1.ColCount-2 do
begin
X1 := 0;
for TmpI := 0 to (F - 1) do
X1 := X1 + 5 * (StringGrid1.ColWidths[TmpI]);
Y1 := 300;
X2 := 0;
for TmpI := 0 to F do
X2 := X2 + 5 * (StringGrid1.ColWidths[TmpI]);
Y2 := 450;
TR := Rect(X1, Y1, X2 -30, Y2);
Printer.Canvas.Font.Style := [fsBold];
Printer.Canvas.Font.Size := 7;
Printer.Canvas.TextRect(TR, X1 + 5,350, StringGrid1.Cells[F, 0]);
inc(y);
Printer.Canvas.Font.Style := [];
for TmpI := 0 to StringGrid1.RowCount-1 do
begin
Y1 := 150 * TmpI + 300;
Y2 := 150 * (TmpI + 1) + 300;
// if Odd(TmpI) then
// Printer.Canvas.Brush.Color := clBtnFace
// else
Printer.Canvas.Brush.Color := clWhite;
TR := Rect(X1,Y1,X2 - 2, Y2);
Printer.Canvas.TextRect(TR, X1 + 10, Y1 + 50, StringGrid1.Cells[F, TmpI]);
Printer.Canvas.Brush.Color := clBlack;
Printer.Canvas.FrameRect(TR);
Printer.Canvas.Brush.Color := clWhite;
end;
// y:=y+1;
// Caption:=IntToSTr(y);
// if Y > Ymax*8 then begin
// Printer.NewPage;
// Y := TopMargin;
// end;
end;
end;Vtrx
Curtir tópico
+ 0
Responder
Posts
21/09/2015
Raimundo Pereira
Tente criar uma tabela temporária e faça o teste .
Aguardo retorno.
Aguardo retorno.
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)