📄 printtransactmans.cs
字号:
using System;
using System.Data ;
using System.Web .UI.WebControls ;
namespace OI.ReceivDocument
{
/// <summary>
/// printTransactMans 的摘要说明。
/// </summary>
public class printTransactMans :System.Web .UI .Page
{
public printTransactMans()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
/// <summary>
///
/// </summary>
/// <param name="dt"></param>
/// <param name="Count">一行显示的个数,</param>
/// <returns></returns>
public Table CreatePrintTable( DataTable dt ,int Count)
{
int TotalRow=dt.Rows.Count / Count; //总共有多少项,即有多少张表。
int CellLastRow=dt.Rows .Count % Count; //最后一行有列数。
Table tab=new Table ();
for ( int i=0 ;i <TotalRow; i++)
{
TableRow tabTr=new TableRow ();
TableCell tabTrCell=new TableCell ();
Table table=new Table ();
//指针移量
TableRow tr=new TableRow ();
TableCell tc=new TableCell ();
tc.Text ="阅 件 者";
tc.Width =Unit.Parse("16%");
tr.Cells .Add (tc);
for(int move= i*Count;move<i*Count+Count;move++)
{
tc=new TableCell ();
tc.Text =dt.Rows[move]["username"].ToString ();
tc.Width =Unit.Parse("14%");
tr.Cells .Add (tc);
}
tr.Attributes["align"]="center";
table.Rows .Add (tr);//增加处理用户
tr=new TableRow ();
tc=new TableCell ();
tc.Text ="送件时间";
tr.Cells .Add (tc);
for(int move= i*Count;move<i*Count+Count;move++)
{
tc=new TableCell ();
tc.Text =dt.Rows[move]["senddate"].ToString ();
tr.Cells .Add (tc);
}
tr.Attributes["align"]="center";
table.Rows .Add (tr);//增加发送日期
tr=new TableRow ();
tc=new TableCell ();
tc.Text ="退件时间";
tr.Cells .Add (tc);
for(int move= i*Count;move<i*Count+Count;move++)
{
tc=new TableCell ();
tc.Text =dt.Rows[move]["transactdate"].ToString ()+" ";
tr.Cells .Add (tc);
}
tr.Attributes["align"]="center";
table.Rows .Add (tr);//增加处理日期
table.CellSpacing =0;
table.CellPadding=0;
table.Attributes ["border"]="1";
table.Attributes["width"]="100%" ;
tabTrCell.Controls .Add (table);
tabTr.Cells .Add (tabTrCell);
tab.Rows .Add (tabTr);
}
//以上处理完整数项,即几张表。
//以下处理半张表,
//-----------------------------------------------------------------------------------------------------------
if (CellLastRow >0)
{
TableRow tabTr2=new TableRow ();
TableCell tabTrCell2=new TableCell ();
//*********************************************8
Table table2=new Table ();
TableRow tr2=new TableRow ();
TableCell tc2=new TableCell ();
tc2.Text ="阅 件 者 ";
tc2.Width =Unit.Parse("16%");
tr2.Cells .Add (tc2);
for(int i=TotalRow * Count;i< TotalRow * Count+CellLastRow;i++)
{
tc2=new TableCell ();
tc2.Width =Unit.Parse("14%");
tc2.Text =dt.Rows[i]["username"].ToString ();
tr2.Cells .Add (tc2);
}
for(int i=0; i<Count- CellLastRow; i++)
{
tc2=new TableCell ();
tc2.Text =" ";
tc2.Width =Unit.Parse("14%");
tr2.Cells .Add (tc2);
}
tr2.Attributes["align"]="center";
table2.Rows .Add (tr2);
//*************************************************
tr2=new TableRow ();
tc2=new TableCell ();
tc2.Text ="送件时间";
tr2.Cells .Add (tc2);
for(int i=TotalRow * Count;i< TotalRow * Count+CellLastRow;i++)
{
tc2=new TableCell ();
tc2.Text =dt.Rows[i]["senddate"].ToString ();
tr2.Cells .Add (tc2);
}
for(int i=0; i<Count- CellLastRow; i++)
{
tc2=new TableCell ();
tc2.Text =" ";
tc2.Width =Unit.Parse("14%");
tr2.Cells .Add (tc2);
}
tr2.Attributes["align"]="center";
table2.Rows .Add (tr2);
//******************************************************
tr2=new TableRow ();
tc2=new TableCell ();
tc2.Text ="退件时间";
tr2.Cells .Add (tc2);
for(int i=TotalRow * Count;i< TotalRow * Count+CellLastRow;i++)
{
tc2=new TableCell ();
tc2.Text =dt.Rows[i]["transactdate"].ToString ()+" ";
tr2.Cells .Add (tc2);
}
for(int i=0; i<Count- CellLastRow; i++)
{
tc2=new TableCell ();
tc2.Text =" ";
tr2.Cells .Add (tc2);
}
tr2.Attributes["align"]="center";
table2.Rows .Add (tr2);
table2.Attributes ["border"]="1";
table2.Attributes["width"]="100%" ;
table2.CellPadding =0;
table2.CellSpacing =0;
tabTrCell2.Controls .Add (table2);
tabTr2.Cells .Add (tabTrCell2);
tab.Rows .Add (tabTr2);
}
tab.Attributes ["border"]="0";
tab.CellPadding =0;
tab.CellSpacing =0;
tab.Attributes["width"]="100%" ;
return tab;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -