namespace MyNamespace { using System; using System.Data; using System.Xml; using XDesignerDom; using XDesignerProperty; using XDesignerGUI; using XDesignerCommon; using XDesigner.Report;
/// <summary>新增文档</summary> public class MyClass : DesignReportDocument {
/// <summary>Initalize document.</summary> public MyClass() { // Begin of initalize document this.Loading = true; this.Desc = "新增文档"; this.Title = "新增文档"; this.HeadHeight = 72; this.Bounds = new System.Drawing.Rectangle(0, 0, 601, 300); this.PageLeftMargin = 96; this.PageTopMargin = 96; this.PageRightMargin = 96; this.PageBottomMargin = 96; // element reporttable1 DesignReportTable reporttable1 = this.CreateTableElement(); this.AppendChild(reporttable1); reporttable1.ID = "reporttable1"; reporttable1.Bounds = new System.Drawing.Rectangle(0, 0, 599, 126); reporttable1.PrintDockStyle = XDesigner.Report.PrintDockStyle.Top; reporttable1.InnerDataSource = "地区列表"; // element Col0 DesignReportTableColumn Col0 = this.CreateTableColumnElement(); reporttable1.AppendChild(Col0); Col0.ID = "Col0"; Col0.Width = 119; // element Col1 DesignReportTableColumn Col1 = this.CreateTableColumnElement(); reporttable1.AppendChild(Col1); Col1.ID = "Col1"; Col1.Width = 164; // element Col2 DesignReportTableColumn Col2 = this.CreateTableColumnElement(); reporttable1.AppendChild(Col2); Col2.ID = "Col2"; Col2.Width = 75; // element Col3 DesignReportTableColumn Col3 = this.CreateTableColumnElement(); reporttable1.AppendChild(Col3); Col3.ID = "Col3"; Col3.Width = 122; // element Col4 DesignReportTableColumn Col4 = this.CreateTableColumnElement(); reporttable1.AppendChild(Col4); Col4.ID = "Col4"; Col4.Width = 119; // element Row0 DesignReportTableRow Row0 = this.CreateTableRowElement(); reporttable1.AppendChild(Row0); Row0.ID = "Row0"; Row0.Height = 41; Row0.TableHead = true; // element A1 DesignReportTableCell A1 = this.CreateTableCellElement(); Row0.AppendChild(A1); A1.ID = "A1"; A1.Bounds = new System.Drawing.Rectangle(0, 0, 599, 41); A1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold); A1.ColSpan = 5; A1.Text = "分组客户列表"; A1.Align = System.Drawing.StringAlignment.Center; // element B1 DesignReportTableCell B1 = this.CreateTableCellElement(); Row0.AppendChild(B1); B1.ID = "B1"; B1.Bounds = new System.Drawing.Rectangle(119, 0, 164, 30); B1.BorderWidth = 1; B1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); B1.Align = System.Drawing.StringAlignment.Center; // element C1 DesignReportTableCell C1 = this.CreateTableCellElement(); Row0.AppendChild(C1); C1.ID = "C1"; C1.Bounds = new System.Drawing.Rectangle(283, 0, 75, 30); C1.BorderWidth = 1; C1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); C1.Align = System.Drawing.StringAlignment.Center; // element D1 DesignReportTableCell D1 = this.CreateTableCellElement(); Row0.AppendChild(D1); D1.ID = "D1"; D1.Bounds = new System.Drawing.Rectangle(358, 0, 122, 30); D1.BorderWidth = 1; D1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); D1.Align = System.Drawing.StringAlignment.Center; // element E1 DesignReportTableCell E1 = this.CreateTableCellElement(); Row0.AppendChild(E1); E1.ID = "E1"; E1.Bounds = new System.Drawing.Rectangle(480, 0, 119, 30); E1.BorderWidth = 1; E1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); E1.Align = System.Drawing.StringAlignment.Center; // element Row00 DesignReportTableRow Row00 = this.CreateTableRowElement(); reporttable1.AppendChild(Row00); Row00.ID = "Row0"; Row00.Height = 31; Row00.TableHead = true; // element A10 DesignReportTableCell A10 = this.CreateTableCellElement(); Row00.AppendChild(A10); A10.ID = "A1"; A10.Bounds = new System.Drawing.Rectangle(0, 41, 119, 31); A10.BorderWidth = 1; A10.BackColor = System.Drawing.Color.FromArgb(255, 166, 210, 255); A10.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); A10.Text = "联系人"; // element B10 DesignReportTableCell B10 = this.CreateTableCellElement(); Row00.AppendChild(B10); B10.ID = "B1"; B10.Bounds = new System.Drawing.Rectangle(119, 41, 164, 31); B10.BorderWidth = 1; B10.BackColor = System.Drawing.Color.FromArgb(255, 166, 210, 255); B10.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); B10.Text = "公司名称"; // element C10 DesignReportTableCell C10 = this.CreateTableCellElement(); Row00.AppendChild(C10); C10.ID = "C1"; C10.Bounds = new System.Drawing.Rectangle(283, 41, 75, 31); C10.BorderWidth = 1; C10.BackColor = System.Drawing.Color.FromArgb(255, 166, 210, 255); C10.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); C10.Text = "城市"; // element D10 DesignReportTableCell D10 = this.CreateTableCellElement(); Row00.AppendChild(D10); D10.ID = "D1"; D10.Bounds = new System.Drawing.Rectangle(358, 41, 122, 31); D10.BorderWidth = 1; D10.BackColor = System.Drawing.Color.FromArgb(255, 166, 210, 255); D10.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); D10.Text = "联系地址"; // element E10 DesignReportTableCell E10 = this.CreateTableCellElement(); Row00.AppendChild(E10); E10.ID = "E1"; E10.Bounds = new System.Drawing.Rectangle(480, 41, 119, 31); E10.BorderWidth = 1; E10.BackColor = System.Drawing.Color.FromArgb(255, 166, 210, 255); E10.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); E10.Text = "联系电话"; // element Row1 DesignReportTableRow Row1 = this.CreateTableRowElement(); reporttable1.AppendChild(Row1); Row1.ID = "Row1"; Row1.Height = 26; // element A2 DesignReportTableCell A2 = this.CreateTableCellElement(); Row1.AppendChild(A2); A2.ID = "A2"; A2.Bounds = new System.Drawing.Rectangle(0, 72, 599, 26); A2.BorderWidth = 1; A2.BackColor = System.Drawing.Color.FromArgb(255, 250, 235, 215); A2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); A2.ColSpan = 5; A2.Text = "[地区名称]地区 共[客户个数]个用户"; // element B2 DesignReportTableCell B2 = this.CreateTableCellElement(); Row1.AppendChild(B2); B2.ID = "B2"; B2.Bounds = new System.Drawing.Rectangle(0, 0, 164, 30); B2.BorderWidth = 1; B2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); // element C2 DesignReportTableCell C2 = this.CreateTableCellElement(); Row1.AppendChild(C2); C2.ID = "C2"; C2.Bounds = new System.Drawing.Rectangle(0, 0, 75, 30); C2.BorderWidth = 1; C2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); // element D2 DesignReportTableCell D2 = this.CreateTableCellElement(); Row1.AppendChild(D2); D2.ID = "D2"; D2.Bounds = new System.Drawing.Rectangle(0, 0, 119, 30); D2.BorderWidth = 1; D2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); // element E2 DesignReportTableCell E2 = this.CreateTableCellElement(); Row1.AppendChild(E2); E2.ID = "E2"; E2.Bounds = new System.Drawing.Rectangle(0, 0, 119, 30); E2.BorderWidth = 1; E2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); // element Row10 DesignReportTableRow Row10 = this.CreateTableRowElement(); reporttable1.AppendChild(Row10); Row10.ID = "Row1"; Row10.DataSource = "客户列表"; Row10.Height = 28; // element A20 DesignReportTableCell A20 = this.CreateTableCellElement(); Row10.AppendChild(A20); A20.ID = "A2"; A20.Bounds = new System.Drawing.Rectangle(0, 98, 119, 28); A20.BorderWidth = 1; A20.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); A20.Text = "[ContactName]"; // element B20 DesignReportTableCell B20 = this.CreateTableCellElement(); Row10.AppendChild(B20); B20.ID = "B2"; B20.Bounds = new System.Drawing.Rectangle(119, 98, 164, 28); B20.BorderWidth = 1; B20.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); B20.Text = "[CompanyName]"; // element C20 DesignReportTableCell C20 = this.CreateTableCellElement(); Row10.AppendChild(C20); C20.ID = "C2"; C20.Bounds = new System.Drawing.Rectangle(283, 98, 75, 28); C20.BorderWidth = 1; C20.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); C20.Text = "[City]"; // element D20 DesignReportTableCell D20 = this.CreateTableCellElement(); Row10.AppendChild(D20); D20.ID = "D2"; D20.Bounds = new System.Drawing.Rectangle(358, 98, 122, 28); D20.BorderWidth = 1; D20.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); D20.Text = "[Address]"; // element E20 DesignReportTableCell E20 = this.CreateTableCellElement(); Row10.AppendChild(E20); E20.ID = "E2"; E20.Bounds = new System.Drawing.Rectangle(480, 98, 119, 28); E20.BorderWidth = 1; E20.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); E20.Text = "[Phone]"; // Add datasource define *************************** // initalize variable // create 地区列表 ReportDataSourceElement 地区列表 = this.CreateDataSourceElement(); this.DataSourceDocument.Add(地区列表); 地区列表.Name = "地区列表"; 地区列表.SQL = " Select distinct\r\n Customers.Region\r\n From \r\n Customers\r\n order by region"; // create 地区列表_地区名称 ReportDataSourceElement 地区列表_地区名称 = this.CreateDataSourceElement(); 地区列表.Add(地区列表_地区名称); 地区列表_地区名称.Name = "地区名称"; 地区列表_地区名称.FieldName = "Customers.Region"; // create 地区列表_客户个数 ReportDataSourceElement 地区列表_客户个数 = this.CreateDataSourceElement(); 地区列表.Add(地区列表_客户个数); 地区列表_客户个数.Name = "客户个数"; 地区列表_客户个数.FieldName = "Customers.Region"; 地区列表_客户个数.SQL = "select count(*) from Customers Where Region = \'[%value%]\'"; // create 地区列表_客户列表 ReportDataSourceElement 地区列表_客户列表 = this.CreateDataSourceElement(); 地区列表.Add(地区列表_客户列表); 地区列表_客户列表.Name = "客户列表"; 地区列表_客户列表.FieldName = "Customers.Region"; 地区列表_客户列表.SQL = " Select \r\n Customers.ContactName , \r\n Customers.CompanyName , \r\n Custome" + "rs.ContactTitle , \r\n Customers.Address , \r\n Customers.City , \r\n Custome" + "rs.Phone\r\n From \r\n Customers\r\n where region =\'[%value%]\'"; // create 地区列表_客户列表_ContactName ReportDataSourceElement 地区列表_客户列表_ContactName = this.CreateDataSourceElement(); 地区列表_客户列表.Add(地区列表_客户列表_ContactName); 地区列表_客户列表_ContactName.Name = "ContactName"; 地区列表_客户列表_ContactName.FieldName = "Customers.ContactName"; // create 地区列表_客户列表_CompanyName ReportDataSourceElement 地区列表_客户列表_CompanyName = this.CreateDataSourceElement(); 地区列表_客户列表.Add(地区列表_客户列表_CompanyName); 地区列表_客户列表_CompanyName.Name = "CompanyName"; 地区列表_客户列表_CompanyName.FieldName = "Customers.CompanyName"; // create 地区列表_客户列表_ContactTitle ReportDataSourceElement 地区列表_客户列表_ContactTitle = this.CreateDataSourceElement(); 地区列表_客户列表.Add(地区列表_客户列表_ContactTitle); 地区列表_客户列表_ContactTitle.Name = "ContactTitle"; 地区列表_客户列表_ContactTitle.FieldName = "Customers.ContactTitle"; // create 地区列表_客户列表_Address ReportDataSourceElement 地区列表_客户列表_Address = this.CreateDataSourceElement(); 地区列表_客户列表.Add(地区列表_客户列表_Address); 地区列表_客户列表_Address.Name = "Address"; 地区列表_客户列表_Address.FieldName = "Customers.Address"; // create 地区列表_客户列表_City ReportDataSourceElement 地区列表_客户列表_City = this.CreateDataSourceElement(); 地区列表_客户列表.Add(地区列表_客户列表_City); 地区列表_客户列表_City.Name = "City"; 地区列表_客户列表_City.FieldName = "Customers.City"; // create 地区列表_客户列表_Phone ReportDataSourceElement 地区列表_客户列表_Phone = this.CreateDataSourceElement(); 地区列表_客户列表.Add(地区列表_客户列表_Phone); 地区列表_客户列表_Phone.Name = "Phone"; 地区列表_客户列表_Phone.FieldName = "Customers.Phone"; this.Loading = false; // End of initalize document } } } |
Option Strict Off Option Explicit On
Imports System Imports System.Data Imports System.Xml Imports XDesigner.Report Imports XDesignerCommon Imports XDesignerDom Imports XDesignerGUI Imports XDesignerProperty
Namespace MyNamespace
'<summary>新增文档</summary>
Public Class [MyClass] Inherits DesignReportDocument
'<summary>Initalize document.</summary>
Public Sub New() MyBase.New 'Begin of initalize document Me.Loading = true Me.Desc = "新增文档" Me.Title = "新增文档" Me.HeadHeight = 72 Me.Bounds = New System.Drawing.Rectangle(0, 0, 601, 300) Me.PageLeftMargin = 96 Me.PageTopMargin = 96 Me.PageRightMargin = 96 Me.PageBottomMargin = 96 'element reporttable1 Dim reporttable1 As DesignReportTable = Me.CreateTableElement Me.AppendChild(reporttable1) reporttable1.ID = "reporttable1" reporttable1.Bounds = New System.Drawing.Rectangle(0, 0, 599, 126) reporttable1.PrintDockStyle = XDesigner.Report.PrintDockStyle.Top reporttable1.InnerDataSource = "地区列表" 'element Col0 Dim Col0 As DesignReportTableColumn = Me.CreateTableColumnElement reporttable1.AppendChild(Col0) Col0.ID = "Col0" Col0.Width = 119 'element Col1 Dim Col1 As DesignReportTableColumn = Me.CreateTableColumnElement reporttable1.AppendChild(Col1) Col1.ID = "Col1" Col1.Width = 164 'element Col2 Dim Col2 As DesignReportTableColumn = Me.CreateTableColumnElement reporttable1.AppendChild(Col2) Col2.ID = "Col2" Col2.Width = 75 'element Col3 Dim Col3 As DesignReportTableColumn = Me.CreateTableColumnElement reporttable1.AppendChild(Col3) Col3.ID = "Col3" Col3.Width = 122 'element Col4 Dim Col4 As DesignReportTableColumn = Me.CreateTableColumnElement reporttable1.AppendChild(Col4) Col4.ID = "Col4" Col4.Width = 119 'element Row0 Dim Row0 As DesignReportTableRow = Me.CreateTableRowElement reporttable1.AppendChild(Row0) Row0.ID = "Row0" Row0.Height = 41 Row0.TableHead = true 'element A1 Dim A1 As DesignReportTableCell = Me.CreateTableCellElement Row0.AppendChild(A1) A1.ID = "A1" A1.Bounds = New System.Drawing.Rectangle(0, 0, 599, 41) A1.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Bold) A1.ColSpan = 5 A1.Text = "分组客户列表" A1.Align = System.Drawing.StringAlignment.Center 'element B1 Dim B1 As DesignReportTableCell = Me.CreateTableCellElement Row0.AppendChild(B1) B1.ID = "B1" B1.Bounds = New System.Drawing.Rectangle(119, 0, 164, 30) B1.BorderWidth = 1 B1.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) B1.Align = System.Drawing.StringAlignment.Center 'element C1 Dim C1 As DesignReportTableCell = Me.CreateTableCellElement Row0.AppendChild(C1) C1.ID = "C1" C1.Bounds = New System.Drawing.Rectangle(283, 0, 75, 30) C1.BorderWidth = 1 C1.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) C1.Align = System.Drawing.StringAlignment.Center 'element D1 Dim D1 As DesignReportTableCell = Me.CreateTableCellElement Row0.AppendChild(D1) D1.ID = "D1" D1.Bounds = New System.Drawing.Rectangle(358, 0, 122, 30) D1.BorderWidth = 1 D1.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) D1.Align = System.Drawing.StringAlignment.Center 'element E1 Dim E1 As DesignReportTableCell = Me.CreateTableCellElement Row0.AppendChild(E1) E1.ID = "E1" E1.Bounds = New System.Drawing.Rectangle(480, 0, 119, 30) E1.BorderWidth = 1 E1.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) E1.Align = System.Drawing.StringAlignment.Center 'element Row00 Dim Row00 As DesignReportTableRow = Me.CreateTableRowElement reporttable1.AppendChild(Row00) Row00.ID = "Row0" Row00.Height = 31 Row00.TableHead = true 'element A10 Dim A10 As DesignReportTableCell = Me.CreateTableCellElement Row00.AppendChild(A10) A10.ID = "A1" A10.Bounds = New System.Drawing.Rectangle(0, 41, 119, 31) A10.BorderWidth = 1 A10.BackColor = System.Drawing.Color.FromArgb(255, 166, 210, 255) A10.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) A10.Text = "联系人" 'element B10 Dim B10 As DesignReportTableCell = Me.CreateTableCellElement Row00.AppendChild(B10) B10.ID = "B1" B10.Bounds = New System.Drawing.Rectangle(119, 41, 164, 31) B10.BorderWidth = 1 B10.BackColor = System.Drawing.Color.FromArgb(255, 166, 210, 255) B10.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) B10.Text = "公司名称" 'element C10 Dim C10 As DesignReportTableCell = Me.CreateTableCellElement Row00.AppendChild(C10) C10.ID = "C1" C10.Bounds = New System.Drawing.Rectangle(283, 41, 75, 31) C10.BorderWidth = 1 C10.BackColor = System.Drawing.Color.FromArgb(255, 166, 210, 255) C10.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) C10.Text = "城市" 'element D10 Dim D10 As DesignReportTableCell = Me.CreateTableCellElement Row00.AppendChild(D10) D10.ID = "D1" D10.Bounds = New System.Drawing.Rectangle(358, 41, 122, 31) D10.BorderWidth = 1 D10.BackColor = System.Drawing.Color.FromArgb(255, 166, 210, 255) D10.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) D10.Text = "联系地址" 'element E10 Dim E10 As DesignReportTableCell = Me.CreateTableCellElement Row00.AppendChild(E10) E10.ID = "E1" E10.Bounds = New System.Drawing.Rectangle(480, 41, 119, 31) E10.BorderWidth = 1 E10.BackColor = System.Drawing.Color.FromArgb(255, 166, 210, 255) E10.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) E10.Text = "联系电话" 'element Row1 Dim Row1 As DesignReportTableRow = Me.CreateTableRowElement reporttable1.AppendChild(Row1) Row1.ID = "Row1" Row1.Height = 26 'element A2 Dim A2 As DesignReportTableCell = Me.CreateTableCellElement Row1.AppendChild(A2) A2.ID = "A2" A2.Bounds = New System.Drawing.Rectangle(0, 72, 599, 26) A2.BorderWidth = 1 A2.BackColor = System.Drawing.Color.FromArgb(255, 250, 235, 215) A2.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) A2.ColSpan = 5 A2.Text = "[地区名称]地区 共[客户个数]个用户" 'element B2 Dim B2 As DesignReportTableCell = Me.CreateTableCellElement Row1.AppendChild(B2) B2.ID = "B2" B2.Bounds = New System.Drawing.Rectangle(0, 0, 164, 30) B2.BorderWidth = 1 B2.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) 'element C2 Dim C2 As DesignReportTableCell = Me.CreateTableCellElement Row1.AppendChild(C2) C2.ID = "C2" C2.Bounds = New System.Drawing.Rectangle(0, 0, 75, 30) C2.BorderWidth = 1 C2.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) 'element D2 Dim D2 As DesignReportTableCell = Me.CreateTableCellElement Row1.AppendChild(D2) D2.ID = "D2" D2.Bounds = New System.Drawing.Rectangle(0, 0, 119, 30) D2.BorderWidth = 1 D2.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) 'element E2 Dim E2 As DesignReportTableCell = Me.CreateTableCellElement Row1.AppendChild(E2) E2.ID = "E2" E2.Bounds = New System.Drawing.Rectangle(0, 0, 119, 30) E2.BorderWidth = 1 E2.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) 'element Row10 Dim Row10 As DesignReportTableRow = Me.CreateTableRowElement reporttable1.AppendChild(Row10) Row10.ID = "Row1" Row10.DataSource = "客户列表" Row10.Height = 28 'element A20 Dim A20 As DesignReportTableCell = Me.CreateTableCellElement Row10.AppendChild(A20) A20.ID = "A2" A20.Bounds = New System.Drawing.Rectangle(0, 98, 119, 28) A20.BorderWidth = 1 A20.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) A20.Text = "[ContactName]" 'element B20 Dim B20 As DesignReportTableCell = Me.CreateTableCellElement Row10.AppendChild(B20) B20.ID = "B2" B20.Bounds = New System.Drawing.Rectangle(119, 98, 164, 28) B20.BorderWidth = 1 B20.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular) B20.Text = "[CompanyName]"
|