2017-05-23 13 views

答えて

0

レポートのDataSourceプロパティを使用してデータを提供する必要があります。 これは、データベースから埋め込まれたDataTableか、IEnumrable <> /オブジェクトのリストです。

report.DataSource = YourItemFactory.GetYourItems(); 

このトピックについては、DX-support pagesを参照してください。

0

XtraReportのドキュメントProvide Data to a Reportをお勧めします。

ここでは、レポートとその要素(計算フィールドとパラメータなど)をvarious kinds of data sourcesに接続する方法を示すデザインタイムチュートリアルとランタイムサンプルを示します。

例:

using System; 
using System.Windows.Forms; 
using System.Collections.Generic; 
using DevExpress.XtraReports.UI; 
// ... 

private void Form1_Load(object sender, EventArgs e) { 
    XtraReport1 report = new XtraReport1(); 
    report.DataSource = CreateData(); 

    ReportPrintTool tool = new ReportPrintTool(report); 
    tool.ShowPreview(); 
} 

private List<Data> CreateData() { 
    List<Data> data = new List<Data>(); 

    Data item1 = new Data(); 
    item1.Date = DateTime.Now; 
    item1.Id = 0; 
    item1.Name = "First"; 
    data.Add(item1); 

    Data item2 = new Data(); 
    item2.Date = DateTime.Now; 
    item2.Id = 1; 
    item2.Name = "Second"; 
    data.Add(item2); 

    Data item3 = new Data(); 
    item3.Date = DateTime.Now; 
    item3.Id = 2; 
    item3.Name = "Third"; 
    data.Add(item3); 

    return data; 
} 

参照:
How to: Bind a Report to a Data Source Schema
How to: Bind a Report to a List Object at Design Time and Provide Data at Runtime

How to: Bind a Report to an Array List
How to: Bind a Report to a Collection that Implements the ITypedList Interface
How to: Bind a Report to an XML File (Runtime Sample)

ご希望の場合は

関連する問題