作成日: 2026/03/25 最終更新日: 2026/03/25
文書種別
使用方法
詳細
XML形式のセクションレポート(.rpx)は、ページレポート/RDLレポート(.rdlx)と同様に、ファイル名を指定することで表示できます。
// 初期表示
viewer = GrapeCity.ActiveReports.JSViewer.create({
element: '#viewerContainer',
reportID: 'SectionReport1.rpx'
});
// 表示変更
viewer.openReport("SectionReport2.rpx");
コード形式のセクションレポート(.cs/.vb)を表示する場合は、レポートクラスが属する名前空間をUseCodeBasedSectionReportsメソッドで登録する必要があります。
StartupクラスのConfiguration(ASP.NET Coreの場合はConfigure)に以下の記述を追加してください。
public void Configuration(IAppBuilder app)
{
app.UseReportViewer(settings => {
var thisAssembly = this.GetType().Assembly;
var reportsNamespace = this.GetType().Namespace + ".Reports";
// XML形式のレポート(埋め込みリソース)の格納先を指定
settings.UseEmbeddedTemplates(reportsNamespace, thisAssembly);
// コード形式のレポートが属する名前空間を指定
settings.UseCodeBasedSectionReports(thisAssembly, reportsNamespace);
});
(既存の処理)
}呼び出し側(JavaScript)ではクラス名のみを指定します。
viewer.openReport("SectionReport1");
※制限事項
UseCodeBasedSectionReportsメソッドを複数回実行した場合、最後に登録した名前空間のみが有効になります。複数の名前空間を登録することはできません。