DevExpress.XtraReport动态报表的制作_宋迪@的博客-程序员宅基地

技术标签: UI  J#  SQL  

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Collections.Generic;
namespace DL698AmmeterTest.form
{
public partial class XtraReport1 : DevExpress.XtraReports.UI.XtraReport
{
private string _changShang;//厂商
private string _sn;//型号
private string _type;//类型
private string _songJianRen;//送检人
private string _ceShiDanWei;//测试单位
private string _ceShiRen;//测试人

private TestPlan _testPlan;//测试计划(批次)
private List<TestItem> _listTI;//测试项
private List<Ammeter> _listAmmeter;//测试结果

private ReportOptions ro = new ReportOptions();
public XtraReport1()
{
InitializeComponent();
}

public XtraReport1(TestPlan testPlan, List<TestItem> listTI, List<Ammeter> listAmmeter)
{
InitializeComponent();
this._testPlan = testPlan;
if (listTI != null && listTI.Count > 0)
{
this._listTI = listTI;
}
else
{
this._listTI = new List<TestItem>();
}
if (listAmmeter != null && listAmmeter.Count > 0)
{
this._listAmmeter = listAmmeter;
}
else
{
this._listAmmeter = new List<Ammeter>();
}
}
//设置标题
public void setTitle()
{


this.xrLabelTitle.Text = this._testPlan.Test_name;

}


public void setFoot()
{


}


public void setBody()
{
Int64 planid = this._testPlan.Id;


foreach (Ammeter ammeter in this._listAmmeter)
{

//创建panel1,并将label及表头加入

XRPanel xrPanel1 = new XRPanel();
xrPanel1.Location = new Point(0, getY());

xrPanel1.Size = new Size(PageWidth - Margins.Left - Margins.Right, 42);
this.Detail.Controls.Add(xrPanel1);

XRLabel xrLabel1 = new XRLabel();
xrLabel1.Text = "电能表号:";
xrLabel1.Location = new Point(0, 8);
xrLabel1.Size = new Size(Convert.ToInt32(xrPanel1.Width * 0.13), 25);
xrLabel1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrPanel1.Controls.Add(xrLabel1);

//填写表号的label
XRLabel xrLabel2 = new XRLabel();
xrLabel2.Location = new Point(xrLabel1.Location.X + xrLabel1.Width, 8);
xrLabel2.Size = new Size(Convert.ToInt32(xrPanel1.Width * 0.2), 25);
xrLabel2.Text = ammeter.Ammeter_adc_id;
xrLabel2.Font = new Font("宋体", 10, FontStyle.Underline);
xrLabel2.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrPanel1.Controls.Add(xrLabel2);

XRLabel xrLabel3 = new XRLabel();
xrLabel3.Text = "送检单位:";
xrLabel3.Location = new Point(xrLabel2.Location.X + xrLabel2.Width, 8);
xrLabel3.Size = new Size(Convert.ToInt32(xrPanel1.Width * 0.13), 25);
xrLabel3.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrPanel1.Controls.Add(xrLabel3);

//填写送检单位的label
XRLabel xrLabel4 = new XRLabel();
xrLabel4.Location = new Point(xrLabel3.Location.X + xrLabel3.Width, 8);
xrLabel4.Size = new Size(Convert.ToInt32(xrPanel1.Width * 0.23), 25);
xrLabel4.Text = this._testPlan.Comsumer_name;
xrLabel4.Font = new Font("宋体", 10, FontStyle.Underline);
xrLabel4.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrPanel1.Controls.Add(xrLabel4);

XRLabel xrLabel5 = new XRLabel();
xrLabel5.Text = "测试日期:";
xrLabel5.Location = new Point(xrLabel4.Location.X + xrLabel4.Width, 8);
xrLabel5.Size = new Size(Convert.ToInt32(xrPanel1.Width * 0.13), 25);
xrLabel5.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrPanel1.Controls.Add(xrLabel5);

//
XRLabel xrLabel6 = new XRLabel();
xrLabel6.Location = new Point(xrLabel5.Location.X + xrLabel5.Width, 8);
xrLabel6.Size = new Size(Convert.ToInt32(xrPanel1.Width * 0.18), 25);
xrLabel6.Text = this._testPlan.Test_time.Year + "年" + this._testPlan.Test_time.Month + "月" + this._testPlan.Test_time.Day + "日";
xrLabel6.Font = new Font("宋体", 10, FontStyle.Underline);
xrLabel6.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrPanel1.Controls.Add(xrLabel6);

//panel2,装表格
XRPanel xrPanel2 = new XRPanel();
xrPanel2.Location = new Point(0, xrPanel1.Location.Y + 25);
xrPanel2.Size = new Size(xrPanel1.Width, 42);


this.Detail.Controls.Add(xrPanel2);

List<TestResult> listTr = ro.findByPlanIDAndAmmeterAdc_TestResult(planid, ammeter.Ammeter_adc_id);
List<TestData> listTd = new List<TestData>();

XRTable xrTable1 = new XRTable();
xrTable1.BorderWidth = 1;
xrTable1.Borders = DevExpress.XtraPrinting.BorderSide.All;
xrTable1.Location = new Point(0, 8);

// xrTable1.Size = new Size(xrPanel2.Width, 25*(listTr.Count+2)/3);
xrTable1.Size = new Size(xrPanel2.Width, 25);
//第一行,表头
XRTableRow xrTableRow1 = new XRTableRow();
XRTableCell xrTableCell1 = new XRTableCell();
XRTableCell xrTableCell2 = new XRTableCell();
XRTableCell xrTableCell3 = new XRTableCell();
xrTableRow1.Size = new Size(xrTable1.Width, 25);
xrTableRow1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTable1.Rows.Add(xrTableRow1);
//第一行,第一列

xrTableCell1.Size = new Size(Convert.ToInt32(xrTableRow1.Width * 0.4), 25);
xrTableCell1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell1.Font = new Font("宋体", 10, FontStyle.Bold);
xrTableCell1.Width = Convert.ToInt32(xrTableRow1.Width * 0.4);
xrTableCell1.Text = "抄收数据项";
//第一行,第二列
//XRTableCell xrTableCell2 = new XRTableCell();
xrTableCell2.Size = new Size(Convert.ToInt32(xrTableRow1.Width * 0.3), 25);
xrTableCell2.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell2.Font = new Font("宋体", 10, FontStyle.Bold);
xrTableCell2.Width = Convert.ToInt32(xrTableRow1.Width * 0.3);
xrTableCell2.Text = "抄收实时数据";
//第一行,第三列
//XRTableCell xrTableCell3 = new XRTableCell();
xrTableCell3.Size = new Size(Convert.ToInt32(xrTableRow1.Width * 0.3), 25);
xrTableCell3.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell3.Font = new Font("宋体", 10, FontStyle.Bold);
xrTableCell3.Width = Convert.ToInt32(xrTableRow1.Width * 0.3);
xrTableCell3.Text = "抄收冻结数据";

xrTableRow1.Cells.Add(xrTableCell1);
xrTableRow1.Cells.Add(xrTableCell2);
xrTableRow1.Cells.Add(xrTableCell3);


foreach (TestItem testItem in this._listTI)
{
TestData td = new TestData();
td.Test_item = testItem.Name;
td.Result1 = "电能表没有该功能";
td.Result2 = "电能表没有该功能";
listTd.Add(td);
foreach (TestResult testResult in listTr)
{

if (testItem.Id == testResult.Test_item_id)
{


foreach (TestData td1 in listTd)
{
if (td1.Test_item == testItem.Name)
{
if (testResult.Type.Substring(0,2)=="01")
{
td1.Result1 = "通过";

}
else if (testResult.Type.Substring(0,2) == "02")
{
td1.Result2 = "通过";
}


}
}


}
}


}
foreach (TestData testData in listTd)
{
xrTable1.Height = xrTable1.Height + 25;
XRTableRow xrTableRow2 = new XRTableRow();
xrTableRow2.Size = xrTableRow1.Size;

XRTableCell xrTableCell4 = new XRTableCell();
xrTableCell4.Size = xrTableCell1.Size;
xrTableCell4.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrTableCell4.Width = xrTableCell1.Width;
xrTableCell4.Text = testData.Test_item;
xrTableRow2.Cells.Add(xrTableCell4);

XRTableCell xrTableCell5 = new XRTableCell();
xrTableCell5.Size = xrTableCell2.Size;
xrTableCell5.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrTableCell5.Width = xrTableCell2.Width;
xrTableCell5.Text = testData.Result1;
xrTableRow2.Cells.Add(xrTableCell5);

XRTableCell xrTableCell6 = new XRTableCell();
xrTableCell6.Size = xrTableCell3.Size;
xrTableCell6.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrTableCell6.Width = xrTableCell3.Width;
xrTableCell6.Text = testData.Result2;
xrTableRow2.Cells.Add(xrTableCell6);

//xrTable1.Rows.AddRange(new XRTableRow[] { xrTableRow2 });
xrTable1.Rows.Add(xrTableRow2);

}
xrPanel2.Controls.Add(xrTable1);

//panel3,装表底
XRPanel xrPanel3 = new XRPanel();
xrPanel3.Location = new Point(0, xrPanel2.Location.Y + xrPanel2.Height + 10);
xrPanel3.Size = new Size(xrPanel2.Width, 150);

XRLabel xrLabel8 = new XRLabel();
xrLabel8.Text = "(具体的抄收数据报文、解析数据作为附录)";
xrLabel8.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrLabel8.Location = new Point(0, 0);
xrLabel8.Size = new Size(Convert.ToInt32(xrPanel3.Width * 0.6), 25);
xrPanel3.Controls.Add(xrLabel8);

XRLabel xrLabel9 = new XRLabel();
xrLabel9.Text = "测试人员:";
xrLabel9.Location = new Point(308, 33);
xrLabel9.Size = new Size(Convert.ToInt32(xrPanel3.Width * 0.2), 25);
xrLabel9.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrPanel3.Controls.Add(xrLabel9);

XRLabel xrLabel10 = new XRLabel();
xrLabel10.Text = "测试单位: (盖章有效)";
xrLabel10.Location = new Point(308, 75);
xrLabel10.Size = new Size(Convert.ToInt32(xrPanel3.Width * 0.3), 25);
xrLabel10.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrPanel3.Controls.Add(xrLabel10);

XRLabel xrLabel11 = new XRLabel();
xrLabel11.Text = "日  期:";
xrLabel11.Location = new Point(308, 117);
xrLabel11.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrLabel11.Size = new Size(Convert.ToInt32(xrPanel3.Width * 0.3), 25);
xrPanel3.Controls.Add(xrLabel11);

this.Detail.Controls.Add(xrPanel3);

XRPageBreak xrPageBreak0 = new XRPageBreak();
Detail.Controls.Add(xrPageBreak0);
xrPageBreak0.Location = new Point(0, xrPanel3.Location.Y + xrPanel3.Height + 10);
//附抄收数据结果
//sql:select t1.id , t1.ammeter_id,t1.result,t1.plant_id, t2.name as test_item,t1.happen_time from test_result as t1 join test_item as t2 on t1.test_item=t2.id
//SELECT t1.ID, t1.AMMETER_ID, t1.RESULT, t1.PLANT_ID, t2.NAME AS Test_Item, t1.HAPPEN_TIME FROM TEST_RESULT AS t1 INNER JOINTEST_ITEM AS t2 ON t1.TEST_ITEM = t2.ID WHERE (t1.PLANT_ID = 1) AND (t1.AMMETER_ID = '000000000011')
//panel4,装附加信息
XRPanel xrPanel4 = new XRPanel();
xrPanel4.Location = new Point(0, xrPageBreak0.Location.Y);
xrPanel4.Size = new Size(xrPanel3.Width, 42);

this.Detail.Controls.Add(xrPanel4);
List<TestResult> listResultData = ro.findTestResult1(planid, ammeter.Ammeter_adc_id);

XRLabel xrLabelf = new XRLabel();
xrLabelf.Text = "附表:";
xrLabelf.Location = new Point(0, 0);
xrLabelf.Size = new Size(83, 25);
xrLabelf.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
xrPanel4.Controls.Add(xrLabelf);

int pages = 0;
if (listResultData.Count % 34 == 0)
{
pages = listResultData.Count / 34;
}
else
{
pages = listResultData.Count / 34 + 1;
}
int num = 0;
int tablex = 0;
int tabley = 30;
int n = 0;
for (int p = 1; p <= pages; p++)
{
XRTable xrTable3 = new XRTable();
xrTable3.Location = new Point(tablex, tabley);
//xrTable3.Size = new Size(xrPanel4.Width, 25 * (listResultData.Count + 6) / 7);
xrTable3.Size = new Size(xrPanel4.Width, 25);
xrTable3.Borders = DevExpress.XtraPrinting.BorderSide.All;
xrTable3.BorderWidth = 1;
xrTable3.Font = new Font("宋体", 8);

xrPanel4.Controls.Add(xrTable3);
XRTableRow xrTableRow3 = new XRTableRow();
xrTableRow3.Size = new Size(xrTable3.Width, 25);

//xrTable3.Rows.Add(xrTableRow3);


XRTableCell xrTableCell_3 = new XRTableCell();
xrTableCell_3.Size = new Size(Convert.ToInt32(xrTableRow3.Width * 0.05), 25);
//xrTableCell_3.Size = new Size(83, 25);
// xrTableCell_3.Width = Convert.ToInt32(xrTableRow3.Width * 0.1);
xrTableCell_3.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_3.Font = new Font("宋体", 8, FontStyle.Bold);
xrTableCell_3.Text = "编号";
xrTableRow3.Cells.Add(xrTableCell_3);

XRTableCell xrTableCell_4 = new XRTableCell();
xrTableCell_4.Size = new Size(Convert.ToInt32(xrTableRow3.Width * 0.15), 25);
//xrTableCell_4.Size = new Size(165, 25);
//xrTableCell_4.Width = Convert.ToInt32(xrTableRow3.Width * 0.2);
xrTableCell_4.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_4.Font = new Font("宋体", 8, FontStyle.Bold);
xrTableCell_4.Text = "电能表编号";
xrTableRow3.Cells.Add(xrTableCell_4);

XRTableCell xrTableCell_5 = new XRTableCell();
xrTableCell_5.Size = new Size(Convert.ToInt32(xrTableRow3.Width * 0.2), 25);
//xrTableCell_5.Size = new Size(83, 25);
//xrTableCell_5.Width = Convert.ToInt32(xrTableRow3.Width * 0.1);
xrTableCell_5.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_5.Font = new Font("宋体", 8, FontStyle.Bold);
xrTableCell_5.Text = "抄收结果";
xrTableRow3.Cells.Add(xrTableCell_5);

//XRTableCell xrTableCell_6 = new XRTableCell();
//xrTableCell_6.Size = new Size(Convert.ToInt32(xrTableRow3.Width * 0.1), 25);
xrTableCell_6.Size = new Size(83, 25);
xrTableCell_6.Width = Convert.ToInt32(xrTableRow3.Width * 0.1);
//xrTableCell_6.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
//xrTableCell_6.Font = new Font("宋体", 10, FontStyle.Bold);
//xrTableCell_6.Text = "计划批次";
//xrTableRow3.Cells.Add(xrTableCell_6);

XRTableCell xrTableCell_7 = new XRTableCell();
xrTableCell_7.Size = new Size(Convert.ToInt32(xrTableRow3.Width * 0.2), 25);
//xrTableCell_7.Size = new Size(165, 25);
//xrTableCell_7.Width = Convert.ToInt32(xrTableRow3.Width * 0.2);
xrTableCell_7.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_7.Font = new Font("宋体", 8, FontStyle.Bold);
xrTableCell_7.Text = "测试项目";
xrTableRow3.Cells.Add(xrTableCell_7);

XRTableCell xrTableCell_8 = new XRTableCell();
xrTableCell_8.Size = new Size(Convert.ToInt32(xrTableRow3.Width * 0.2), 25);
//xrTableCell_8.Size = new Size(165, 25);
//xrTableCell_8.Width = Convert.ToInt32(xrTableRow3.Width * 0.2);
xrTableCell_8.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_8.Font = new Font("宋体", 8, FontStyle.Bold);
xrTableCell_8.Text = "测试时间";
xrTableRow3.Cells.Add(xrTableCell_8);

XRTableCell xrTableCell_9 = new XRTableCell();
//xrTableCell_9.Size = new Size(Convert.ToInt32(xrTableRow3.Width * 0.1), 25);
//xrTableCell_9.Size = new Size(83, 25);
xrTableCell_9.Size = new Size(Convert.ToInt32(xrTableRow3.Width * 0.2), 25);
xrTableCell_9.Width = Convert.ToInt32(xrTableRow3.Width * 0.1);
xrTableCell_9.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_9.Font = new Font("宋体", 8, FontStyle.Bold);
xrTableCell_9.Text = "类型";
xrTableRow3.Cells.Add(xrTableCell_9);

xrTable3.Height = xrTable3.Height + 25;
xrTable3.Rows.Add(xrTableRow3);
int pagestemp = 0;
if (p * 34 > listResultData.Count)
{
pagestemp = listResultData.Count;
}
else
{
pagestemp = p * 34;
}

for (int j = n; j < pagestemp; j++)
{
num++;
n++;
TestResult tr2 = listResultData[j];
xrTable3.Height = xrTable3.Height + 25;
XRTableRow xrTableRow_3 = new XRTableRow();
xrTableRow_3.Size = xrTableRow3.Size;
// xrTable3.Rows.Add(xrTableRow_3);
xrTableRow_3.Borders = DevExpress.XtraPrinting.BorderSide.All;
xrTableRow_3.BorderWidth = 1;
XRTableCell xrTableCell_31 = new XRTableCell();
xrTableCell_31.Size = xrTableCell_3.Size;
xrTableCell_31.Width = xrTableCell_3.Width;
xrTableCell_31.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_31.Text = num.ToString();
xrTableCell_31.Borders = DevExpress.XtraPrinting.BorderSide.All;
xrTableCell_31.BorderWidth = 1;
xrTableRow_3.Cells.Add(xrTableCell_31);

XRTableCell xrTableCell_41 = new XRTableCell();
xrTableCell_41.Size = xrTableCell_4.Size;
xrTableCell_41.Width = xrTableCell_4.Width;
xrTableCell_41.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_41.Text = tr2.Ammeter_id;
xrTableCell_41.Borders = DevExpress.XtraPrinting.BorderSide.All;
xrTableCell_41.BorderWidth = 1;
xrTableRow_3.Cells.Add(xrTableCell_41);

XRTableCell xrTableCell_51 = new XRTableCell();
xrTableCell_51.Size = xrTableCell_5.Size;
xrTableCell_51.Width = xrTableCell_5.Width;
xrTableCell_51.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_51.Text = tr2.Result;
xrTableCell_51.Borders = DevExpress.XtraPrinting.BorderSide.All;
xrTableCell_51.BorderWidth = 1;
xrTableRow_3.Cells.Add(xrTableCell_51);

//XRTableCell xrTableCell_61 = new XRTableCell();
//xrTableCell_61.Size = xrTableCell_6.Size;
//xrTableCell_61.Width = xrTableCell_6.Width;
//xrTableCell_61.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
//xrTableCell_61.Text = tr2.Plan_id.ToString();
//xrTableCell_61.Borders = DevExpress.XtraPrinting.BorderSide.All;
//xrTableCell_61.BorderWidth = 1;
//xrTableRow_3.Cells.Add(xrTableCell_61);

XRTableCell xrTableCell_71 = new XRTableCell();
xrTableCell_71.Size = xrTableCell_7.Size;
xrTableCell_71.Width = xrTableCell_7.Width;
xrTableCell_71.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_71.Text = tr2.Test_item_string;
xrTableCell_71.Borders = DevExpress.XtraPrinting.BorderSide.All;
xrTableCell_71.BorderWidth = 1;
xrTableRow_3.Cells.Add(xrTableCell_71);

XRTableCell xrTableCell_81 = new XRTableCell();
xrTableCell_81.Size = xrTableCell_8.Size;
xrTableCell_81.Width = xrTableCell_8.Width;
xrTableCell_81.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_81.Text = tr2.Happen_time.ToString();
xrTableCell_81.Borders = DevExpress.XtraPrinting.BorderSide.All;
xrTableCell_81.BorderWidth = 1;
xrTableRow_3.Cells.Add(xrTableCell_81);

XRTableCell xrTableCell_91 = new XRTableCell();
xrTableCell_91.Size = xrTableCell_9.Size;
xrTableCell_91.Width = xrTableCell_9.Width;
xrTableCell_91.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
xrTableCell_91.Borders = DevExpress.XtraPrinting.BorderSide.All;
xrTableCell_91.BorderWidth = 1;
if (tr2.Type.Equals("0100"))
{
xrTableCell_91.Text = "实时";
}
else if (tr2.Type.Equals("0200"))
{
xrTableCell_91.Text = "冻结(5min)";
}
else if (tr2.Type.Equals("0201"))
{
xrTableCell_91.Text = "冻结(15min)";
}
else if (tr2.Type.Equals("0202"))
{
xrTableCell_91.Text = "冻结(30min)";
}
else if (tr2.Type.Equals("0203"))
{
xrTableCell_91.Text = "冻结(60min)";
}
else if (tr2.Type.Equals("0204"))
{
xrTableCell_91.Text = "冻结(24h)";
}
else if (tr2.Type.Equals("0205"))
{
xrTableCell_91.Text = "冻结(1mon)";
}
xrTableRow_3.Cells.Add(xrTableCell_91);

xrTable3.Rows.Add(xrTableRow_3);

}
if (p == pages)
{

}
else
{
XRPageBreak xrPageBreak3 = new XRPageBreak();
Detail.Controls.Add(xrPageBreak3);
xrPageBreak3.Location = new Point(0, xrTable3.Location.Y + xrTable3.Height + 10);
tablex = 0;

tabley = xrTable3.Location.Y + xrTable3.Height + 60;
}
}


XRPageBreak xrPageBreak1 = new XRPageBreak();
Detail.Controls.Add(xrPageBreak1);
xrPageBreak1.Location = new Point(0, xrPanel4.Location.Y + xrPanel4.Height + 10);

}


}

private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
setBody();

}

private void ReportHeader_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
setTitle();
}

