home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / TEXTLIST.CPP < prev    next >
C/C++ Source or Header  |  1997-02-14  |  2KB  |  56 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1997 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl\vcl.h>
  7. #include <vcl\system.hpp>
  8. #pragma hdrstop
  9.  
  10. #include "TextList.h"
  11. //---------------------------------------------------------------------------
  12. #pragma resource "*.dfm"
  13. TTextRep *TextRep;
  14. //---------------------------------------------------------------------------
  15. __fastcall TTextRep::TTextRep(TComponent* Owner)
  16.   : TForm(Owner)
  17. {
  18. }
  19. //---------------------------------------------------------------------------
  20. void __fastcall TTextRep::RepAfterPrint(TObject *Sender)
  21. {
  22.    //ShowMessage("Under Contruction");
  23.    fclose(aFile);
  24. }
  25. //---------------------------------------------------------------------
  26. void __fastcall TTextRep::RepBeforePrint(bool &PrintReport)
  27. {
  28.     TOpenDialog *aOpenDialog = new TOpenDialog(this);
  29.  
  30.      aOpenDialog->Filter ="C++ files (*.CPP)|*.CPP|Text files (*.TXT)|*.TXT";
  31.     // aOpenDialog->Options<<ofFileMustExist;
  32.  
  33.       if  (!aOpenDialog->Execute())
  34.        PrintReport=false;
  35.       else  {
  36.          aFile=fopen((aOpenDialog->FileName).c_str() , "a+");
  37.          Rep->ReportTitle=aOpenDialog->FileName;
  38.          }
  39.       delete aOpenDialog;
  40.  
  41. }
  42. //---------------------------------------------------------------------
  43. void __fastcall TTextRep::RepNeedData(bool &MoreData)
  44. {
  45.  AnsiString Line;
  46.  char  s[500];
  47.    if (!feof(aFile))
  48.    {
  49.       fgets(s,501,aFile);
  50.       Line=AnsiString(s);
  51.       QRLabel1->Caption=Line;
  52.       MoreData=True;
  53.    }
  54.    else MoreData=False;
  55. }
  56. //---------------------------------------------------------------------