/// <summary> /// 填充数据,获取报表 /// </summary> /// <param name="reportFile">报表文件</param> /// <param name="printerIndex">打印机索引</param> /// <param name="para">报表参数</param> /// <param name="datasource">报表数据源</param> /// <returns></returns> public static GridReport GetReport(string reportFile, int printerIndex, Dictionary <string, Object> para, DataTable datasource) { reportFile = EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + @"Report\\" + reportFile; //报表文件不存在创建空的报表格式 GridReport report = new GridReport(reportFile, para, datasource); report.Report.Printer.PrinterName = CustomConfigManager.GetPrintName(printerIndex); return(report); }
public GridReport(string reportfile, Dictionary <string, Object> para, DataTable datasource) { _datasource = datasource; Report = new GridppReport(); //载入报表模板 Report.LoadFromFile(reportfile); if (para != null) { GridReport.AddParamToReport(Report, para); } //连接报表事件 Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(ReportInitialize); Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecord); }
//在C#中一次填入一条记录不能成功,只能使用一次将记录全部填充完的方式 private void ReportFetchRecord() { //将全部记录一次填入 //Report.DetailGrid.Recordset.Append(); //FillRecord1(); //Report.DetailGrid.Recordset.Post(); //Report.DetailGrid.Recordset.Append(); //FillRecord2(); //Report.DetailGrid.Recordset.Post(); //Report.DetailGrid.Recordset.Append(); //FillRecord3(); //Report.DetailGrid.Recordset.Post(); if (_datasource != null) { GridReport.FillRecordToReport(Report, _datasource); } }