Browse Source

Update Examples with 'UnboundPushModel' Report

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1560 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 19 years ago
parent
commit
1eda97b187
  1. 22
      samples/SharpReport/ReportSamples/MainForm.Designer.cs
  2. 6
      samples/SharpReport/ReportSamples/MainForm.cs
  3. 2
      samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs
  4. 1
      samples/SharpReport/ReportSamples/ReportSamples.csproj
  5. 129
      samples/SharpReport/ReportSamples/UnboundPushModel.cs
  6. BIN
      samples/SharpReport/Unbound/PushModel/EmployesData.xsd
  7. 1
      samples/SharpReport/Unbound/PushModel/UnboundEmployees.srd

22
samples/SharpReport/ReportSamples/MainForm.Designer.cs generated

@ -49,8 +49,9 @@ namespace ReportSamples @@ -49,8 +49,9 @@ namespace ReportSamples
this.unboundToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.unboundToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.unboundPullModelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
this.multipageUnboundPullModelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.unboundPuskModelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit();
this.SuspendLayout();
@ -134,7 +135,8 @@ namespace ReportSamples @@ -134,7 +135,8 @@ namespace ReportSamples
this.unboundToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.unboundToolStripMenuItem1,
this.unboundPullModelToolStripMenuItem,
this.multipageUnboundPullModelToolStripMenuItem});
this.multipageUnboundPullModelToolStripMenuItem,
this.unboundPuskModelToolStripMenuItem});
this.unboundToolStripMenuItem.Name = "unboundToolStripMenuItem";
this.unboundToolStripMenuItem.Size = new System.Drawing.Size(62, 20);
this.unboundToolStripMenuItem.Text = "Unbound";
@ -153,10 +155,6 @@ namespace ReportSamples @@ -153,10 +155,6 @@ namespace ReportSamples
this.unboundPullModelToolStripMenuItem.Text = "UnboundPullModel";
this.unboundPullModelToolStripMenuItem.Click += new System.EventHandler(this.UnboundPullModelToolStripMenuItemClick);
//
// errorProvider1
//
this.errorProvider1.ContainerControl = this;
//
// multipageUnboundPullModelToolStripMenuItem
//
this.multipageUnboundPullModelToolStripMenuItem.Name = "multipageUnboundPullModelToolStripMenuItem";
@ -164,6 +162,17 @@ namespace ReportSamples @@ -164,6 +162,17 @@ namespace ReportSamples
this.multipageUnboundPullModelToolStripMenuItem.Text = "MultipageUnboundPullModel";
this.multipageUnboundPullModelToolStripMenuItem.Click += new System.EventHandler(this.MultipageUnboundPullModelToolStripMenuItemClick);
//
// unboundPuskModelToolStripMenuItem
//
this.unboundPuskModelToolStripMenuItem.Name = "unboundPuskModelToolStripMenuItem";
this.unboundPuskModelToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.unboundPuskModelToolStripMenuItem.Text = "UnboundPushModel";
this.unboundPuskModelToolStripMenuItem.Click += new System.EventHandler(this.UnboundPuskModelToolStripMenuItemClick);
//
// errorProvider1
//
this.errorProvider1.ContainerControl = this;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -179,6 +188,7 @@ namespace ReportSamples @@ -179,6 +188,7 @@ namespace ReportSamples
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.ToolStripMenuItem unboundPuskModelToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem multipageUnboundPullModelToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem unboundPullModelToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem unboundToolStripMenuItem1;

6
samples/SharpReport/ReportSamples/MainForm.cs

@ -303,5 +303,11 @@ namespace ReportSamples @@ -303,5 +303,11 @@ namespace ReportSamples
MultiPageUnboundPullModel mp = new MultiPageUnboundPullModel();
mp.Run();
}
void UnboundPuskModelToolStripMenuItemClick(object sender, System.EventArgs e)
{
UnboundPushModel u = new UnboundPushModel();
u.Run();
}
}
}

2
samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs

