Sometimes you may need to restrict the users' ability to edit and copy reports. The key is to do it so that they would not even guess that the program uses such a wonderful product as FastReport. Let's talk about how to keep report templates hidden from prying eyes.
The idea is pretty simple: to store report templates inside an executable file, and to extract and execute them when you need it.
First, we will create report files in FastReport VCL and save them to the ReportList directory. Describe the resources through a text file with the following content:
Let’s save the file with the name "TestFR.rc". Then we compile it with the BRCC32 TestFR.rc command and get TestFR.res. You need to add the following string to the beginning of the module:
You can make it easier using the RxLib library. After installing it, the Project Resources item will appear in the View menu. Select Project Resources-> New-> User Data and add the required report files.
Let's write a procedure for extracting the resource we need.
Now let's write a print handler for our report.
Of course, this solution has flaws. The first one is the resource intensity of the program because the executable file increases several times, but packers compress it well. The second is the slow report generation.
The author of the article: Oleg Leontiev Gennadievich