Question

Can we use Active Reports 7.0 in C++/CLI? I have just started using active reports. I tried building a report in C# without any problem. I tried doing the same in C++/CLI, but I am unable to use the Active reports toolbox. And also when running the application, it is giving licensing errors.

Was it helpful?

Solution

The designer that generates code-based won't work with C++/CLI. You also won't be able to write "script" inside the reports with C++. However, you can design reports as the XML-based reports (rpx) instead and then you shouldn't have any problem instantiating and calling on those from C++ via the SectionReport class (for example). Something like the following:

GrapeCity::ActiveReports::SectionReport ^sectionReport = gcnew GrapeCity::ActiveReports::SectionReport();
System::Xml::XmlTextReader ^xtr = new System::Xml::XmlTextReader("..\\..\\rptScript.rpx");
sectionReport->LoadLayout(xtr);
xtr->Close();
viewer1->LoadDocument(sectionReport);
...

Keep in mind ActiveReports users are almost exclusively C# & VB.NET users so you won't find any C++ code samples, but it should be pretty trivial to translate the code from C# to C++/CLI.

The example is based on SectionReport not PageReport, but PageReport is entirely xml-based so it should work easily too.

So to clarify, if you want a C++ only solution, you need to do the following:

Create your reports as XML-based reports (*.rpx files) using the "Standalone" designer application that is installed in the start menu when you install ActiveReports. Since you can save your reports as a standalone, independent .rpx file, you will not need to use any C#/VB.NET DLL. As shown in the code example above, you can just load the .rpx files from a file directly from C++ (for example).

Although this technique does not require any C# or VB.NET DLL/EXE, if you use the scripting feature inside the standalone .rpx report file, the script will have to be either C# or VB script. However, you won't have to compile that yourself, ActiveReports deals with the script internally.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top