C1FlexReport _flexReport;
IList<Object> Data { get; set; }
public CollectionFormPrint(IList<Object> CollectionFormPrintList)
{
InitializeComponent();
Data = CollectionFormPrintList;
Loaded += CollectionFormPrint_Loaded;
}
private void CollectionFormPrint_Loaded(object sender, RoutedEventArgs e)
{
Loaded -= CollectionFormPrint_Loaded;
// 第一步 :找到报表 report
// 定义报表
_flexReport = new C1.WPF.FlexReport.C1FlexReport();
// 第二步 自定义数据源
// 获取自定义数据源对象 IList
IList<Object> PPrints = Data;
// 加载报表定义(在设置数据源之前)
Assembly asm = Assembly.GetExecutingAssembly();
using (Stream stream = asm.GetManifestResourceStream("Dlims2.Client.Report.DataSource.CollectionForm.flxr"))
_flexReport.Load(stream, "CollectionForm");
// Report11 是ReportName
// 在c1flexReport组件中使用自定义数据源对象
_flexReport.DataSource.Recordset = PPrints;
// 第三步 : 加载报表: 通过viewer的DocumentSource属性来加载报表
FV.DocumentSource = null; /*刷新*/
FV.DocumentSource = _flexReport;
FV.FocusPane();
} |