Muchas gracias Lepe, poco después de postear encontré la solución. A propósito a continuación vioy a mostrar lo que hago para configurar la página del reporte en tiempo de ejecución, me funciona bien en Windows 98 no lo he probado en otros sistemas operativos
Código Delphi
[-]
procedure TReport.Vistaprevia;
var
Title:string;
I : Integer;
begin
Previ := TPrevi.Create(Self);
Previ.pQuickreport := TQuickRep.Create(Previ);
with Previ.pQuickreport do
begin
Page.Units := MM;
Page.PaperSize := Custom;
Page.Width := 420.0; Page.Length := 270.0; end;
Title:=Edit1.Text;
try
if Campos1.items.Count >0 then
begin
QRCreatelist(TCustomQuickRep(Previ.pQuickreport),Previ,RTabla,Title,Campos1.Items);
try
with Previ.pQuickreport do
begin
with Bands.ColumnHeaderBand do
begin
Font.Size := 12;
Font.Style:= [fsBold];
Frame.DrawBottom := True;
for i := 0 to ControlCount -1 do
if Controls[i] is TQRLabel then
TQRLabel(Controls[i]).Frame.DrawBottom := False;
end;
with Bands.DetailBand do
begin
Font.Size := 12;
for i := 0 to ControlCount -1 do
if Controls[i] is TQRExpr then
begin
Title := TQRExpr(Controls[i]).Expression;
Title := Copy(Title,2,Length(Title)-2);
if ord(RTabla.FieldByName(Title).DataType) = 5 then
begin
TQRExpr(Controls[i]).Alignment := taCenter;
TQRExpr(Controls[i]).OnPrint:= MyOnPrint;
end;
end;
end;
Previ.pQuickreport.OnPreview:= MyPreview;
Previ.pQuickreport.Preview;
end;
finally
end;
end;
finally
end ;
Este código está en fase de depuración, ahora la impementación de MyPreview
Código Delphi
[-]
procedure TReport.MyPreview(Sender : TObject);
begin
with Previ do
begin
Preview.QRPrinter := TQRPrinter(Sender);
Show;
end;
end;
Por último, no me preocupo por el ancho de las columnas pues lo primero que hago es mostrar los campos seleccionados en un DBgrid donde el usuario puede ajustar el ancho de cada campo a su antojo
y es todo, espero que a alguien le sirva si lo que quiere es configurar página, márgenes etc les ser virá esta idea.
Un saludo