public override void Render(ReportPageEventArgs rpea) { if (rpea == null) { throw new ArgumentNullException("rpea"); } // Point saveLocation = this.Location; Point currentPosition = new Point(this.startSection.Location.X, this.startSection.Location.Y); Point tableStart = currentPosition; base.Render(rpea); int defaultLeftPos = PrintHelper.DrawingAreaRelativeToParent(this.Parent, this).Left; this.Items.SortByLocation(); rpea.SinglePage.StartRow = this.dataNavigator.CurrentRow; foreach (BaseRowItem row in this.items) { if (row != null) { row.Parent = this; if (PrintHelper.IsTextOnlyRow(row)) { currentPosition = this.PrintTextRow(rpea, row, defaultLeftPos, currentPosition); this.Location = saveLocation; } else { do { if (PrintHelper.IsPageFull(new Rectangle(currentPosition, row.Size), sectionBounds)) { this.Location = saveLocation; rpea.SinglePage.EndRow = this.dataNavigator.CurrentRow; AbstractRenderer.PageBreak(rpea); return; } currentPosition = this.PrintDataRow(rpea, row, defaultLeftPos, currentPosition); }while (this.dataNavigator.MoveNext()); } } } if (this.DrawBorder) { Border border = new Border(new BaseLine(this.ForeColor, System.Drawing.Drawing2D.DashStyle.Solid, 1)); border.DrawBorder(rpea.PrintPageEventArgs.Graphics, new Rectangle(this.Parent.Location.X, tableStart.Y, this.Parent.Size.Width, currentPosition.Y + 5)); } rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, rpea.LocationAfterDraw.Y + 20); base.NotifyAfterPrint(rpea.LocationAfterDraw); }
protected void RenderTable(BaseReportItem parent, ITableContainer tableContainer, ReportPageEventArgs rpea) { if (rpea == null) { throw new ArgumentNullException("rpea"); } Point saveLocation = tableContainer.Location; Point currentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.CurrentSection, tableContainer).Location.X, this.CurrentSection.Location.Y); tableContainer.Items.SortByLocation(); Size rs = Size.Empty; foreach (BaseRowItem row in tableContainer.Items) { if (row != null) { rs = row.Size; PrintHelper.AdjustParent(tableContainer, tableContainer.Items); if (PrintHelper.IsTextOnlyRow(row)) { LayoutHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics, base.Layout, row); Rectangle r = StandardPrinter.RenderContainer(row, Evaluator, currentPosition, rpea); currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r); tableContainer.Location = saveLocation; } else { int adjust = row.Location.Y - saveLocation.Y; row.Location = new Point(row.Location.X, row.Location.Y - adjust - 3 * GlobalValues.GapBetweenContainer); rs = row.Size; do { if (PrintHelper.IsPageFull(new Rectangle(currentPosition, row.Size), this.SectionBounds)) { tableContainer.Location = saveLocation; AbstractRenderer.PageBreak(rpea); return; } this.dataNavigator.Fill(row.Items); LayoutHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics, base.Layout, row); Rectangle r = StandardPrinter.RenderContainer(row, Evaluator, currentPosition, rpea); currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r); row.Size = rs; }while (this.dataNavigator.MoveNext()); } } row.Size = rs; } // base.NotifyAfterPrint (rpea.LocationAfterDraw); }
public void Render(ISimpleContainer table, ReportPageEventArgs rpea, IExpressionEvaluatorFacade evaluator) { if (this.dataNavigator.CurrentRow < 0) { this.dataNavigator.MoveNext(); } this.reportPageEventArgs = rpea; Point saveLocation = table.Location; Rectangle pageBreakRect = Rectangle.Empty; Point currentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.currentSection, table).Location.X, this.currentSection.Location.Y); table.Items.SortByLocation(); Size rs = Size.Empty; ISimpleContainer headerRow = null; var simpleContainer = table.Items[0] as ISimpleContainer; // foreach (BaseRowItem row in table.Items) // { rs = simpleContainer.Size; PrintHelper.AdjustParent(table as BaseReportItem, table.Items); // if (PrintHelper.IsTextOnlyRow(simpleContainer) ) // { PrintHelper.SetLayoutForRow(ReportPageEventArgs.PrintPageEventArgs.Graphics, Layouter, simpleContainer); var r = StandardPrinter.RenderContainer(simpleContainer, evaluator, currentPosition, ReportPageEventArgs); currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r); table.Location = saveLocation; // } // else { //--------------- simpleContainer = table.Items[1] as ISimpleContainer; int adjust = simpleContainer.Location.Y - saveLocation.Y; simpleContainer.Location = new Point(simpleContainer.Location.X, simpleContainer.Location.Y - adjust - 3 * GlobalValues.GapBetweenContainer); rs = simpleContainer.Size; do { pageBreakRect = PrintHelper.CalculatePageBreakRectangle((BaseReportItem)table, currentPosition); if (PrintHelper.IsPageFull(pageBreakRect, this.SectionBounds)) { Console.WriteLine("PageBreak - PageFull"); table.Location = saveLocation; AbstractRenderer.PageBreak(ReportPageEventArgs); return; } this.dataNavigator.Fill(simpleContainer.Items); PrintHelper.SetLayoutForRow(ReportPageEventArgs.PrintPageEventArgs.Graphics, Layouter, simpleContainer); r = StandardPrinter.RenderContainer(simpleContainer, evaluator, currentPosition, ReportPageEventArgs); currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r); simpleContainer.Size = rs; }while (this.dataNavigator.MoveNext()); //----- // } }
public void old_Render(ISimpleContainer table, ReportPageEventArgs rpea, IExpressionEvaluatorFacade evaluator) { if (this.dataNavigator.CurrentRow < 0) { this.dataNavigator.MoveNext(); } this.reportPageEventArgs = rpea; Point saveLocation = table.Location; Rectangle pageBreakRect = Rectangle.Empty; Point currentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.currentSection, table).Location.X, this.currentSection.Location.Y); table.Items.SortByLocation(); Size rs = Size.Empty; foreach (BaseRowItem row in table.Items) { rs = row.Size; PrintHelper.AdjustParent(table as BaseReportItem, table.Items); if (PrintHelper.IsTextOnlyRow(row)) { PrintHelper.SetLayoutForRow(ReportPageEventArgs.PrintPageEventArgs.Graphics, Layouter, row); Rectangle r = StandardPrinter.RenderContainer(row, evaluator, currentPosition, ReportPageEventArgs); currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r); table.Location = saveLocation; } else { int adjust = row.Location.Y - saveLocation.Y; row.Location = new Point(row.Location.X, row.Location.Y - adjust - 3 * GlobalValues.GapBetweenContainer); rs = row.Size; do { pageBreakRect = PrintHelper.CalculatePageBreakRectangle((BaseReportItem)table, currentPosition); if (PrintHelper.IsPageFull(parentRectangle, this.SectionBounds)) { Console.WriteLine("PageBreak - PageFull"); table.Location = saveLocation; AbstractRenderer.PageBreak(ReportPageEventArgs); return; } this.dataNavigator.Fill(row.Items); PrintHelper.SetLayoutForRow(ReportPageEventArgs.PrintPageEventArgs.Graphics, Layouter, row); Rectangle r = StandardPrinter.RenderContainer(row, evaluator, currentPosition, ReportPageEventArgs); currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r); row.Size = rs; }while (this.dataNavigator.MoveNext()); } row.Size = rs; } // base.NotifyAfterPrint (rpea.LocationAfterDraw); }
private void PrintDetailInternal(ReportPageEventArgs rpea, DataNavigator nav) { Rectangle sectionRect; base.PrintDetail(null, rpea); // no loop if there is no data if (!nav.HasMoreData) { rpea.PrintPageEventArgs.HasMorePages = false; return; } ITableContainer tableContainer = base.CurrentSection.Items[0] as ITableContainer; // branch to render table's etc if (tableContainer != null) { tableContainer.DataNavigator = nav; tableContainer.Parent = base.CurrentSection; if (rpea.SinglePage.PageNumber == 1) { tableContainer.StartLayoutAt(base.Sections[2]); } else { tableContainer.StartLayoutAt(base.Sections[0]); } base.RenderTable(base.CurrentSection, tableContainer, rpea); this.ReportDocument.DetailsDone = true; } else { // first element if (base.SinglePage.PageNumber == 1) { this.dataNavigator.MoveNext(); } do { ISimpleContainer simpleContainer = base.CurrentSection.Items[0] as ISimpleContainer; if (simpleContainer != null) { nav.Fill(simpleContainer.Items); } else { nav.Fill(base.CurrentSection.Items); } sectionRect = new Rectangle(rpea.PrintPageEventArgs.MarginBounds.Left, base.CurrentSection.SectionOffset, rpea.PrintPageEventArgs.MarginBounds.Width, base.CurrentSection.Size.Height); if (PrintHelper.IsPageFull(sectionRect, base.SectionBounds)) { PerformPageBreak(rpea); return; } Point currentPosition = base.RenderItems(rpea); if (nav.CurrentRow < nav.Count - 1) { if (base.CurrentSection.PageBreakAfter) { PerformPageBreak(rpea); return; } } base.CurrentSection.SectionOffset = currentPosition.Y; rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, currentPosition.Y); }while (nav.MoveNext()); this.ReportDocument.DetailsDone = true; } rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, rpea.LocationAfterDraw.Y + 5); if (!PrintHelper.IsRoomForFooter(base.SectionBounds, rpea.LocationAfterDraw)) { AbstractRenderer.PageBreak(rpea); } }
private void PrintDetailInternal(ReportPageEventArgs rpea, DataNavigator nav) { Rectangle sectionRect; base.PrintDetail(null, rpea); // no loop if there is no data if (!nav.HasMoreData) { rpea.PrintPageEventArgs.HasMorePages = false; return; } ITableContainer tableContainer = base.CurrentSection.Items[0] as ITableContainer; // branch to render table's etc if (tableContainer != null) { tableContainer.DataNavigator = nav; tableContainer.Parent = base.CurrentSection; tableContainer.ExpressionEvaluatorFacade = base.ExpressionFassade; if (rpea.SinglePage.PageNumber == 1) { tableContainer.StartLayoutAt(base.Sections[2]); } else { tableContainer.StartLayoutAt(base.Sections[0]); } tableContainer.RenderTable(base.CurrentSection, this.SectionBounds, rpea, this.Layout); this.ReportDocument.DetailsDone = true; } else { // first element if (base.SinglePage.PageNumber == 1) { this.dataNavigator.MoveNext(); } do { ISimpleContainer i = base.CurrentSection.Items[0] as ISimpleContainer; if (i != null) { nav.Fill(i.Items); } else { nav.Fill(base.CurrentSection.Items); } sectionRect = new Rectangle(rpea.PrintPageEventArgs.MarginBounds.Left, base.CurrentSection.SectionOffset, rpea.PrintPageEventArgs.MarginBounds.Width, base.CurrentSection.Size.Height); if (PrintHelper.IsPageFull(sectionRect, base.SectionBounds)) { AbstractRenderer.PageBreak(rpea); this.RemoveSectionEvents(); return; } base.RenderItems(rpea); if (nav.CurrentRow < nav.Count - 1) { if (base.CurrentSection.PageBreakAfter) { AbstractRenderer.PageBreak(rpea); this.RemoveSectionEvents(); return; } } Rectangle r = new Rectangle(rpea.PrintPageEventArgs.MarginBounds.Left, base.CurrentSection.SectionOffset, rpea.PrintPageEventArgs.MarginBounds.Width, base.CurrentSection.Size.Height); // if (this.dataNavigator.CurrentRow % 2 == 0) { // PrintHelper.DebugRectangle(rpea.PrintPageEventArgs.Graphics,r); // } base.CurrentSection.SectionOffset = r.Bottom; rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, sectionRect.Bottom); rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, r.Bottom); }while (nav.MoveNext()); this.ReportDocument.DetailsDone = true; } rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, rpea.LocationAfterDraw.Y + 5); if (!PrintHelper.IsRoomForFooter(base.SectionBounds, rpea.LocationAfterDraw)) { AbstractRenderer.PageBreak(rpea); } }