I’ve read the guide that came with the NCReports installer, looked at the demos inside it too but I just cannot understand on how to make it work…
What I did was:
Design a report in NCReport Designer
Tried to integrate it into my .pro file
but when I try to run it, the preview shows nothing..
This is the part of the code when I use NcReport. I used the same test data and the same report file as in the demo but it still shows nothing…
void ChairMenu::on_generateFacListReport_clicked()
{
NCReport *report = new NCReport();
//-------------------------------------------
// TEST STRINGLIST DATASOURCE
//-------------------------------------------
QStringList list;
list << "24\tRenate Moulding\tDesert Hot Springs,CA\t1\t2008-01-01";
list << "78\tAlfred Muller\tMiami Beach, FL\t1\t2008-01-03";
list << "140\tAngela Merkel\tMunchen, Germany\t1\t2008-01-07";
list << "139\tBob Larson\tDallas, TX\t0\t2008-01-20";
report->addStringList( list, "sl0" );
report->setReportFile( "C:\Program Files\NCReport\2.8.7.MinGW.eval\reports\stringlist_demo.xml");
report->runReport();
NCReportOutput *output = new NCReportPreviewOutput();
output->setAutoDelete( FALSE );
report->setOutput( output );
report->runReportToPreview();
NCReportPreviewWindow *pv = new NCReportPreviewWindow();
pv->setReport( report );
pv->setOutput( (NCReportPreviewOutput*)output );
pv->setWindowModality(Qt::ApplicationModal );
pv->setAttribute( Qt::WA_DeleteOnClose );
pv->show();
}
↧