Hola, estoy tratando de mostrar un reporte, basado en el componente frxReport de FastReport (Recomplie FAstReport 6 VCL Enterprise) en Embarcadero C++ Builder 10.2 usando el origen de datos de un componente DBGrid.
El problema está después de compilar el formulario y al ejecutar la llamada al frxReport, que no muestra los campos con los datos definidos:
¿Por favor, alguien me pudiera ayudar a resolver este problema u otra solución posible?
Muchas gracias.
Saludos.
Previamente he incluido el uso de las clases necesarias para acceder al origen de datos.
….
Código:
#include "frxClass.hpp"
#include "frxClass.hpp"
#include "frxDBSet.hpp"
#include "DB.hpp"
….
Seguidamente, muestro el código con la llamada al frxReport.
Código:
void __fastcall TForm3::BitBtn2Click(TObject *Sender)
{
TfrxDataPage * DataPage;
TfrxReportPage * Page;
TfrxBand * Band;
TfrxMasterData * DataBand;
TfrxMemoView * Memo;
TfrxDBDataset *frxDataSet=new TfrxDBDataset(this);
TfrxReportDataSets *frxDBDataset1=new TfrxReportDataSets(frxReport1);
TfrxDataSet *frxDataset1=new TfrxDataSet(this);
frxDataSet->DataSet=DBGrid14->DataSource->DataSet;
frxReport1->DataSet=frxDataSet;
frxDBDataset1=frxReport1->DataSets;
frxDataset1=frxReport1->DataSet;
DataPage = new TfrxDataPage(frxReport1);
// add a page
Page = new TfrxReportPage(frxReport1);
// create a unique name
Page->CreateUniqueName();
// set sizes of fields, paper and orientation by default
Page->SetDefaults();
// modify paper’s orientation
Page->Orientation = poLandscape;
// add a report title band
Band = new TfrxReportTitle(Page);
Band->CreateUniqueName();
// it is sufficient to set the «Top» coordinate and height for a band
// both coordinates are in pixels
Band->Top = 0;
Band->Height = 20;
// add an object to the report title band
Memo = new TfrxMemoView(Band);
Memo->CreateUniqueName();
Memo->Font->Size=14;
Memo->Text = "Title of Report";
Memo->Height = 20;
// this object will be stretched according to band’s width
Memo->Align = baWidth;
// add the masterdata band
DataBand = new TfrxMasterData(Page);
DataBand->CreateUniqueName();
DataBand->DataSet = frxDataSet;
// the Top coordinate should be greater than the previously added band’s top + height
DataBand->Top = 100;
DataBand->Height = 20;
// add an object on master data
Memo = new TfrxMemoView(DataBand);
Memo->CreateUniqueName();
// connect to data
Memo->DataSet = frxDataSet;
Memo->DataField = "Equipo";
Memo->SetBounds(0, 0, 100, 20);
Memo->DataField = "NormaDeTiempo";
Memo->SetBounds(105, 0, 100, 20);
Band=new TfrxBand(Band);
Memo->CreateUniqueName();
// adjust the text to the right object’s margin
Memo->HAlign = haRight;
Memo->Color=clBlack;
// show the report
frxReport1->PrepareReport();
frxReport1->ShowReport(true);
}