public static ReportModel FormSheetModel() { ReportStructure rs = new ReportStructure(); rs.ReportName = "PlainReport"; rs.GraphicsUnit = System.Drawing.GraphicsUnit.Millimeter; rs.ReportType = GlobalEnums.ReportType.FormSheet; rs.DataModel = GlobalEnums.PushPullModel.FormSheet; ReportModel m = ReportModel.Create(); return(rs.CreateAndFillReportModel()); }
public void FormSheetReport() { ReportStructure rs = new ReportStructure(); rs.ReportName = "PlainReport"; rs.GraphicsUnit = System.Drawing.GraphicsUnit.Millimeter; rs.ReportType = GlobalEnums.ReportType.FormSheet; rs.DataModel = GlobalEnums.PushPullModel.FormSheet; ReportModel m = rs.CreateAndFillReportModel(); Assert.AreEqual("PlainReport", m.ReportSettings.ReportName, "invalid ReportName"); Assert.AreEqual(m.ReportSettings.ReportType, GlobalEnums.ReportType.FormSheet, "ReportModel,ReportSettings.eportType should be 'FormSheet'"); Assert.AreEqual(GlobalEnums.PushPullModel.FormSheet, m.DataModel, "Datamodel should be 'FormSheet'"); }
public static ReportModel CreateModel(string reportName, bool createGrouping) { ReportStructure structure = CreateReportStructure(reportName); AvailableFieldsCollection abstractColumns = new AvailableFieldsCollection(); AbstractColumn a1 = new AbstractColumn("Field1", typeof(System.String)); structure.AvailableFieldsCollection.Add(a1); ICSharpCode.Reports.Core.BaseDataItem bri = new ICSharpCode.Reports.Core.BaseDataItem(); bri.Name = "Field1"; structure.ReportItemCollection.Add(bri); if (createGrouping) { structure.Grouping = "group"; } ReportModel m = structure.CreateAndFillReportModel(); ICSharpCode.Core.Properties customizer = new ICSharpCode.Core.Properties(); customizer.Set("Generator", structure); customizer.Set("ReportLayout", GlobalEnums.ReportLayout.ListLayout); IReportGenerator generator = new GeneratePushDataReport(m, customizer); generator.GenerateReport(); ReportLoader rl = new ReportLoader(); object root = rl.Load(generator.XmlReport.DocumentElement); ReportModel model = root as ReportModel; if (model != null) { model.ReportSettings.FileName = GlobalValues.PlainFileName; FilePathConverter.AdjustReportName(model); } else { throw new InvalidReportModelException(); } return(model); }