QtアプリケーションでNCReportを簡単に統合して使用する方法

NCReportは、Qtに基づくクロスプラットフォームアプリケーションおよびUIフレームワークです。これは、強力で高速、マルチプラットフォーム、使いやすいレポートエンジンライブラリ、レポートジェネレータ、レポートデザイナー、レポートレコーダー、レポートツール、およびC ++で記述されたレポートソリューションです。Qtレポートエンジン、Qtレポートツール、Qtレポートライブラリなどをお探しの場合は、NCReportが最適です。また、NCReportはQt5およびQt4と互換性があります。

このシステムは、レポートプレゼンテーションライブラリとレポートデザイナGUIアプリケーションの2つの部分で構成されています。レポートエンジンは、個別に使用および実装できます。レポートテンプレートのファイル形式はXML形式であり、テンプレートはファイル、文字列、またはsqlデータベースからロードできます。システムは、ダイレクトプリンター、内部プレビューウィンドウ、ポストスクリプト、PDF、SVG、画像、テキスト、HTMLなど、さまざまなタイプの出力を生成できます。レポートデザイナを使用すると、レポートXML定義を非常に簡単に作成できます。

NCReportがバージョン2.23.4に更新され、いくつかのマイナーなバグが修正されました。興味のある方は、ダウンロードして体験してください〜

[Huidu.com] NCReportの最新の試用版をダウンロードする

レポートソリューションNCReportをバージョン2.23.3に更新|添付のダウンロード

エンジニアリングファイル

QT + =コア
GUIgreaterThan(QT_MAJOR_VERSION、4):QT + =ウィジェットprintsupport

TARGET = MySimpleDemo
TEMPLATE = app
SOURCES + = main.cpp

win32:CONFIG(release、debug | release):LIBS + = -L $$ PWD /../ ncreport / lib / -lNCReport2
else:win32:CONFIG(debug、debug | release):LIBS + = -L $$ PWD /../ncreport/lib/ -lNCReportDebug2

INCLUDEPATH + = $$ PWD /../ ncreport / includes
プレビューウィンドウにレポートを実行する1

int main(int argc、char * argv [])
{
QApplication a(argc、argv);

NCReport *report = new NCReport();

report->setReportSource( NCReportSource::File ); // set report source type
report->setReportFile("myreport.ncr"); //set the report filename fullpath or relative to dir
report->runReportToPreview(); // run to preview output

// error handling
if( report->hasError())
{
    QMessageBox msgBox;
    msgBox.setText(QObject::tr("Report error: ") + report->lastErrorMsg());
    msgBox.exec();
}
else
{
    // show preview
    NCReportPreviewWindow *pv = new NCReportPreviewWindow();    // create preview window
    pv->setOutput( (NCReportPreviewOutput*)report->output() );  // add output to the window
    pv->setReport(report);
    pv->setWindowModality(Qt::ApplicationModal );    // set modality
    pv->setAttribute( Qt::WA_DeleteOnClose );    // set attrib
    pv->exec();  // run like modal dialog
}
delete report;

}
プレビューウィンドウでレポートを実行します。2intmain
(int argc、char * argv [])
{
QApplication a(argc、argv);

NCReport *report = new NCReport();
report->setReportFile("myreport.ncr"); //set the report filename fullpath or relative to dir
report->runReportToShowPreview(); // run and show to preview output

// error handling
if( report->hasError())
{
    QMessageBox msgBox;
    msgBox.setText(QObject::tr("Report error: ") + report->lastErrorMsg());
    msgBox.exec();
}
delete report;

}
レポートをPDFとして生成しますintmain
(int argc、char * argv [])
{
QApplication a(argc、argv);

NCReport *report = new NCReport();
report->setReportFile("myreport.ncr"); //set the report filename fullpath or relative to dir
report->runReportToPDF("c:/temp/myreportoutput.pdf")

// error handling
if( report->hasError())
{
    QMessageBox msgBox;
    msgBox.setText(QObject::tr("Report error: ") + report->lastErrorMsg());
    msgBox.exec();
}
delete report;

}
**本物のNCReportライセンスを知りたい、または購入したい友人は、Huiduオンラインカスタマーサービスに相談してください。

おすすめ

転載: blog.51cto.com/14874181/2576871