//得到最后一个控件的位置X
public int getX()
{
XRControlCollection ce = this.Detail.Controls;
XRControl obj = ce[ce.Count - 1];
return obj.Location.X;
}
//得到最后一个控件的位置Y
public int getY()
{
XRControlCollection ce = this.Detail.Controls;
int y = 8;
//for (int i = ce.Count - 1; i >= 0; i--)
//{
// XRControl obj = ce[i];
// if (obj.ToString() == "DevExpress.XtraReports.UI.XRPanel")
// {
// y = obj.Location.Y + obj.Size.Height+10;
// break;
// }
// //if (obj.ToString() == "DevExpress.XtraReports.UI.XRPageBreak")
// //{
// // y = obj.Location.Y;
// // break;
// //}

//}
if (ce != null && ce.Count > 0)
{
XRControl obj = ce[ce.Count - 1];
y = obj.Location.Y + obj.Size.Height + 10;
}

return y;
}
public int getHeadY()
{
XRControlCollection ce = this.Detail.Controls;
int y = 8;
for (int i = ce.Count - 1; i >= 0; i--)
{
XRControl obj = ce[i];
if (obj.ToString() == "DevExpress.XtraReports.UI.XRPanel")
{
y = obj.Location.Y + 25;
break;
}
//if (obj.ToString() == "DevExpress.XtraReports.UI.XRPageBreak")
//{
// y = obj.Location.Y;
// break;
//}

}
return y;
}
public int getXrPanel4Height(XRControl xrc)
{
XRControlCollection ce = xrc.Controls;
int y = 0;
for (int i = 0; i < ce.Count; i++)
{
y = y + ce[i].Location.Y + ce[i].Height;
}
return y + xrc.Location.Y;
}


}
}


