组装使用编译的Stimulsoft报表(代码示例)

作者:mayz    来源:Stimulsoft    浏览:Loading...      日期:2012-11-06

Stimulsoft报表设计器中,你可以将报表以集合的形式(DLL-file)组装起来。要在应用程序中使用报表,添加以下代码:

C#
StiReport report = StiReport.GetReportFromAssembly("MyReport.dll", true);

VB
Dim Report As StiReport = StiReport.GetReportFromAssembly("MyReport.dll")

另外,你也可以在第一次访问时编译报表,在下次使用时你就可以使用已被编译的报表。请参考以下代码:

C#
string reportName = "MyReport.mrt";
string reportDllName = "MyReport.dll";
StiReport report = null;
// if report dll is not exists ...
if (!File.Exists(reportDllName))
{
// load report definition
report = new StiReport();
report.Load(reportName);
// compile report, save dll version of report
report.Compile(reportDllName);
}
else // if report assembly is available …
{
// … use it
report = StiReport.GetReportFromAssembly(reportDllName);
}

VB
Dim ReportName As String = "MyReport.mrt"
Dim ReportDllName As String = "MyReport.dll"
Dim Report As StiReport = Nothing
' if report dll is not exists ...
If Not File.Exists(ReportDllName) Then
' load report definition
Report = New StiReport
Report.Load(ReportName)
' compile report, save dll version of report
Report.Compile(ReportDllName)
Else
' if report assembly is available …
Report = StiReport.GetReportFromAssembly(ReportName)
End If

 

Stimulsoft Reports详情Stimulsoft Reports全功能版本

Tag标签:.Net报表 Stimulsoft Reports.Net 

本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:Stimulsoft中文网 [http://www.Stimulsoft.cn/]
本文地址: http://www.Stimulsoft.cn/Resources/doc/134.html

上一篇: 如何访问Stimulsoft Reports变量值(代码示例)

下一篇: 四款.Net报表控件对比评测