Ver Mensaje Individual
  #7  
Antiguo 16-09-2004
teletranx teletranx is offline
Miembro
 
Registrado: feb 2004
Ubicación: Chile
Posts: 112
Reputación: 21
teletranx Va por buen camino
Talking

En zrEspace.pas

const
EscapeChar: Char = '\';
EscapeSpecifiers: TZREscapeSpecifiers =
('@', '=', 'P', 'E', 'C', 'c', 'B', 'b', 'I', 'i', 'U', 'u', 'H', 'h', 'L', 'l', '<', '>', '{', '}');
// Nuevo
Var
Contador : Integer;
Cadena : String;
Sw : Boolean;
LargoPagina : Integer;

// Cambios
procedure TZREscapeStream.WriteString(const Value: String);
var
e: TZREscapeCode;
S: String;
begin
S:= Value;
for e:= Low(TZREscapeCode) to High(TZREscapeCode) do
S:= StringReplace(S, EscapeChar + EscapeSpecifiers[e], Escapes[e], [rfReplaceAll]);
if (S = #$15) and Sw and (LargoPagina <= Contador)then
Begin
Contador := 0;
Cadena := '';
Sw := False;
End;
Contador := Contador + 1;
if Contador < 4 then
Begin
if S = #$15 then
S := #$C;
Cadena := Cadena + S;
End;
if (Contador > 2) And (not Sw) then
Begin
Sw := True;
S := Cadena;
end;
if S = #$15 then
S := '';
if Sw then
inherited WriteString(S);
end;


En zrPrntr.pas

procedure TZRPrinter.Cleanup;
var
p : TZRPage;
begin
Cancel;
while PageCountY > 0 do begin
p := TZRPage(fPages.Last);
fPages.Remove(p);
p.Free;
end;
ZREscape.Contador := 0;
ZREscape.Cadena := '';
ZREscape.Sw := False;
fPageCount := 0;
fCurrentY := -1;
fCurrentX := -1;
fStatus := zpsReady;
end;


function TZRPrinter.Setup: Boolean;
begin
with TfmPrinterSetup.Create(Application) do
try
ZREscape.Contador := 0;
ZREscape.Cadena := '';
ZREscape.Sw := False;
ZREscape.LargoPagina := Report.PageHeight;
with FormPrintCommonDialog do begin
Options := [poPrintToFile,poPageNums,poWarning];
MinPage := 1;
MaxPage := PageCount;
Copies := Self.Options.Copies;
Collate := True;
FromPage := Self.Options.PageFrom;
ToPage := Self.Options.PageTo;
if (FromPage > MinPage) or
(ToPage < MaxPage) then
PrintRange := prPageNums
else
PrintRange := prAllPages;
PrintToFile := Self.Options.Destination = zrdFile;
end;
cbConvertToOEM.Checked := Self.Options.OEMConvert;
cbIgnoreFontStyles.Checked := Self.Options.IgnoreStyles;
cbEscapeModel.ItemIndex := Integer(Self.Options.Escapes.Model);
Result := FormPrintCommonDialog.Execute;
if Result then begin
with FormPrintCommonDialog do begin
Self.Options.PageFrom := FromPage;
Self.Options.PageTo := ToPage;
Self.Options.Copies := Copies;
end;
Self.Options.OEMConvert := cbConvertToOEM.Checked;
Self.Options.IgnoreStyles := cbIgnoreFontStyles.Checked;
Self.Options.Escapes.Model := TZREscapeModel(cbEscapeModel.ItemIndex);
if FormPrintCommonDialog.PrintToFile then begin
Self.Options.Destination := zrdFile;
with TSaveDialog.Create(Application) do
try
Filter := LoadStr(szrFileFilter);
Options := Options + [ofOverwritePrompt,ofPathMustExist];
//FileName := Self.Options.FileName;
FileName := Self.Report.FileName;
Result := Execute;
if Result then Self.Options.FileName := FileName;
finally
Free;
end;
end else
Self.Options.Destination := zrdPrinter;
end;
finally
Free;
end;
...
...
end;

En la Aplicación en los códigos escape del del zReport

en

+ Optiones
+ Escapes
PageFinish #21 con el cual controlo el salto de página entre hojas



Saludos Juan Carlos
Responder Con Cita