Hi all

We are moving to D2009 from D2006 and I have a small problem regarding 
printing with QuickReport.

When I want to call the preview-method I get an EInvalidGraphic with the 
message "Metafile not valid".

It's a simple report with no dynamic parts and just "basic" components.

I can preview it in designmode and I can print it just fine.
It's just the preview in runtime that doesn't work.



This is where it all happens. In the last end else and the call 
"result.LoadFromStream(Stream)".

function TQRPageList.GetPage(PageNumber : integer) : TMetafile;
var
  Dummy : longint;
  TempStream : TMemoryStream;
  aByte : byte;
  BytesToGet : longint;
  I : longint;
begin
  if PageNumber > PageCount then
    result := nil
  else
  try
    LockList;
    SeekToPage(PageNumber);
    Stream.Read(Dummy,SizeOf(Dummy));
    Stream.Read(Dummy,SizeOf(Dummy));
    BytesToGet := BytesToGet-Stream.Position;
    result := TMetafile.Create;
    if Compression then
    begin
      Stream.Read(BytesToGet,SizeOf(BytesToGet));
      TempStream := TMemoryStream.Create;
      aCompressor := TQRCompress.Create(Stream, false);
      for I := 1 to BytesToGet do
      begin
        aCompressor.Expand(aByte);
        TempStream.Write(aByte,1);
      end;
      aCompressor.Free;
      TempStream.Position := 0;
      result.LoadFromStream(TempStream);
      TempStream.Free;
    end else
      result.LoadFromStream(Stream);
    Stream.Read(Dummy, SizeOf(Dummy));
  finally
    UnlockList;
  end;
end;




Anyone who knows something about this?



Somebody has reported a similar problem to Codegear.
http://qc.codegear.com/wc/qcmain.aspx?d=70466

I have tried the solutions mentioned in the bugreport but that doesn't 
solve my problem.


//Jesper
_______________________________________________
Delphi mailing list -> Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to