Topic: Lock *.FR3 file

Hi,

Is it possible to lock (read  Only) some reports file(*.FR3).

My goal is to have template report file can not be modified.
The user can create a copy with different name and create a new report from  the original

Regards,
спасибо

Pierre Perreault
Canada

Re: Lock *.FR3 file

Hello.


You can encrypt a report file and decrypt it when user want to print a report, then the decrypted report file will be deleted automatically.


Example:

var
    REPORT_PATH: string;


// how to encrypt report file
//EncryptFileRC5(REPORT_PATH + 'report.fr3', 'password');
//then rename report.fr3 to report_encrypted.fr3


procedure Form1_bReport_OnClick (Sender: TObject; var Cancel: boolean);
begin
    CopyFile(REPORT_PATH + 'report_encrypted.fr3', REPORT_PATH + 'report.fr3'); //make copy of report file
    DecryptFileRC5(REPORT_PATH + 'report.fr3', 'password');
    Form1.bReport.dbReportFile := 'report.fr3';
end;

procedure Form1_bReport_OnAfterClick (Sender: TObject);
begin
    DeleteFile(REPORT_PATH + 'report.fr3');
end;


begin
    REPORT_PATH := ExtractFilePath(Application.Exename)+'report\'
end.
Dmitry.