Browse Source

PageBreak with GroupedReport, Refactor PageBreak

pull/1/head
peterforstmeier 15 years ago
parent
commit
188e4d14cb
  1. 47
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs
  2. 4
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/TableConverter.cs

47
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs

@ -61,12 +61,14 @@ namespace ICSharpCode.Reports.Core.Exporter
private ExporterCollection ConvertDataRow (ISimpleContainer simpleContainer) private ExporterCollection ConvertDataRow (ISimpleContainer simpleContainer)
{ {
ExporterCollection mylist = new ExporterCollection(); ExporterCollection exporterCollection = new ExporterCollection();
Point currentPosition = new Point(base.SectionBounds.DetailStart.X,base.SectionBounds.DetailStart.Y); Point currentPosition = new Point(base.SectionBounds.DetailStart.X,base.SectionBounds.DetailStart.Y);
BaseSection section = parent as BaseSection; BaseSection section = parent as BaseSection;
int defaultLeftPos = parent.Location.X; int defaultLeftPos = parent.Location.X;
Rectangle curRect = Rectangle.Empty;
do { do {
PrintHelper.AdjustSectionLocation (section); PrintHelper.AdjustSectionLocation (section);
@ -74,11 +76,10 @@ namespace ICSharpCode.Reports.Core.Exporter
base.SaveSize(section.Items[0].Size); base.SaveSize(section.Items[0].Size);
if (section.Items.IsGrouped) { if (section.Items.IsGrouped) {
// Convert Grouping Header // Convert Grouping Header
currentPosition = ConvertGroupHeader(mylist,section,simpleContainer,defaultLeftPos,currentPosition); currentPosition = ConvertGroupHeader(exporterCollection,section,simpleContainer,defaultLeftPos,currentPosition);
//Convert children //Convert children
@ -87,7 +88,14 @@ namespace ICSharpCode.Reports.Core.Exporter
StandardPrinter.AdjustBackColor(simpleContainer,GlobalValues.DefaultBackColor); StandardPrinter.AdjustBackColor(simpleContainer,GlobalValues.DefaultBackColor);
base.DataNavigator.SwitchGroup(); base.DataNavigator.SwitchGroup();
do { do {
currentPosition = ConvertGroupChilds (mylist,section,simpleContainer,defaultLeftPos,currentPosition); currentPosition = ConvertGroupChilds (exporterCollection,section,simpleContainer,defaultLeftPos,currentPosition);
curRect = new Rectangle(new Point (simpleContainer.Location.X,currentPosition.Y), section.Size);
if (PrintHelper.IsPageFull(curRect,base.SectionBounds )) {
BuildNewPage(exporterCollection,section);
currentPosition = CalculateStartPosition ();
}
} }
while ( base.DataNavigator.ChildMoveNext()); while ( base.DataNavigator.ChildMoveNext());
} }
@ -96,18 +104,17 @@ namespace ICSharpCode.Reports.Core.Exporter
else else
{ {
// No Grouping // No Grouping
currentPosition = ConvertStandardRow (mylist,section,simpleContainer,defaultLeftPos,currentPosition); currentPosition = ConvertStandardRow (exporterCollection,section,simpleContainer,defaultLeftPos,currentPosition);
} }
curRect = new Rectangle(new Point (simpleContainer.Location.X,currentPosition.Y), section.Size);
if (PrintHelper.IsPageFull(new Rectangle(new Point (simpleContainer.Location.X,currentPosition.Y), section.Size),base.SectionBounds)) { if (PrintHelper.IsPageFull(curRect,base.SectionBounds)) {
base.FirePageFull(mylist); BuildNewPage(exporterCollection,section);
section.SectionOffset = base.SinglePage.SectionBounds.PageHeaderRectangle.Location.Y; currentPosition = CalculateStartPosition ();
currentPosition = new Point(base.SectionBounds.PageHeaderRectangle.X,base.SectionBounds.PageHeaderRectangle.Y);
mylist.Clear();
} }
ShouldDrawBorder (section,mylist); ShouldDrawBorder (section,exporterCollection);
} }
while (base.DataNavigator.MoveNext()); while (base.DataNavigator.MoveNext());
@ -116,7 +123,23 @@ namespace ICSharpCode.Reports.Core.Exporter
section.Location.Y + section.Size.Height, section.Location.Y + section.Size.Height,
SectionBounds.ReportFooterRectangle.Width, SectionBounds.ReportFooterRectangle.Width,
SectionBounds.ReportFooterRectangle.Height); SectionBounds.ReportFooterRectangle.Height);
return mylist; return exporterCollection;
}
private Point CalculateStartPosition()
{
return new Point(base.SectionBounds.PageHeaderRectangle.X,base.SectionBounds.PageHeaderRectangle.Y);
}
private void BuildNewPage(ExporterCollection myList,BaseSection section)
{
base.FirePageFull(myList);
section.SectionOffset = base.SinglePage.SectionBounds.PageHeaderRectangle.Location.Y;
myList.Clear();
} }

4
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/TableConverter.cs

@ -95,8 +95,8 @@ namespace ICSharpCode.Reports.Core.Exporter
mylist.Clear(); mylist.Clear();
currentPosition = BaseConverter.BaseConvert(mylist,headerContainer, currentPosition = BaseConverter.BaseConvert(mylist,headerContainer,
defaultLeftPos, defaultLeftPos,
base.SectionBounds.ReportHeaderRectangle.Location); base.SectionBounds.ReportHeaderRectangle.Location);
} }
currentPosition = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition); currentPosition = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition);

Loading…
Cancel
Save