在这数据就不上传了,请大家根据需要自己更改数据源
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/songqping/article/details/83401939

智能推荐

欧拉定理相关及扩展欧几里得_DeepStarSky的博客-程序员宅基地

威尔逊定理、费马定理、欧拉函数、欧拉定理、逆元、exgcd威尔逊定理:(p−1)!≡−1(modp)(p-1)! \equiv -1 \pmod p(p−1)!≡−1(modp),当且仅当ppp为质数。其中: (p−1)!(p-1)!(p−1)!表示p−1p-1p−1的阶乘,即1∗2∗3∗⋯∗(p−1)1*2*3*\dots*(p-1)1∗2∗3∗⋯∗(p−1)。证明:先证充分性: 即“ppp为质数”→\rightarrow→ (p−1)!≡−1(modp)(p-1)! \equiv -1 \pmo

MacOS Big Sur睡眠状态下耗电量大的问题解决方法_as_jopo的博客-程序员宅基地

问题描述合上Macbook Pro (2018款15寸)的屏幕,一晚上消耗电池50%的电量。查看电池使用记录,显示在这期间有11瓦的功耗一直在运行(使用iStat软件可以监控系统功耗)。解决方案经过测试,以下两步可以解决这个问题。1.关闭“查找我的Mac”2.使进入“勿扰”模式...

