Example #1
0
int main(int argc, char *argv[] )
{
	QApplication app(argc, argv);
	
	NCReport report;

	//-------------------------------------------
	// 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" );

	QStringList list2;
	list2 << "0000000014|Abkrzung: 005|Ein -->>|Zeitgruppe|<<-- Karenzzeit|";
	list2 << "0000000015|Abkrzung: 010|Zwei -->>|Zeitgruppe|2254112|";
	list2 << "0000000016|Abkrzung: 015|Drei -->>|Zeitgruppe|6998714|";
	
	report.addStringList( list2, "sl1" );


	NCRTestForm window;
	window.setReport( &report );
	window.setReportFile( "../reports/stringlist_demo.xml");

    window.show();

    return app.exec();
}
Example #2
0
void Widget::on_pushButton_clicked()
{
    QStringList list;

    list << "a;a;a;a;a;a"
         << "aa;aa;aa;aa;aa;aa"
         << "aaa;aaa;aaa;aaa;aaa;aaa"
         << "aaaa;aaaa;aaaa;aaaa;aaaa;aaaa"
         << "aaaaa;aaaaa;aaaaa;aaaaa;aaaaa;aaaaa"
         << "aaaaaa;aaaaaa;aaaaaa;aaaaaa;aaaaaa;aaaaaa";


    NCReport *report = new NCReport();

    report->setReportSource( NCReportSource::File );    
    report->setReportFile(":/reports/report.xml");
    report->addStringList(list, "model1");

    report->runReportToPreview();

    if (report->hasError()) {

        qDebug() << "ERROR:" << report->lastErrorMsg();

    } else {

        NCReportPreviewWindow *pv = new NCReportPreviewWindow();
        pv->setOutput( (NCReportPreviewOutput*)report->output() );
        pv->setWindowModality( Qt::ApplicationModal );
        pv->setAttribute( Qt::WA_DeleteOnClose );
        pv->show();
    }

    delete report;
}