Dear Stackoverflow users. I am in dire need for help. I have been struggling with the embedded in the Embarcadero XE2 RAD studio edition of FastReport 4.0. and more specifically I have been getting the same error, over and over again, which is the misterious "Class TfrxReport Not found" error. Below I submit a part of the code that causes the problems

procedure TForm1.buildReport(Sender: TObject);
var
 DevicePic, SymbolPic: TfrxPictureView;
 TitleEntry, xmlField: TfrxMemoView;
 MasterDataBand: TfrxMasterData;

begin
if not ADOConnection1.Connected then
       ShowMessage('Cannot build Report! Please, connect to the DB!')
else

try
 //this is where the Class Not Found Exception is Thrown
 frxReport1.LoadFromFile('LibreportTemplate.fr3',True);
 // frxReport1.LoadFromFile('helloInfineonThree.fr3',True);

 if (frxDBDataset1 = nil) then frxDBDataset1 := TfrxDBDataset.Create(Self);
 // connect the report to the DATA
 frxDBDataset1.DataSource := DataSource1;
 frxReport1.DataSet := frxDBDataset1;
 except
     ShowMessage('Error has Occured! Report Template File Not Found!');
 // exit from this procedure!
     Exit;
 end;
 // If no errors have occured, go on building ur report by actually filling it up with data!

 // attach dataSet to the masterdata band of the report.
 MasterDataBand := frxReport1.FindObject('MasterData1') as TfrxMasterData;
 MasterDataBand.DataSet := frxDBDataset1;
 // prepare textfields
 TitleEntry := frxReport1.FindObject('TitleEntry') as TfrxMemoView;
 TitleEntry.DataSet := frxDBDataset1;
 TitleEntry.DataField := 'LibFName';

 xmlField := frxReport1.FindObject('xmlField') as TfrxMemoView;
 // stretch the field if text too big.
 xmlField.StretchMode := TfrxStretchMode.smActualHeight;
 //get the XML DATA FROM THE DB.
 xmlField.DataSet := frxDBDataset1;
 xmlField.DataField := 'LibFXML';

 // prepare images
 DevicePic := frxReport1.FindObject('ImageEntry') as TfrxPictureView;
 DevicePic.DataSet := frxDBDataset1;
 DevicePic.DataField := 'LIBFIMAGE';

 SymbolPic := frxReport1.FindObject('SymbolEntry') as TfrxPictureView;
 SymbolPic.DataSet := frxDBDataset1;
 SymbolPic.DataField := 'LibFSymbol';

 // build and display report
 frxReport1.PrepareReport();
 frxReport1.ShowPreparedReport;

 end;

When building and running the program, I get the following error message "Cannot Find class TfrxReport" and in DebugMode I get the following warning:

Project "MyProject.exe" raised exception class EClassNotFound with message 'Class TfrxReport not Found'.

As commented in the code above, the exception in question is thrown when executing the frxReport1.LoadFromFile('LibreportTemplate.fr3',True); command.

I tried many different approaches for solving the problem, including searching online for a solution. Here is what I did:

Manually create and destroy the frxReport1 object during Form OnCreate and OnClose - ERROR PERSISTS

As suggested in the FastReport ( I couldnt post the link on SO, cause of "Sorry, posts can't contain that content." error) forum thread, replace files in the FastReport 4\LibD16 folder. - ERROR PERSISTS

Recompile FastReport 4 RAD STUDIO 32 bit Version - ERROR PERSISTS Recompile FastReport 4 RAD STUDIO 64 bit Version - ERROR PERSISTS Reinstall Embarcadero RAD Studio and FastReport 4 - ERROR PERSISTS

ASK QUESTION IN STACKOVERFLOW - ????

From the thread in the fast-reports forum, it seems that the problem and the respective solution should be ( I QUOTE) :

This error causes by GroupDescendentsWith(TfrxReport, TControl); code. This code hides TfrxReport from FierMonkey and for some reason "FindClass" function can't find for TfrxReport class when you're loading report(only in IDE). If you can't load report or get similar error with "Couldn't find TfrxReport" message, put this "Link to Files" files to "Fast Report\LibD16" dir (replace all).

However the suggested approach DOES not Solve the problem! What should I do? Does anyone have any idea?

有帮助吗?

解决方案

I've face this issue as well and I've solved it doing this,

  • Create a new ProjectGroup and add DPK's suitable for your delphi version (I use XE6). You'll see the BPL's will divide into runtime and design.
  • Start compiling runtime fsX (X means version), fqbX, and so on. If you make a mistake in the order you will notice. Some package need the search path $(BSDCOMMONDIR)/DCP to be added
  • Compile and install design packages and you'll see the TfrxReport.

You won't see results once design package is installed, I've restarted the IDE and it goes great ;)

With 2 years delay, I hope this could help!

其他提示

Just a thought.

Add RegisterClass(TfrxReport); somewhere on program's startup. Or, right before the line that raises the error.

not sure if you got your answer to this question or not... but I was having the same issue in Rad Studio XE4, using Fast Reports 4.0 Pro.

I had placed my report in a data module, which I could create / destroy when needed, and the datasets were found in there as well. I could place a BarCode element in the report designer, however, when running the application, I would get "Cannot find class TfrxBarCodeView".

After a search of the Source folder found in C:\Program Files (X86)\Fast Reports\source\ I opened a source file called frxBarcode.pas which contained the creation of the class "TfrxBarCodeView".

I simply added frxBarCode to my uses list, and all worked perfectly!

I would start by 1

  1. putting an absolute, full path to the fr3 file, and
  2. place it in the user's document directory,

just to rule out file access issues. Do you have the source code to FastReport?

I know this is old but to somebody it might come useful. I just run into similar problem. It never occurred to me there is a component on the palette of Fast Reports called frxReportTableObject. Just drop it on the form in question.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top