传输层TCP和UDP协议的介绍,让你快速了解_带着壳的兔L的博客-程序员宅基地

传输层TCP和UDP协议的介绍,让你快速了解TCP协议介绍TCP报文格式TCP三次握手TCP四次挥手UDP协议介绍常用的TCP端口号及其功能常用的UDP端口号及其功能TCP协议介绍TCP叫做传输控制协议TCP是面向连接的、可靠的进程到进程通信的协议TCP提供全双工服务,即数据可在同一时间双向传输,每一个TCP都有发送缓存和接收缓存,用来临时存储数据。TCP报文段TCP将若干个字节构成一个分组,叫报文段(Segment)TCP报文段封装在IP数据报中TCP报文格式序号:发送端为每个字节进

ROS topic,service和action的使用场景_weixin_30394981的博客-程序员宅基地

参考:ROS中关于topic和service的运用场合Topics特点:1.单向,分工明确,处理连续数据流,topic是一种多对多的形式,一个Node可以订阅多个Topic,可以publish到多个topic上。2.topic中的数据只要准备好了,就可以被回调函数调用。而发送端的topic的发送时机由publisher自己决定。场景:1.连续比如收发传感器数据,收发控制指令Serv...

将图片归一化以及翻转的c++小程序_Devil_Satan的博客-程序员宅基地_c++ 图像归一化

