printingc++builderquickreports

QuickReport composite report preview size


Contrary to a simple TQuickRep, the TQRCompositeReport component doesn't have the PreviewInitialState property to control the preview size.

Is there any way to preview a composite report maximized?

(the default state is wsNormal)


Solution

  • Use the TQRCompositeReport::OnFinished event:

    #include "QuickRpt.hpp"
    #include "QRPrev.hpp"
    
    void __fastcall TForm1::QRCompositeReportFinished(TObject *Sender)
    {
      for(int i(0); i < Screen->FormCount; ++i)
        if (Screen->Forms[i]->ClassNameIs("TQRStandardPreview"))
          static_cast<TQRStandardPreview *>(Screen->Forms[i])->WindowState = wsMaximized;
    }