public override void Execute(object parameter) { if (parameter == null) throw new ArgumentNullException("parameter"); FileTemplateResult result = (FileTemplateResult)parameter; var openedFile = result.NewOpenedFiles.Single(); var wizardViewModel = new ReportWizardContext(); var reportWizard = new ICSharpCode.Reporting.Addin.ReportWizard.Dialog.ReportWizard(wizardViewModel); reportWizard.ShowDialog(); if (reportWizard.DialogResult.HasValue && reportWizard.DialogResult.Value){ LoggingService.Info("ReportWizard - CreateReport"); var rg = new ReportGenerator(); rg.Generate(wizardViewModel); string xml = CreateFormSheetFromModel.ToXml(rg.ReportModel).ToString(); openedFile.SetData(Encoding.UTF8.GetBytes(xml)); if (!openedFile.IsUntitled) openedFile.SaveToDisk(); } else { LoggingService.Info("ReportWizard canceled"); // HACK: cancel opening the file by clearing the file list openedFile.CloseIfAllViewsClosed(); result.NewOpenedFiles.Clear(); result.NewFiles.Clear(); } }
public ReportGenerator(ReportWizardContext context) { if (context == null) throw new ArgumentNullException("context"); this.context = context; ReportModel = ReportModelFactory.Create(); }
public ReportWizard(ReportWizardContext context) { InitializeComponent(); this.context = context; baseSettingsPage = new BaseSettingsPage(); _wizard.Items.Insert(1,baseSettingsPage); }
void CreateDataReport(ReportWizardContext context) { GenerateBaseSettings(context); CreateReportHeader(context); CreatePageHeader(context); CreateDetailsSection(context); CreatePageFooter (context); }
void GenerateBaseSettings (ReportWizardContext context) { var pageOneContext = (PageOneContext)context.PageOneContext; var reportSettings = ReportModel.ReportSettings; reportSettings.DataModel = pageOneContext.DataModel; reportSettings.FileName = pageOneContext.FileName; reportSettings.Landscape = !pageOneContext.Legal; reportSettings.ReportName = pageOneContext.ReportName; reportSettings.ReportType = pageOneContext.ReportType; }
public void Generate(ReportWizardContext context) { if (context == null) throw new ArgumentNullException("context"); if (IsDataReport(context)) { CreateDataReport (context); } else { CreateFormSheetReport(context); } }
void CreateDetailsSection(ReportWizardContext context){ var pushModelContext = (PushModelContext)context.PushModelContext; foreach (var element in pushModelContext.Items) { var dataItem = new BaseDataItem(){ Name = element.ColumnName, Text = element.ColumnName, ColumnName = element.ColumnName, DataType = element.DataTypeName }; ReportModel.DetailSection.Items.Add(dataItem); } AdjustItems(ReportModel.DetailSection.Items,startLocation); }
public override void Run() { var wizardViewModel = new ReportWizardContext(); var reportWizard = new ICSharpCode.Reporting.Addin.ReportWizard.Dialog.ReportWizard(wizardViewModel); reportWizard.ShowDialog(); if (reportWizard.DialogResult.HasValue && reportWizard.DialogResult.Value){ LoggingService.Info("ReportWizard - CreateReport"); var rg = new ReportGenerator(); rg.Generate(wizardViewModel); ReportModel = rg.ReportModel; } else { Canceled = true; } }
void CreateReportHeader(ReportWizardContext context){ var pageOneContext = (PageOneContext)context.PageOneContext; var headerText = new BaseTextItem(); headerText.Text = String.IsNullOrEmpty(pageOneContext.ReportName) ? GlobalValues.DefaultReportName : pageOneContext.ReportName; var xLoc = (ReportModel.ReportSettings.PrintableWidth() - headerText.Size.Width) / 2; headerText.Location = new Point(xLoc,4); ReportModel.ReportHeader.Items.Add(headerText); xLoc = ReportModel.ReportSettings.PrintableWidth() - GlobalValues.PreferedSize.Width - 20; var dateText = new BaseTextItem(){ Text ="= Today.Today", Location = new Point(xLoc ,10) }; ReportModel.ReportHeader.Items.Add(dateText); }
void CreateDetailsWithRow(ReportWizardContext context) { var pushModelContext = (PushModelContext)context.PushModelContext; var row = new BaseRowItem(){ Location = new Point(5,5), Size = new Size(ReportModel.ReportSettings.PrintableWidth() - 10,GlobalValues.PreferedSize.Height * 2) }; var list = CreateItems(pushModelContext); row.Items.AddRange(list); ReportModel.DetailSection.Items.Add(row); }
void CreateDataReport(ReportWizardContext context) { ReportModel.ReportSettings = GenerateBaseSettings(context); CreateReportHeader(context); CreatePageHeader(context); //CreateDetailsSection(context); CreateDetailsWithRow(context); CreatePageFooter (); }
static bool IsDataReport(ReportWizardContext context) { var poc = (PageOneContext)context.PageOneContext; return poc.ReportType.Equals(ReportType.DataReport); }
// void CreatePageFooter(ReportWizardContext context) { var pageOneContext = (PageOneContext)context.PageOneContext; var lineNrField = new BaseTextItem() { Text = "='Page : ' + Globals!PageNumber + ' of ' + Globals!Pages + ' Page(s)'", Name = "LineNumber", Location = new Point(300,10), Size = new Size (GlobalValues.PreferedSize.Width * 2,GlobalValues.PreferedSize.Height) }; ReportModel.PageFooter.Items.Add(lineNrField); }
void CreatePageHeader(ReportWizardContext context) { var pushModelContext = (PushModelContext)context.PushModelContext; foreach (var element in pushModelContext.Items) { var dataItem = new BaseTextItem(){ Name = element.ColumnName, Text = element.ColumnName }; ReportModel.PageHeader.Items.Add(dataItem); } AdjustItems(ReportModel.PageHeader.Items,startLocation); var line = new BaseLineItem(){ Location = new Point(2,35), FromPoint = new Point(1,1), ToPoint = new Point(ReportModel.ReportSettings.PrintableWidth() -10,1), Size = new Size (ReportModel.ReportSettings.PrintableWidth() -5,5) }; ReportModel.PageHeader.Items.Add(line); }
static bool IsDataReport(ReportWizardContext context) { var poc = (PageOneContext)context.PageOneContext; // return poc.ReportType.Equals(ReportType.DataReport); return poc.DataModel != PushPullModel.FormSheet; }
void CreateReportHeader(ReportWizardContext context) { var pageOneContext = (PageOneContext)context.PageOneContext; var centerLocation = DesignerHelper.AlignCenter(ReportModel.ReportSettings.PrintableWidth(),GlobalValues.PreferedSize.Width); var headerText = new BaseTextItem(){ Text = String.IsNullOrEmpty(pageOneContext.ReportName) ? GlobalValues.DefaultReportName : pageOneContext.ReportName, Location = new Point(centerLocation,10) }; ReportModel.ReportHeader.Items.Add(headerText); var xLoc = DesignerHelper.AlignRight( ReportModel.ReportSettings.PrintableWidth(),GlobalValues.PreferedSize.Width) - 5; var dateText = new BaseTextItem(){ Text ="= Today.Today", Location = new Point(xLoc ,10) }; ReportModel.ReportHeader.Items.Add(dateText); }
public ReportWizard(ReportWizardContext context) { InitializeComponent(); this.context = context; }
void CreateFormSheetReport(ReportWizardContext context) { GenerateBaseSettings(context); CreateReportHeader(context); }
void CreateDetailsSection(ReportWizardContext context) { var pushModelContext = (PushModelContext)context.PushModelContext; var list = CreateItems(pushModelContext); ReportModel.DetailSection.Items.AddRange(list); }