环境:vs2010+opencv 2.4.9功能:实现图片的归一化和翻转用途:在训练数据时,使图片统一化尺寸数据:yale大学的人脸数据库.链接(免积分):http://download.csdn.net/detail/zcf1784266476/9800933#include <afxwin.h>#include <iostream>#include <opencv2/highgui/high

随便推点

国家高新技术企业门户与移动全生态开发套件-Zooma!逐浪CMS v8.1.4正式发布_逐浪CMS发哥的博客-程序员宅基地

快速下载:https://www.z01.com/down/3580.shtml国家级高新企业荣誉[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ozCTFayh-1587397546752)(https://www.z01.com/UploadFiles/Anony/content/md/HyjMvO5XZP…jpg “高新技术企业证书”)]十五载风雨历程...

JL 杰理 AC692N系列TWS 蓝牙音箱 开发_WEIXIN- FY1174801586的博客-程序员宅基地_ac692 tws

一、简要说明随着时间的推移,TWS蓝牙技术也广泛应用于音箱当中,主要采用relay转发模式。目前杰理公司所推出针对音箱方案的是AC692N系列,也必将成为今后一年内的音箱产品的主选方案。二、开发细节(一)连接方式选择1、首次开机手动连接方式(开机后通过按键手动进行连接)2、首次开机自动连接可通过u8 get_tws_mem_role(void)函数获取,若函数get_tws_de...

