23 changed files with 558 additions and 45 deletions
@ -0,0 +1,29 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 09.04.2013 |
||||||
|
* Time: 19:51 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using ICSharpCode.Reporting.Interfaces; |
||||||
|
using ICSharpCode.Reporting.Items; |
||||||
|
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Factories |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of ExportColumnFactory.
|
||||||
|
/// </summary>
|
||||||
|
public class ExportColumnFactory |
||||||
|
{ |
||||||
|
public ExportColumnFactory() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public IExportColumn CreateItem (IReportItem item) { |
||||||
|
return item.CreateExportColumn(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 08.04.2013 |
||||||
|
* Time: 20:10 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Interfaces |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of IExportColumn.
|
||||||
|
/// </summary>
|
||||||
|
public interface IExportColumn |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 08.04.2013 |
||||||
|
* Time: 19:50 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using ICSharpCode.Reporting.Items; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Interfaces |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of ISection.
|
||||||
|
/// </summary>
|
||||||
|
public interface ISection:IReportItem |
||||||
|
{ |
||||||
|
List<ReportItem> Items {get;} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,36 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 07.04.2013 |
||||||
|
* Time: 18:23 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Drawing; |
||||||
|
using ICSharpCode.Reporting.Interfaces; |
||||||
|
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Items |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of BaseTextItem.
|
||||||
|
/// </summary>
|
||||||
|
public interface ITextItem:IReportItem |
||||||
|
{ |
||||||
|
Font Font {get;set;} |
||||||
|
} |
||||||
|
|
||||||
|
public class BaseTextItem:ReportItem,ITextItem |
||||||
|
{ |
||||||
|
public BaseTextItem(){ |
||||||
|
} |
||||||
|
|
||||||
|
public Font Font {get;set;} |
||||||
|
|
||||||
|
public override IExportColumn CreateExportColumn() |
||||||
|
{ |
||||||
|
return new ExportText(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,47 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 08.04.2013 |
||||||
|
* Time: 19:49 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Drawing; |
||||||
|
|
||||||
|
using ICSharpCode.Reporting.Factories; |
||||||
|
using ICSharpCode.Reporting.Interfaces; |
||||||
|
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.PageBuilder.Converter |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of SectionConverter.
|
||||||
|
/// </summary>
|
||||||
|
internal class SectionConverter |
||||||
|
{ |
||||||
|
private Point currentPoint; |
||||||
|
private ExportColumnFactory factory; |
||||||
|
|
||||||
|
public SectionConverter(ISection section,Point currentPoint ) |
||||||
|
{ |
||||||
|
Section = section; |
||||||
|
this.currentPoint = currentPoint; |
||||||
|
factory = new ExportColumnFactory(); |
||||||
|
} |
||||||
|
|
||||||
|
public List<IExportColumn> Convert(){ |
||||||
|
var l = new List<IExportColumn>(); |
||||||
|
foreach (var element in Section.Items) { |
||||||
|
|
||||||
|
var item = factory.CreateItem(element); |
||||||
|
l.Add(item); |
||||||
|
} |
||||||
|
|
||||||
|
return l; |
||||||
|
} |
||||||
|
|
||||||
|
public ISection Section {get; private set;} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 08.04.2013 |
||||||
|
* Time: 20:09 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using ICSharpCode.Reporting.Interfaces; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of BaseExportColumn.
|
||||||
|
/// </summary>
|
||||||
|
public class BaseExportColumn:IExportColumn |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 10.04.2013 |
||||||
|
* Time: 20:00 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of ExportText.
|
||||||
|
/// </summary>
|
||||||
|
public class ExportText:BaseExportColumn |
||||||
|
{ |
||||||
|
public ExportText() |
||||||
|
{ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,76 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 07.04.2013 |
||||||
|
* Time: 18:01 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Drawing; |
||||||
|
using System.IO; |
||||||
|
using System.Reflection; |
||||||
|
|
||||||
|
using ICSharpCode.Reporting.Items; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Test.Model |
||||||
|
{ |
||||||
|
[TestFixture] |
||||||
|
public class Report_TwoItemsFixture |
||||||
|
{ |
||||||
|
Stream stream; |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void LoadModelWithItems() |
||||||
|
{ |
||||||
|
var rf = new ReportingFactory(); |
||||||
|
var model = rf.LoadReportModel(stream); |
||||||
|
Assert.That(model,Is.Not.Null); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ReportHeaderOneItem () { |
||||||
|
var rf = new ReportingFactory(); |
||||||
|
var model = rf.LoadReportModel(stream); |
||||||
|
var section = model.ReportHeader; |
||||||
|
Assert.That(section.Items.Count,Is.EqualTo(1)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[Test] |
||||||
|
public void PageHeaderOneItem () { |
||||||
|
var rf = new ReportingFactory(); |
||||||
|
var model = rf.LoadReportModel(stream); |
||||||
|
var section = model.ReportHeader; |
||||||
|
Assert.That(section.Items.Count,Is.EqualTo(1)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ItemIsTextItem() { |
||||||
|
var rf = new ReportingFactory(); |
||||||
|
var model = rf.LoadReportModel(stream); |
||||||
|
var item = model.ReportHeader.Items[0]; |
||||||
|
Assert.That(item,Is.AssignableFrom(typeof(BaseTextItem))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsLocationSet() { |
||||||
|
var rf = new ReportingFactory(); |
||||||
|
var model = rf.LoadReportModel(stream); |
||||||
|
var item = model.ReportHeader.Items[0]; |
||||||
|
Assert.That(item.Location,Is.Not.EqualTo(Point.Empty)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[SetUp] |
||||||
|
public void LoadFromStream() |
||||||
|
{ |
||||||
|
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); |
||||||
|
stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,49 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 08.04.2013 |
||||||
|
* Time: 20:20 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Reflection; |
||||||
|
using ICSharpCode.Reporting.Interfaces; |
||||||
|
using ICSharpCode.Reporting.PageBuilder; |
||||||
|
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Test.PageBuilder |
||||||
|
{ |
||||||
|
[TestFixture] |
||||||
|
public class BaseConvertFixture |
||||||
|
{ |
||||||
|
private IReportCreator reportCreator; |
||||||
|
|
||||||
|
|
||||||
|
[Test] |
||||||
|
public void CurrentPageContainOneItem() { |
||||||
|
reportCreator.BuildExportList(); |
||||||
|
var page = reportCreator.Pages[0]; |
||||||
|
Assert.That(page.Items.Count, Is.EqualTo(1)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[Test] |
||||||
|
public void PageItemIsBaseExportColumn() { |
||||||
|
reportCreator.BuildExportList(); |
||||||
|
var page = reportCreator.Pages[0]; |
||||||
|
Assert.That(page.Items[0],Is.InstanceOf(typeof(ExportText))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[SetUp] |
||||||
|
public void LoadFromStream() |
||||||
|
{ |
||||||
|
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); |
||||||
|
var stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems); |
||||||
|
var reportingFactory = new ReportingFactory(); |
||||||
|
reportCreator = reportingFactory.ReportCreator(stream); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,144 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<ReportModel> |
||||||
|
<ReportSettings> |
||||||
|
<ReportSettings> |
||||||
|
<ReportName>Report1</ReportName> |
||||||
|
<ReportType>FormSheet</ReportType> |
||||||
|
<BottomMargin>50</BottomMargin> |
||||||
|
<TopMargin>50</TopMargin> |
||||||
|
<LeftMargin>50</LeftMargin> |
||||||
|
<RightMargin>50</RightMargin> |
||||||
|
<PageSize>827, 1169</PageSize> |
||||||
|
<Landscape>False</Landscape> |
||||||
|
<GraphicsUnit>Millimeter</GraphicsUnit> |
||||||
|
<Padding>5, 5, 5, 5</Padding> |
||||||
|
<AvailableFieldsCollection /> |
||||||
|
<SortColumnsCollection /> |
||||||
|
<GroupColumnsCollection /> |
||||||
|
<ParameterCollection /> |
||||||
|
<SqlParameters /> |
||||||
|
<ConnectionString /> |
||||||
|
<CommandText /> |
||||||
|
<CommandType>Text</CommandType> |
||||||
|
<DataModel>FormSheet</DataModel> |
||||||
|
<NoDataMessage>No Data for this Report</NoDataMessage> |
||||||
|
<DefaultFont>Microsoft Sans Serif, 10pt</DefaultFont> |
||||||
|
<UseStandardPrinter>True</UseStandardPrinter> |
||||||
|
</ReportSettings> |
||||||
|
</ReportSettings> |
||||||
|
<SectionCollection> |
||||||
|
<BaseSection> |
||||||
|
<Location>50, 50</Location> |
||||||
|
<Size>727, 60</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<SectionOffset>0</SectionOffset> |
||||||
|
<SectionMargin>0</SectionMargin> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<PageBreakAfter>False</PageBreakAfter> |
||||||
|
<Items> |
||||||
|
<BaseTextItem> |
||||||
|
<Location>313, 5</Location> |
||||||
|
<Size>100, 20</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<Font>Microsoft Sans Serif, 10pt</Font> |
||||||
|
<StringTrimming>None</StringTrimming> |
||||||
|
<ContentAlignment>TopLeft</ContentAlignment> |
||||||
|
<CanGrow>False</CanGrow> |
||||||
|
<CanShrink>False</CanShrink> |
||||||
|
<DataType>System.String</DataType> |
||||||
|
<RTL>No</RTL> |
||||||
|
<Text>Report1</Text> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<ForeColor>Black</ForeColor> |
||||||
|
<Name>Report1</Name> |
||||||
|
</BaseTextItem> |
||||||
|
</Items> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Name>ReportHeader</Name> |
||||||
|
</BaseSection> |
||||||
|
<BaseSection> |
||||||
|
<Location>50, 125</Location> |
||||||
|
<Size>727, 60</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<SectionOffset>0</SectionOffset> |
||||||
|
<SectionMargin>0</SectionMargin> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<PageBreakAfter>False</PageBreakAfter> |
||||||
|
<Items> |
||||||
|
<BaseTextItem> |
||||||
|
<Location>26, 22</Location> |
||||||
|
<Size>100, 20</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<Font>Microsoft Sans Serif, 10pt</Font> |
||||||
|
<StringTrimming>None</StringTrimming> |
||||||
|
<ContentAlignment>TopLeft</ContentAlignment> |
||||||
|
<CanGrow>False</CanGrow> |
||||||
|
<CanShrink>False</CanShrink> |
||||||
|
<RTL>No</RTL> |
||||||
|
<Text>BaseTextItem2147483646</Text> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<ForeColor>Black</ForeColor> |
||||||
|
<Name>BaseTextItem2147483646</Name> |
||||||
|
</BaseTextItem> |
||||||
|
</Items> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Name>ReportPageHeader</Name> |
||||||
|
</BaseSection> |
||||||
|
<BaseSection> |
||||||
|
<Location>50, 200</Location> |
||||||
|
<Size>727, 60</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<SectionOffset>0</SectionOffset> |
||||||
|
<SectionMargin>0</SectionMargin> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<PageBreakAfter>False</PageBreakAfter> |
||||||
|
<Items /> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Name>ReportDetail</Name> |
||||||
|
</BaseSection> |
||||||
|
<BaseSection> |
||||||
|
<Location>50, 275</Location> |
||||||
|
<Size>727, 60</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<SectionOffset>0</SectionOffset> |
||||||
|
<SectionMargin>0</SectionMargin> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<PageBreakAfter>False</PageBreakAfter> |
||||||
|
<Items> |
||||||
|
<BaseTextItem> |
||||||
|
<Location>622, 5</Location> |
||||||
|
<Size>100, 20</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<Font>Microsoft Sans Serif, 10pt</Font> |
||||||
|
<StringTrimming>None</StringTrimming> |
||||||
|
<ContentAlignment>TopLeft</ContentAlignment> |
||||||
|
<CanGrow>False</CanGrow> |
||||||
|
<CanShrink>False</CanShrink> |
||||||
|
<DataType>System.String</DataType> |
||||||
|
<RTL>No</RTL> |
||||||
|
<Text>=Globals!PageNumber</Text> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<ForeColor>Black</ForeColor> |
||||||
|
<Name>PageNumber1</Name> |
||||||
|
</BaseTextItem> |
||||||
|
</Items> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Name>ReportPageFooter</Name> |
||||||
|
</BaseSection> |
||||||
|
<BaseSection> |
||||||
|
<Location>50, 350</Location> |
||||||
|
<Size>727, 60</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<SectionOffset>0</SectionOffset> |
||||||
|
<SectionMargin>0</SectionMargin> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<PageBreakAfter>False</PageBreakAfter> |
||||||
|
<Items /> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Name>ReportFooter</Name> |
||||||
|
</BaseSection> |
||||||
|
</SectionCollection> |
||||||
|
</ReportModel> |
||||||
Loading…
Reference in new issue