@ -44,6 +44,8 @@ namespace ReportSamples{ @@ -44,6 +44,8 @@ namespace ReportSamples{
MessageBox.Show(er.ToString(),"MainForm");
}
}
private void MultipagePrinting (object sender,SectionRenderEventArgs e) {
System.Console.WriteLine("UnboundPullPrinting");
CheckItems(e.Section.Items);

1
samples/SharpReport/ReportSamples/ReportSamples.csproj

@ -50,6 +50,7 @@ @@ -50,6 +50,7 @@
</EmbeddedResource>
<Compile Include="SimpleUnboundPullModel.cs" />
<Compile Include="MultipageUnboundPullModel.cs" />
<Compile Include="UnboundPushModel.cs" />
</ItemGroup>
<ItemGroup>
<COMReference Include="Microsoft ActiveX Data Objects 2.7 Library">

129
samples/SharpReport/ReportSamples/UnboundPushModel.cs

@ -0,0 +1,129 @@ @@ -0,0 +1,129 @@
/*
* Created by SharpDevelop.
* User: Forstmeier Helmut
* Date: 10.07.2006
* Time: 13:15
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Data;
using System.Windows.Forms;
using SharpReportCore;
namespace ReportSamples
{
/// <summary>
/// Description of UnboundPushModel.
/// </summary>
public class UnboundPushModel
{
int rowNr;
public UnboundPushModel()
{
}
public void Run() {
string reportFileName;
try
{
OpenFileDialog dg = new OpenFileDialog();
dg.Filter = "SharpReport files|*.srd";
dg.Title = "Select a report file: ";
if (dg.ShowDialog() == DialogResult.OK){
SharpReportCore.SharpReportEngine engine = new SharpReportCore.SharpReportEngine();
reportFileName = dg.FileName.ToString();
DataTable table = SelectData();
if (table != null) {
engine.SectionRendering += new EventHandler<SectionRenderEventArgs>(PushPrinting);
engine.SectionRendered += new EventHandler<SectionRenderEventArgs>(PushPrinted);
engine.PreviewPushDataReport(reportFileName,table);
// engine.PrintPushDataReport(reportFileName,table);
}
}
}
catch (Exception){
}
}
private DataTable SelectData()
{
OpenFileDialog dg = new OpenFileDialog();
dg.Filter = "SharpReport files|*.xsd";
dg.Title = "Select a '.xsdfile: ";
if (dg.ShowDialog() == DialogResult.OK){
DataSet ds = new DataSet();
ds.ReadXml(dg.FileName);
return ds.Tables[0];
}
return null;
}
private void PushPrinting (object sender,SectionRenderEventArgs e) {
System.Console.WriteLine("UnboundPushModel");
CheckItems(e.Section.Items);
switch (e.CurrentSection) {
case GlobalEnums.enmSection.ReportHeader:
System.Console.WriteLine("\tReportHeader");
break;
case GlobalEnums.enmSection.ReportPageHeader:
System.Console.WriteLine("\tPageheader");
System.Console.WriteLine("");
break;
case GlobalEnums.enmSection.ReportDetail:
this.rowNr ++;
System.Console.WriteLine("\tReportDetail");
RowItem ri = e.Section.Items[0] as RowItem;
if (ri != null) {
if (this.rowNr %2 == 0) {
ri.DrawBorder = true;
} else {
ri.DrawBorder = false;
}
}
break;
case GlobalEnums.enmSection.ReportPageFooter:
System.Console.WriteLine("\tPageFooter");
break;
case GlobalEnums.enmSection.ReportFooter:
System.Console.WriteLine("\tReportFooter");
BaseDataItem b = e.Section.Items.Find("ReportDbTextItem")as BaseDataItem;
if (b != null) {
b.DbValue = this.rowNr.ToString();
}
break;
default:
break;
}
}
private void PushPrinted (object sender,SectionRenderEventArgs e) {
// System.Console.WriteLine("---Rendering done <{0}>-----",e.CurrentSection);
}
private void CheckItems (ReportItemCollection items) {
foreach (BaseReportItem i in items) {
// System.Console.WriteLine("\tItem {0}",i.Name);
IContainerItem container = i as IContainerItem;
if (container != null) {
// System.Console.WriteLine("\t\tContainer found");
CheckItems (container.Items);
}
}
}
}
}

BIN
samples/SharpReport/Unbound/PushModel/EmployesData.xsd

Binary file not shown.

1
samples/SharpReport/Unbound/PushModel/UnboundEmployees.srd

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save