[BalticOI 2004]Sequence_C202044zxy的博客-程序员宅基地

一、题目点此看题二、解法第一步可以把aia_iai​和bib_ibi​都减去iii,结果不会变,但是单调递增就变成了单调不减。考虑∣x−a∣+∣x−b∣|x-a|+|x-b|∣x−a∣+∣x−b∣之类的问题最优解就是取中位数(我们默认选后面那位),我们可以把原序列划分成若干的子序列,每一个子序列的中位数就是局部的最优解,需要满足单调不减。我们用可并堆维护中位数,我们每次加入一个点,当 前一...

UITableView那些坑_子虚的博客-程序员宅基地

iOS prior to 6.0(included) is not considered. A respondsToSelector check might be needed in term of compatibility, or exceptions like“unrecognized selector sent to instance” will occur.1. eliminat

AOP知识点_神愛世人-的博客-程序员宅基地

切入点表达式1.bean表达式@Pointcut("bean(类名)")说明: 根据bean的ID拦截指定的对象@Pointcut("bean(userServiceImpl)") public void pointcut(){ }2 within表达式

jsp中c:foreach标签遍历问题_Aitex的博客-程序员宅基地

HTTP Status 500 - javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in &lt;forEach&gt;type Exception reportmessage javax.servlet.

推荐文章

热门文章

相关标签