Browse Source

More work on ReportViewer and Exporting

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1988 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 19 years ago
parent
commit
23d14768b0
  1. 4
      src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs
  2. 9
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs
  3. 32
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs
  4. 37
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/BaseStyleDecorator.cs
  5. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/BaseExportColumn.cs
  6. 36
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/ExportGraphic.cs
  7. 35
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportItemsConverter.cs
  8. 18
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExporterCollection.cs
  9. 178
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/PageBuilder.cs
  10. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/SinglePage.cs
  11. 10
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/SectionBounds.cs
  12. 1
      src/AddIns/Misc/SharpReport/SharpReportCore/ReportViewer/ReportViewer.Designer.cs
  13. 40
      src/AddIns/Misc/SharpReport/SharpReportCore/ReportViewer/ReportViewer.cs
  14. 1
      src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj

4
src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs

@ -323,12 +323,12 @@ namespace SharpReportAddin{ @@ -323,12 +323,12 @@ namespace SharpReportAddin{
System.Console.WriteLine("\tsetup pagebuilder{0}",DateTime.Now);
SharpReportCore.Exporters.PageBuilder pb = reportManager.CreatePageBuilder (designerControl.ReportModel);
System.Console.WriteLine("\tstart createreport{0}",DateTime.Now);
pb.CreateReport();
pb.BuildExportList();
System.Console.WriteLine("\treport created {0}",DateTime.Now);
SharpReportCore.Exporters.SinglePage sp= pb.FirstPage;
System.Console.WriteLine("\tPages {0} SinglePage : Items {0}",pb.Pages.Count,sp.Items.Count);
this.reportViewer.Pages = pb.Pages;
this.reportViewer.SetPages (pb.Pages);
}
#endregion

9
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs

@ -47,23 +47,18 @@ namespace SharpReportCore { @@ -47,23 +47,18 @@ namespace SharpReportCore {
#region IExportColumnBuilder implementation
// public IPerformLine CreateExportColumn(Graphics graphics){
public BaseExportColumn CreateExportColumn(Graphics graphics){
BaseStyleDecorator st = this.CreateItemStyle(graphics);
// TextDecorator st = (TextDecorator)this.CreateItemStyle(graphics);
ExportText item = new ExportText(st,false);
item.Text = this.text;
return item;
}
#endregion
#region IExportColumnBuilder implementation
protected BaseStyleDecorator CreateItemStyle (Graphics g) {
BaseStyleDecorator style = new BaseStyleDecorator();
// TextStyleDecorator style = new TextStyleDecorator();
SizeF measureSizeF = new SizeF ();
measureSizeF = g.MeasureString(text,
this.Font,

32
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
using System;
using System.Drawing;
using SharpReportCore.Exporters;
/// <summary>
/// This Class handles Lines
/// </summary>
@ -20,14 +20,40 @@ using System.Drawing; @@ -20,14 +20,40 @@ using System.Drawing;
/// created on - 28.09.2005 23:46:19
/// </remarks>
namespace SharpReportCore {
public class BaseLineItem : SharpReportCore.BaseGraphicItem {
public class BaseLineItem : SharpReportCore.BaseGraphicItem,IExportColumnBuilder {
LineShape shape = new LineShape();
#region Constructor
public BaseLineItem():base() {
}
#endregion
#region IExportColumnBuilder implementation
public BaseExportColumn CreateExportColumn(Graphics graphics){
BaseStyleDecorator st = this.CreateItemStyle(graphics);
ExportGraphic item = new ExportGraphic(st,false);
return item;
}
private BaseStyleDecorator CreateItemStyle (Graphics g) {
BaseStyleDecorator style = new BaseStyleDecorator();
style.Shape = this.shape;
style.Size = this.Size;
style.Location = this.Location;
style.BackColor = this.BackColor;
style.ForeColor = this.ForeColor;
style.Thickness = base.Thickness;
style.DashStyle = base.DashStyle;
return style;
}
#endregion
public override void Render(ReportPageEventArgs rpea) {
if (rpea == null) {
throw new ArgumentNullException("rpea");

37
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/BaseStyleDecorator.cs

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace SharpReportCore.Exporters
{
/// <summary>
@ -28,6 +28,10 @@ namespace SharpReportCore.Exporters @@ -28,6 +28,10 @@ namespace SharpReportCore.Exporters
private StringTrimming stringTrimming;
private ContentAlignment contentAlignment;
private BaseShape shape;
private int thickness = 1;
private DashStyle dashStyle = DashStyle.Solid;
public BaseStyleDecorator():this(Color.White,Color.Black){
}
@ -118,6 +122,37 @@ namespace SharpReportCore.Exporters @@ -118,6 +122,37 @@ namespace SharpReportCore.Exporters
}
}
public Rectangle DisplayRectangle {
get {
return new Rectangle(this.location.X,this.location.Y,
this.size.Width,this.size.Height);
}
}
public void DrawGraphic (Graphics graphics) {
if (graphics == null) {
throw new ArgumentNullException("graphics");
}
this.shape.DrawShape(graphics,
new BaseLine (this.foreColor,this.dashStyle,this.thickness),
this.DisplayRectangle);
}
public BaseShape Shape {
get { return shape; }
set { shape = value; }
}
public int Thickness {
get { return thickness; }
set { thickness = value; }
}
public DashStyle DashStyle {
get { return dashStyle; }
set { dashStyle = value; }
}
}
public class TextDecorator :BaseStyleDecorator

4
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/BaseExportColumn.cs

@ -26,10 +26,6 @@ namespace SharpReportCore.Exporters @@ -26,10 +26,6 @@ namespace SharpReportCore.Exporters
this.styleDecorator = new BaseStyleDecorator(Color.White,Color.Black);
}
// public BaseExportColumn(BaseStyleDecorator styleDecorator)
// {
// this.styleDecorator = styleDecorator;
// }
public BaseExportColumn(BaseStyleDecorator itemStyle, bool isContainer)
{

36
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/ExportGraphic.cs

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
/*
* Erstellt mit SharpDevelop.
* Benutzer: Forstmeier Helmut
* Datum: 27.10.2006
* Zeit: 22:43
*
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
*/
using System;
namespace SharpReportCore.Exporters
{
/// <summary>
/// Description of ExportGraphic.
/// </summary>
public class ExportGraphic:BaseExportColumn,IPerformLine
{
public ExportGraphic():base()
{
}
public ExportGraphic (BaseStyleDecorator itemStyle,bool isContainer):base(itemStyle,isContainer){
}
public override BaseStyleDecorator StyleDecorator {
get {
return base.StyleDecorator;
}
set {
base.StyleDecorator = value;
}
}
}
}

35
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportItemsConverter.cs

@ -20,21 +20,40 @@ namespace SharpReportCore.Exporters{ @@ -20,21 +20,40 @@ namespace SharpReportCore.Exporters{
this.graphics = graphics;
}
public ExportText ConvertToLineItems (IItemRenderer r) {
IExportColumnBuilder lineBuilder = r as IExportColumnBuilder;
ExportText lineItem = null;
public BaseExportColumn ConvertToLineItems (IItemRenderer itemRenderer) {
if (itemRenderer == null) {
throw new ArgumentNullException("itemRenderer");
}
IExportColumnBuilder lineBuilder = itemRenderer as IExportColumnBuilder;
BaseExportColumn lineItem = null;
if (lineBuilder != null) {
lineItem = (ExportText)lineBuilder.CreateExportColumn(this.graphics);
lineItem = lineBuilder.CreateExportColumn(this.graphics);
lineItem.StyleDecorator.Location = new Point(lineItem.StyleDecorator.Location.X,
lineItem.StyleDecorator.Location.Y + offset);
lineItem.StyleDecorator.Location.Y + offset);
} else {
System.Console.WriteLine("Can't Convert <{0}> to ILineBuilder",r.Name);
System.Console.WriteLine("ConvertToLineItems:Can't Convert <{0}> to ILineBuilder",itemRenderer.Name);
}
return lineItem;
}
public ExportContainer ConvertToContainer (IItemRenderer itemRenderer) {
if (itemRenderer == null) {
throw new ArgumentNullException("itemRenderer");
}
IExportColumnBuilder lineBuilder = itemRenderer as IExportColumnBuilder;
if (lineBuilder != null) {
ExportContainer lineItem = (ExportContainer)lineBuilder.CreateExportColumn(this.graphics);
lineItem.StyleDecorator.Location = new Point (lineItem.StyleDecorator.Location.X,
this.offset);
return lineItem;
} else {
System.Console.WriteLine("ConvertToContainer:Can't Convert <{0}> to ILineBuilder",itemRenderer.Name);
}
return null;
}
public int Offset {
get {
return offset;

18
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExporterCollection.cs

@ -11,15 +11,19 @@ using System; @@ -11,15 +11,19 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace SharpReportCore.Exporters
{
public class ExporterCollection<T> : Collection<T>
where T : BaseExportColumn {
namespace SharpReportCore.Exporters{
public void AddRange (IEnumerable <T> items){
foreach (T item in items) {
this.Add (item);
public class ExporterCollection<T> : Collection<T>
where T : BaseExportColumn {
public void AddRange (IEnumerable <T> items){
foreach (T item in items) {
this.Add (item);
}
}
}
public class PagesCollection :Collection<SinglePage>
{
}
}

178
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/PageBuilder.cs

@ -19,17 +19,17 @@ namespace SharpReportCore.Exporters @@ -19,17 +19,17 @@ namespace SharpReportCore.Exporters
/// </summary>
public class PageBuilder
{
List<SinglePage> pages;
SinglePage singlePage;
PagesCollection pages;
ReportModel reportModel;
DataManager dataManager;
DataNavigator dataNavigator;
ExportItemsConverter lineItemsConverter;
public delegate List <BaseExportColumn> ConverterDelegate (BaseSection s,SinglePage p);
internal delegate ExporterCollection<BaseExportColumn> ConverterDelegate (BaseSection s);
#region Constructor
public PageBuilder () {
pages = new List<SinglePage>();
pages = new PagesCollection();
}
public PageBuilder(ReportModel reportModel,DataManager dataManager):this(){
@ -61,29 +61,40 @@ namespace SharpReportCore.Exporters @@ -61,29 +61,40 @@ namespace SharpReportCore.Exporters
return sp;
}
private void BuildReportHeader (SinglePage page) {
BaseSection section = this.reportModel.ReportHeader;
this.lineItemsConverter.Offset = page.SectionBounds.ReportHeaderRectangle.Top;
List <BaseExportColumn>l = section.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems);
page.Items.AddRange(l);
private void DoConvert (BaseSection section,int offset) {
this.lineItemsConverter.Offset = offset;
List <BaseExportColumn>list = section.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems);
list.ForEach(display);
/*
if (list.Count > 0) {
list.ForEach(delegate(BaseExportColumn item){
ExportGraphic gr = item as ExportGraphic;
if (gr != null) {
System.Console.WriteLine("{0} / {1}",gr.ToString(),gr.StyleDecorator.Shape.ToString());
}
});
}
*/
this.singlePage.Items.AddRange(list);
}
private void BuildPageHeader (SinglePage page) {
BaseSection section = this.reportModel.PageHeader;
this.lineItemsConverter.Offset = page.SectionBounds.PageHeaderRectangle.Top;
// System.Console.WriteLine("Page Header start at {0} with {1} Items",
// this.lineItemsConverter.Offset,
// section.Items.Count);
List <BaseExportColumn>l = section.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems);
page.Items.AddRange(l);
private void BuildReportHeader () {
this.DoConvert (this.reportModel.ReportHeader,
this.singlePage.SectionBounds.PageHeaderRectangle.Top);
}
private void BuildPageHeader () {
this.DoConvert (this.reportModel.PageHeader,
this.singlePage.SectionBounds.PageHeaderRectangle.Top);
}
private void BuildDetails (SinglePage page,Graphics graphics) {
private void BuildDetails (Graphics graphics) {
bool firstOnPage = true;
@ -97,16 +108,16 @@ namespace SharpReportCore.Exporters @@ -97,16 +108,16 @@ namespace SharpReportCore.Exporters
}
BaseSection section = this.reportModel.DetailSection;
section.SectionOffset = page.SectionBounds.DetailStart.Y;
section.SectionOffset = this.singlePage.SectionBounds.DetailStart.Y;
do {
dataNavigator.Fill(section.Items);
if (!firstOnPage) {
section.SectionOffset = section.SectionOffset + section.Size.Height + 2 * page.SectionBounds.Gap;
section.SectionOffset = section.SectionOffset + section.Size.Height + 2 * this.singlePage.SectionBounds.Gap;
}
MeasurementService.FitSectionToItems (section,graphics);
List <BaseExportColumn>convertedList = new List<BaseExportColumn>();
ExporterCollection<BaseExportColumn> convertedList = new ExporterCollection<BaseExportColumn>();
ConverterDelegate converterDelegate;
@ -116,45 +127,55 @@ namespace SharpReportCore.Exporters @@ -116,45 +127,55 @@ namespace SharpReportCore.Exporters
converterDelegate = new ConverterDelegate(DoJob);
}
convertedList = converterDelegate(section,page);
page.Items.AddRange(convertedList);
convertedList = converterDelegate(section);
BaseExportColumn bec = convertedList[0];
System.Console.WriteLine("SB {0} / DR {1} / Fit {2} ",this.singlePage.SectionBounds.DetailRectangle,
bec.StyleDecorator.DisplayRectangle,
this.singlePage.SectionBounds.DetailRectangle.Contains(bec.StyleDecorator.DisplayRectangle));
if (this.singlePage.SectionBounds.DetailRectangle.Contains(bec.StyleDecorator.DisplayRectangle)) {
System.Console.WriteLine("\t fit");
} else {
System.Console.WriteLine("\t dont fit");
}
this.singlePage.Items.AddRange(convertedList);
firstOnPage = false;
}
while (dataNavigator.MoveNext());
}
private List <BaseExportColumn> DoContainerJob (BaseSection section,SinglePage page) {
IExportColumnBuilder builder = section.Items[0] as IExportColumnBuilder;
private ExporterCollection<BaseExportColumn> DoContainerJob (BaseSection section) {
this.lineItemsConverter.Offset = section.SectionOffset;
IExportColumnBuilder exportLineBuilder = section.Items[0] as IExportColumnBuilder;
if (builder != null) {
// System.Console.WriteLine("Create RowList with Location {0} ",this.lineItemsConverter.Offset);
if (exportLineBuilder != null) {
Graphics g = reportModel.ReportSettings.PageSettings.PrinterSettings.CreateMeasurementGraphics();
ExportContainer lineItem = (ExportContainer)builder.CreateExportColumn(g);
ExportContainer lineItem = this.lineItemsConverter.ConvertToContainer(section.Items[0]);
IContainerItem containerItem = section.Items[0] as IContainerItem;
// reread
this.dataNavigator.Fill(containerItem.Items);
List <BaseExportColumn> childList = containerItem.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems);
List<BaseExportColumn> list = containerItem.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems);
//Adjust childitems to Location within container
if (childList.Count > 0) {
childList.ForEach(delegate(BaseExportColumn item){
Point p = new Point (lineItem.StyleDecorator.Location.X + item.StyleDecorator.Location.X,
lineItem.StyleDecorator.Location.Y + item.StyleDecorator.Location.Y);
item.StyleDecorator.Location = p;
});
if (list.Count > 0) {
list.ForEach(delegate(BaseExportColumn item){
Point p = new Point (lineItem.StyleDecorator.Location.X + item.StyleDecorator.Location.X,
item.StyleDecorator.Location.Y);
item.StyleDecorator.Location = p;
});
}
lineItem.Items.AddRange(childList);
List <BaseExportColumn> containerList = new List<BaseExportColumn>();
lineItem.Items.AddRange(list);
ExporterCollection<BaseExportColumn> containerList = new ExporterCollection<BaseExportColumn>();
// list.ForEach(display);
containerList.Add (lineItem);
g.Dispose();
return containerList;
@ -164,64 +185,51 @@ namespace SharpReportCore.Exporters @@ -164,64 +185,51 @@ namespace SharpReportCore.Exporters
private List <BaseExportColumn> DoJob (BaseSection section,SinglePage page) {
private ExporterCollection<BaseExportColumn> DoJob (BaseSection section) {
this.lineItemsConverter.Offset = section.SectionOffset;
List <BaseExportColumn>list = section.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems);
/*
if (list.Count > 0) {
bool istrue = list.TrueForAll(delegate(BaseExportColumn item){
if (item.StyleDecorator.Location.Y + item.StyleDecorator.Size.Height > page.SectionBounds.DetailEnds.Y) {
return false;
}
// System.Console.WriteLine("{0} / {1}",
// item.ItemStyle.Location.Y + item.ItemStyle.Size.Height,
// page.SectionBounds.DetailEnds.Y);
return true;
});
}
*/
return list;
List<BaseExportColumn> list = section.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems);
ExporterCollection<BaseExportColumn> childList = new ExporterCollection<BaseExportColumn>();
childList.AddRange(list);
return childList;
}
private void BuildPageFooter () {
BaseSection section = this.reportModel.PageFooter;
this.DoConvert (this.reportModel.PageFooter,this.singlePage.SectionBounds.PageFooterRectangle.Top);
}
private void display (IPerformLine li) {
// System.Console.WriteLine("\tdisplay {0}",li.ToString());
ExportText l = li as ExportText;
if (l != null) {
System.Console.WriteLine("\t\t{0} / {1} ",l.StyleDecorator.Location,l.Text);
}
}
private void BuildPageFooter (SinglePage page) {
BaseSection section = this.reportModel.PageFooter;
this.lineItemsConverter.Offset = page.SectionBounds.PageFooterRectangle.Top;
List <BaseExportColumn>l = section.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems);
page.Items.AddRange(l);
}
private void Write (SinglePage page) {
private void Write () {
this.dataNavigator = this.dataManager.GetNavigator;
Graphics graphics = reportModel.ReportSettings.PageSettings.PrinterSettings.CreateMeasurementGraphics();
this.lineItemsConverter = new ExportItemsConverter(graphics);
if (this.pages.Count == 0) {
BuildReportHeader (page);
BuildReportHeader ();
}
BuildPageHeader(page) ;
BuildDetails (page,graphics);
BuildPageFooter (page);
BuildPageHeader() ;
BuildDetails (graphics);
System.Console.WriteLine("--------");
System.Console.WriteLine("{0} / {1} / {2}",this.dataNavigator.Count,this.dataNavigator.CurrentRow,this.dataNavigator.HasMoreData);
BuildPageFooter ();
graphics.Dispose();
}
//TODO did we use this method
public void AddPage (SinglePage page) {
if (page == null) {
throw new ArgumentNullException("page");
@ -230,11 +238,11 @@ namespace SharpReportCore.Exporters @@ -230,11 +238,11 @@ namespace SharpReportCore.Exporters
}
public void CreateReport () {
SinglePage page = this.CreateNewPage();
page.CalculatePageBounds(this.reportModel);
Write(page);
this.pages.Add(page);
public void BuildExportList () {
this.singlePage = this.CreateNewPage();
this.singlePage.CalculatePageBounds(this.reportModel);
Write();
this.pages.Add(this.singlePage);
}
@ -262,7 +270,7 @@ namespace SharpReportCore.Exporters @@ -262,7 +270,7 @@ namespace SharpReportCore.Exporters
}
}
public List<SinglePage> Pages {
public PagesCollection Pages {
get {
return pages;
}

4
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/SinglePage.cs

@ -31,7 +31,9 @@ namespace SharpReportCore.Exporters @@ -31,7 +31,9 @@ namespace SharpReportCore.Exporters
}
public void CalculatePageBounds (ReportModel reportModel) {
if (reportModel == null) {
throw new ArgumentNullException("reportModel");
}
Graphics graphics = reportModel.ReportSettings.PageSettings.PrinterSettings.CreateMeasurementGraphics();
Rectangle rectangle;

10
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/SectionBounds.cs

@ -18,7 +18,7 @@ namespace SharpReportCore{ @@ -18,7 +18,7 @@ namespace SharpReportCore{
public class SectionBounds{
Rectangle reportHeaderRectangle;
Rectangle pageHeaderRectangle;
Rectangle detailRectangle;
// Rectangle detailRectangle;
Rectangle pageFooterRectangle;
Rectangle reportFooterRectangle;
@ -143,10 +143,10 @@ namespace SharpReportCore{ @@ -143,10 +143,10 @@ namespace SharpReportCore{
public Rectangle DetailRectangle {
get {
return detailRectangle;
}
set {
detailRectangle = value;
return new Rectangle(this.pageHeaderRectangle.Left,
this.pageHeaderRectangle.Bottom,
this.pageFooterRectangle.Right,
this.pageFooterRectangle.Top);
}
}

1
src/AddIns/Misc/SharpReport/SharpReportCore/ReportViewer/ReportViewer.Designer.cs generated

@ -9,7 +9,6 @@ @@ -9,7 +9,6 @@
namespace SharpReportCore.ReportViewer
{
partial class PreviewControl : System.Windows.Forms.UserControl
// partial class PreviewControl : System.Windows.Forms.ScrollableControl
{
/// <summary>
/// Designer variable used to keep track of non-visual components.

40
src/AddIns/Misc/SharpReport/SharpReportCore/ReportViewer/ReportViewer.cs

@ -1,12 +1,13 @@ @@ -1,12 +1,13 @@
/*
* Created by SharpDevelop.
* User: Forstmeier Helmut
* User: Forstmeier Peter
* Date: 16.10.2006
* Time: 22:15
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Globalization;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
@ -24,7 +25,8 @@ namespace SharpReportCore.ReportViewer @@ -24,7 +25,8 @@ namespace SharpReportCore.ReportViewer
private PageSettings pageSettings;
private float zoom;
private Bitmap bitmap;
private List<SinglePage> pages;
// private List<SinglePage> pages;
private PagesCollection pages;
private int pageNumber;
private Rectangle PageRectangle () {
@ -82,16 +84,25 @@ namespace SharpReportCore.ReportViewer @@ -82,16 +84,25 @@ namespace SharpReportCore.ReportViewer
private void DrawItems (Graphics gr,ExporterCollection<BaseExportColumn> items) {
foreach (SharpReportCore.Exporters.BaseExportColumn ex in items) {
if (ex != null) {
ExportContainer cont = ex as ExportContainer;
if (cont == null) {
// System.Console.WriteLine("{0}",ex.GetType());
TextDrawer.PaintString(gr,ex.ToString(),ex.StyleDecorator);
ExportGraphic eg = ex as ExportGraphic;
if (eg != null) {
eg.StyleDecorator.DrawGraphic(gr);
} else {
TextDrawer.PaintString(gr,ex.ToString(),ex.StyleDecorator);
}
} else {
DrawItems(gr,cont.Items);
}
}
}
}
@ -104,13 +115,9 @@ namespace SharpReportCore.ReportViewer @@ -104,13 +115,9 @@ namespace SharpReportCore.ReportViewer
// Reset Transform to org. Value
gr.ScaleTransform(1F,1F);
gr.Clear(Color.Beige);
gr.Clear(this.panel2.BackColor);
gr.ScaleTransform(this.zoom,this.zoom);
// if (this.pageSettings != null) {
// gr.DrawRectangle(new Pen(Color.Black),
// this.PageRectangle ());
// }
DrawItems (gr,page.Items);
}
System.Console.WriteLine("\tready createBitmap {0}",DateTime.Now);
@ -129,7 +136,9 @@ namespace SharpReportCore.ReportViewer @@ -129,7 +136,9 @@ namespace SharpReportCore.ReportViewer
this.bitmap = this.BuildBitmap(sp);
this.toolStripTextBox1.Text = String.Empty;
string str = String.Format ("Page {0} of {1}",this.pageNumber +1,this.pages.Count);
string str = String.Format (CultureInfo.CurrentCulture,
"Page {0} of {1}",this.pageNumber +1,this.pages.Count);
this.toolStripTextBox1.Text = str;
this.Invalidate(true);
}
@ -184,12 +193,13 @@ namespace SharpReportCore.ReportViewer @@ -184,12 +193,13 @@ namespace SharpReportCore.ReportViewer
this.AdjustDrawArea();
}
}
public List<SinglePage> Pages {
set {
pages = value;
ShowPages();
public void SetPages (PagesCollection pages) {
this.pages = pages;
this.ShowPages();
}
public PagesCollection Pages {
get {
return this.pages;
}
}

1
src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj

@ -154,6 +154,7 @@ @@ -154,6 +154,7 @@
<DependentUpon>ReportViewer.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Exporter\ExporterCollection.cs" />
<Compile Include="Exporter\ExportColumns\ExportGraphic.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="BaseItems" />

Loading…
Cancel
Save