PDA

Ver la Versión Completa : problemas al exportar un qreport con techart a pdf


tefots
14-11-2007, 12:11:17
estoy intentando exportar a pdf unos reports realizados con qreport 4.x .

el problema que tengo esque estos reports tienen graficos teechart , y cuando exporto a pdf , los graficos no son exportados , es decir, desaparecen , tambien pasa lo mismo si exporto a html o a word.

alguien sabe como solucionarlo ?.


saludos.

tefots
15-11-2007, 09:37:30
bueno , me respondo a mi mismo , ya se como solucionar el problema

la solucion es exportar el teechart a un qrimage ,



Meta := chart1.chart.TeeCreateMetafile(True,chart1.Chart.GetRectangle);
Try
qrimage1.Picture.Metafile.Assign(Meta);
finally
Meta.Free;
end;

ahora estoy intentando que automáticamente , al llamar a la siguiente funcion , en todos los reports que tengo , que me cree los qrimages que hagan falta dinamicamente , exportando todos los tqrcharts que existan en el qreport y asignandolos al qrimage que he creado dinamicamente.

pero algo va mal , no entiendo que pasa , pero el report casca y da un access violation al imprimir la banda.

aqui pongo la funcion , por si alguien me puede ayudar.
( si le quito el RtfImage.Parent:=banda ya no casca , pero no funciona).
sin embargo si creo los qrimages en diseño si funciona.



Procedure TrepDetalleDiario.CreaQrChartImagenes(Banda:TqrCustomBand);
var i:integer;
RtfImage:TQRImage;
Meta: TMetaFile;
Begin
for i:=0 to SELF.ComponentCount-1 do begin
if SELF.Components[i] is TQRChart then begin
RtfImage:=TQRImage.Create(banda);
RtfImage.ParentReport:=self;
RtfImage.Parent:=banda;
RtfImage.Enabled:=True;
RtfImage.visible:=true;
RtfImage.size.Width:=TQRChart(Self.Components[i]).Size.Width;
RtfImage.size.Height:=TQRChart(Self.Components[i]).size.Height;
RtfImage.size.Top:=TQRChart(Self.Components[i]).size.Top;
RtfImage.size.Left:=TQRChart(Self.Components[i]).size.Left;
RtfImage.Width:=TQRChart(Self.Components[i]).Width;
RtfImage.Height:=TQRChart(Self.Components[i]).Height;
RtfImage.Top:=TQRChart(Self.Components[i]).Top;
RtfImage.Left:=TQRChart(Self.Components[i]).Left;
Meta := TQRChart(SELF.Components[i]).Chart.TeeCreateMetafile(True,TQRChart(SELF.Components[i]).Chart.GetRectangle);
Try
RtfImage.Picture.Metafile.Assign(Meta);
finally
Meta.Free;
end;
end;
End;
End;



la funcion la llamo desde aqui


procedure TRepDetallediario.QRBand2BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
CreaQrChartImagenes(sender);
end;



alguien sabe que estoy haciendo mal ?

Saludos