Home General

Printing to text file but with a .csv extension

Hi,
With previous versions of ReportBuilder, we could print to file , eg, Report.csv.
Now it always prints ( saves ) it to Report.txt, even if Report.csv is the textFileName.

MainReport.textFileType := ftComma;
MainReport.AllowPrintToFile := true;
MainReport.DeviceType := dtTextFile;
MainReport.TextFileName := 'C:\Reports\Report.csv';

The file created is C:\Reports\Reports.txt.

How can I get it to be C:\Reports\Reports.csv?

Thanks,
AL

Comments

  • Hi Al,

    Which version of ReportBuilder are you using? This was an issue that was fixed for a much earlier version and in my testing with the latest version, I was able to successfully export to alternate file extensions.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Hi Nico,
    Thanks very much for your efforts.
    The version is 19.1
    The report is inherited from a base report.
    Eg, report name is EarningsByDate , inherited from RBShell.

    In the RBShell.pas the coding is
    MainReport.textFileType := ftComma; // default setting anyway.
    MainReport.AllowPrintToFile := true;
    MainReport.TextFileName := 'C:\Reports\Report.csv'; // this name changes with the report, dates, etc.

    Same code as for the older project using RB 7.

    I was setting MainReport.DeviceType := dtTextFile in the EarningsByDate report, but I have now changed that to setting it in the RBShell report.
    All seems to work now. Slight difference I suppose between the versions ( which are years apart to be fair ).
    I also changed the code back in the old project to set deviceType in RBShell and am pleased to say it works too.
    I am thinking what happened was the settings (except for DeviceType) were set in RBShell, then the DeviceType was set in RBEarningsByDate ( default I think is Printer) before .Print was called, which may have caused some other defaults to 'take over'.

    Thanks again for your help.
    Kind Regards,
    Al








  • You have to set the TextFileName every time after you assign (change) DeviceType.
Sign In or Register to comment.