2024-05-08 17:17:11 +08:00
using BLL ;
using NPOI.SS.UserModel ;
using NPOI.SS.Util ;
using NPOI.XSSF.UserModel ;
using System ;
using System.Collections.Generic ;
using System.Data ;
using System.Data.SqlClient ;
using System.IO ;
using System.Linq ;
using System.Web ;
using System.Web.UI ;
namespace FineUIPro.Web.ContinuousPrint
{
public partial class HardnessTestOrderPrint : PageBase
{
protected void Page_Load ( object sender , EventArgs e )
{
if ( ! IsPostBack )
{
BindGrid ( ) ;
}
}
#region 绑 定 Grid1
/// <summary>
/// 绑定Grid1
/// </summary>
public void BindGrid ( )
{
var project = BLL . Base_ProjectService . GetOnProjectListByUserId ( this . CurrUser . UserId , "1" ) ;
if ( ! string . IsNullOrEmpty ( txtProjectCode . Text ) )
{
project = project . Where ( e = > e . ProjectCode . Contains ( txtProjectCode . Text . Trim ( ) ) ) . ToList ( ) ;
}
Grid1 . RecordCount = project . Count ;
var table = this . GetPagedDataTable ( Grid1 , project ) ;
Grid1 . DataSource = table ;
Grid1 . DataBind ( ) ;
}
#endregion
#region 绑 定 Grid2
/// <summary>
/// 绑定Grid2
/// </summary>
public void BindGrid1 ( string ProjectId )
{
var str = string . Empty ;
//是否打印
if ( ! string . IsNullOrEmpty ( this . drpIsPrint . SelectedValue ) )
{
str + = " and a.IsPrintTrust=" + this . drpIsPrint . SelectedValue + "" ;
}
string strSql = @"select a.HardTestReportId,a.HardTestReportCode,a.ProjectId,b.ProjectName,a.ISO_ID,a.TrustUnitId,a.TestDate,a.InstrumentType,a.HotProessState,a.SurfaceAppearance,a.TestMethod,a.ContractUnit,a.IsPrintReport,(case a.IsPrintReport when 1 then '已打印' else '未打印' end) as IsPrintReportName,(case a.IsPrintTrust when 1 then '已打印' else '未打印' end) as IsPrintTrustName from HJGL_CH_HardTestReport as a inner join Base_Project as b on a.ProjectId=b.ProjectId where a.ProjectId=@ProjectId" + str ;
List < SqlParameter > listStr = new List < SqlParameter > ( ) ;
listStr . Add ( new SqlParameter ( "@ProjectId" , ProjectId ) ) ;
SqlParameter [ ] parameter = listStr . ToArray ( ) ;
2025-02-14 16:48:50 +08:00
DataTable dt = SQLHelper . GetDataTableRunText ( strSql , parameter ) ;
DataView view = dt . DefaultView ;
if ( ! string . IsNullOrEmpty ( Grid2 . SortField ) & & view . Count > 0 )
{
view . Sort = String . Format ( "{0} {1}" , Grid2 . SortField , Grid2 . SortDirection ) ;
}
DataTable table = view . ToTable ( ) ;
Grid2 . DataSource = table ;
2024-05-08 17:17:11 +08:00
Grid2 . DataBind ( ) ;
Grid2 . SelectAllRows ( ) ;
}
#endregion
#region 分 页 、 排 序
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange ( object sender , GridPageEventArgs e )
{
Grid1 . PageIndex = e . NewPageIndex ;
BindGrid ( ) ;
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged ( object sender , EventArgs e )
{
Grid1 . PageSize = Convert . ToInt32 ( ddlPageSize . SelectedValue ) ;
BindGrid ( ) ;
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort ( object sender , FineUIPro . GridSortEventArgs e )
{
BindGrid ( ) ;
}
2025-02-14 16:48:50 +08:00
protected void Grid2_Sort ( object sender , FineUIPro . GridSortEventArgs e )
{
BindGrid1 ( this . Grid1 . SelectedRowID ) ;
}
2024-05-08 17:17:11 +08:00
#endregion
#region 选 择 加 载
/// <summary>
/// 选择加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowClick ( object sender , GridRowClickEventArgs e )
{
BindGrid1 ( this . Grid1 . SelectedRowID ) ;
}
#endregion
#region 私 有 方 法
/// <summary>
/// 得到热处理类型
/// </summary>
/// <returns></returns>
protected string ConvertProessTypes ( object ProessTypes )
{
string proessTypes = string . Empty ;
if ( ProessTypes ! = null )
{
proessTypes = BLL . HJGL_PW_JointInfoService . ConvertProessTypes ( ProessTypes . ToString ( ) ) ;
}
return proessTypes ;
}
#endregion
#region 关 闭 弹 出 窗 口
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close ( object sender , EventArgs e )
{
BindGrid ( ) ;
}
#endregion
#region 查 询
/// <summary>
/// 查询
/// </summary>
protected void btnSubmit_Click ( object sender , EventArgs e )
{
BindGrid ( ) ;
}
/// <summary>
/// 是否打印
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpIsPrint_SelectedIndexChanged ( object sender , EventArgs e )
{
BindGrid1 ( this . Grid1 . SelectedRowID ) ;
}
#endregion
#region 硬 度 试 验 委 托 单 打 印
/// <summary>
/// 硬度试验委托单打印
/// </summary>
protected void btnPrint_Click ( object sender , EventArgs e )
{
if ( Grid2 . SelectedRowIndexArray . Length < = 0 )
{
Alert . ShowInTop ( "最少选中一行!" , MessageBoxIcon . Warning ) ;
return ;
}
string rootPath = Server . MapPath ( "~/" ) + Const . ExcelUrl ;
//导出文件
string filePath = rootPath + DateTime . Now . ToString ( "yyyyMMddhhmmss" ) + "\\" ;
if ( ! Directory . Exists ( filePath ) )
{
Directory . CreateDirectory ( filePath ) ;
}
string ReportFileName = filePath + "out1.xlsx" ;
if ( Grid2 . Rows . Count > 0 )
{
int rowIndex = 0 ;
XSSFWorkbook hssfworkbook = new XSSFWorkbook ( ) ;
XSSFSheet ws = ( XSSFSheet ) hssfworkbook . CreateSheet ( "硬度试验委托单" ) ;
#region 列 宽
ws . SetColumnWidth ( 0 , ( 9 * 256 ) + 55 ) ; //(8.67)8.64
ws . SetColumnWidth ( 1 , ( 11 * 256 ) + 100 ) ; //(10.83)10.82
ws . SetColumnWidth ( 2 , ( 12 * 256 ) + 100 ) ; //(11.83)11.82
ws . SetColumnWidth ( 3 , ( 11 * 256 ) + 55 ) ; //(10.67)10.64
ws . SetColumnWidth ( 4 , ( 14 * 256 ) + 100 ) ; //(13.83)13.82
ws . SetColumnWidth ( 5 , ( 9 * 256 ) + 100 ) ; //(8.83)8.82
ws . SetColumnWidth ( 6 , ( 9 * 256 ) + 126 ) ; //(8.92)8.91
ws . SetColumnWidth ( 7 , ( 10 * 256 ) + 200 ) ; //(9.17)9.18
#endregion
for ( int gi = 0 ; gi < Grid2 . Rows . Count ; gi + + )
{
if ( Grid2 . SelectedRowIndexArray . Contains ( gi ) )
{
System . Web . UI . WebControls . HiddenField hidHardTestReportId = Grid2 . Rows [ gi ] . FindControl ( "hidHardTestReportId" ) as System . Web . UI . WebControls . HiddenField ;
System . Web . UI . WebControls . HiddenField hidProjectName = Grid2 . Rows [ gi ] . FindControl ( "hidProjectName" ) as System . Web . UI . WebControls . HiddenField ;
//打印赋值
Model . HJGL_CH_HardTestReport report = BLL . HJGL_CH_HardTestReportService . GetCH_HardTestReportByID ( hidHardTestReportId . Value ) ;
if ( report ! = null )
{
report . IsPrintTrust = true ;
report . PrintTrustDate = DateTime . Now ;
report . TrustName = report . HotHardCode + "-" + string . Format ( "{0:yyyy-MM-dd}" , DateTime . Now ) ;
BLL . HJGL_CH_HardTestReportService . UpdateCH_HardTestReport ( report ) ;
}
//头部
var listTitleStr = new List < SqlParameter > ( ) ;
listTitleStr . Add ( new SqlParameter ( "@HardTestReportId" , hidHardTestReportId . Value ) ) ;
SqlParameter [ ] titleparameter = listTitleStr . ToArray ( ) ;
var tbTitle = SQLHelper . GetDataTableRunProc ( "HJGL_spCH_HardTestReport" , titleparameter ) ;
//列表
var listStr = new List < SqlParameter > ( ) ;
listStr . Add ( new SqlParameter ( "@HardTestReportId" , hidHardTestReportId . Value ) ) ;
SqlParameter [ ] parameter = listStr . ToArray ( ) ;
var tb = SQLHelper . GetDataTableRunProc ( "HJGL_spCH_HardTestReportItemDistinct2" , parameter ) ;
if ( tb . Rows . Count > 0 & & tbTitle . Rows . Count > 0 )
{
CellRangeAddress region ;
var pageNum = tb . Rows . Count < 27 ? 1
: Math . Ceiling ( ( float ) ( tb . Rows . Count - 27 ) / 38 ) + 1 ;
//公共样式
ICellStyle style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , HorizontalAlignment . Center , 10 , true ) ;
//循环页
for ( int i = 1 ; i < = pageNum ; i + + )
{
//每页数据开始和结束条数
var dStart = 0 ;
var dEnd = 0 ;
//数据开始行和结束行
var tStart = 0 ;
var tEnd = 0 ;
#region 头 部 和 每 页 数 据 参 数
//第一页和第二页需要创建头
if ( i = = 1 )
{
//创建头部行和列
ws = ExcelCreateRowTitle ( ws , hssfworkbook , rowIndex , rowIndex + 6 , style , 0 , 7 ) ;
//取数据开始和结束条数
dStart = 0 ;
dEnd = 27 ;
//数据开始行和结束行
tStart = rowIndex + 7 ;
tEnd = rowIndex + 34 ;
#region 头 部
//行1
region = new CellRangeAddress ( rowIndex , rowIndex , 0 , 7 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex ) . GetCell ( 0 ) . SetCellValue ( "硬 度 试 验 委 托 单" ) ;
//行2
ws . GetRow ( rowIndex + 1 ) . GetCell ( 0 ) . SetCellValue ( "项目名称" ) ;
region = new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 1 , 2 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 1 ) . SetCellValue ( tbTitle . Rows [ 0 ] [ "ProjectName" ] . ToString ( ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . SetCellValue ( "施 工 号" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 4 ) . SetCellValue ( tbTitle . Rows [ 0 ] [ "ProjectCode" ] . ToString ( ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 5 ) . SetCellValue ( "委托编号" ) ;
region = new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 6 , 7 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 6 ) . SetCellValue ( tbTitle . Rows [ 0 ] [ "HotHardCode" ] . ToString ( ) ) ;
//行3
ws . GetRow ( rowIndex + 2 ) . GetCell ( 0 ) . SetCellValue ( "委托单位" ) ;
region = new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 1 , 2 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 1 ) . SetCellValue ( tbTitle . Rows [ 0 ] [ "TrustUnitName" ] . ToString ( ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 3 ) . SetCellValue ( "检件名称" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 4 ) . SetCellValue ( "管道焊缝" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 5 ) . SetCellValue ( "委托日期" ) ;
region = new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 6 , 7 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 6 ) . SetCellValue ( tbTitle . Rows [ 0 ] [ "TestDate" ] . ToString ( ) ) ;
//行4
ws . GetRow ( rowIndex + 3 ) . GetCell ( 0 ) . SetCellValue ( "检测单位" ) ;
region = new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 1 , 2 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 1 ) . SetCellValue ( "广东华泰检测科技有限公司" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 3 ) . SetCellValue ( "热处理状态" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 4 ) . SetCellValue ( tbTitle . Rows [ 0 ] [ "HotProessState" ] . ToString ( ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "检验比例" ) ;
region = new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 6 , 7 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 6 ) . SetCellValue ( "100%" ) ;
//行5
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . SetCellValue ( "检验方法" ) ;
region = new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 1 , 2 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( tbTitle . Rows [ 0 ] [ "TestMethod" ] . ToString ( ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 3 ) . SetCellValue ( "试验标准" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 4 ) . SetCellValue ( tbTitle . Rows [ 0 ] [ "TestStandard" ] . ToString ( ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "被检验产品标准" ) ;
region = new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 6 , 7 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 6 ) . SetCellValue ( "SH 3501-2011" ) ;
//行6
ws . GetRow ( rowIndex + 5 ) . GetCell ( 0 ) . SetCellValue ( "委托人" ) ;
region = new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 1 , 2 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 1 ) . SetCellValue ( "" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 3 ) . SetCellValue ( "审核人" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 4 ) . SetCellValue ( "" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . SetCellValue ( "接收人" ) ;
region = new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 6 , 7 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 6 ) . SetCellValue ( "" ) ;
//行7
ws . GetRow ( rowIndex + 6 ) . GetCell ( 0 ) . SetCellValue ( "序号" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 1 ) . SetCellValue ( "检测批号" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 2 ) . SetCellValue ( "检件编号" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 3 ) . SetCellValue ( "焊缝编号" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 4 ) . SetCellValue ( "焊缝规格" ) ;
region = new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 5 , 6 ) ;
ws . AddMergedRegion ( region ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . SetCellValue ( "材质" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 7 ) . SetCellValue ( "备注" ) ;
#endregion
}
else
{
var pNum = ( i - 1 ) * 38 ;
//取数据开始和结束条数
dStart = 27 + ( ( i - 2 ) * 38 ) ;
dEnd = 27 + pNum ;
//数据开始行和结束行
tStart = rowIndex ;
tEnd = rowIndex + 38 ;
}
#endregion
#region 数 据
//创建数据行和列
ws = ExcelCreateRow ( ws , hssfworkbook , tStart , tEnd , style , 0 , 7 ) ;
//获取当前页数据
var pageTb = GetPageToTable ( tb , dStart , dEnd ) ;
//遍历数据
for ( int j = 0 ; j < pageTb . Rows . Count ; j + + )
{
var dataRow = tStart + j ;
ws . GetRow ( dataRow ) . GetCell ( 0 ) . SetCellValue ( pageTb . Rows [ j ] [ "Number" ] . ToString ( ) ) ;
ws . GetRow ( dataRow ) . GetCell ( 1 ) . SetCellValue ( pageTb . Rows [ j ] [ "BatchCode" ] . ToString ( ) ) ;
ws . GetRow ( dataRow ) . GetCell ( 2 ) . SetCellValue ( pageTb . Rows [ j ] [ "ISO_IsoNo" ] . ToString ( ) ) ;
ws . GetRow ( dataRow ) . GetCell ( 3 ) . SetCellValue ( pageTb . Rows [ j ] [ "JOT_JointNo" ] . ToString ( ) ) ;
ws . GetRow ( dataRow ) . GetCell ( 4 ) . SetCellValue ( pageTb . Rows [ j ] [ "JOT_JointDesc" ] . ToString ( ) ) ;
ws . GetRow ( dataRow ) . GetCell ( 5 ) . SetCellValue ( pageTb . Rows [ j ] [ "STE_Code" ] . ToString ( ) ) ;
ws . GetRow ( dataRow ) . GetCell ( 7 ) . SetCellValue ( pageTb . Rows [ j ] [ "RemarkStr" ] . ToString ( ) ) ;
}
#endregion
rowIndex = tEnd + 2 ;
}
}
}
}
ws . SetMargin ( MarginType . LeftMargin , 0.5 ) ;
ws . SetMargin ( MarginType . RightMargin , 0.5 ) ;
//ws.SetMargin(MarginType.BottomMargin, 0.8);
//ws.SetMargin(MarginType.TopMargin, 0.8);
//ws.SetMargin(MarginType.FooterMargin, 0.5);
//ws.SetMargin(MarginType.HeaderMargin, 0.5);
ws . PrintSetup . Landscape = false ;
ws . PrintSetup . PaperSize = 9 ;
ws . ForceFormulaRecalculation = true ;
using ( FileStream filess = File . OpenWrite ( ReportFileName ) )
{
hssfworkbook . Write ( filess ) ;
}
FileInfo filet = new FileInfo ( ReportFileName ) ;
Response . Clear ( ) ;
Response . Charset = "GB2312" ;
Response . ContentEncoding = System . Text . Encoding . UTF8 ;
// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
Response . AddHeader ( "Content-Disposition" , "attachment; filename=" + Server . UrlEncode ( "硬度试验委托单.xlsx" ) ) ;
// 添加头信息,指定文件大小,让浏览器能够显示下载进度
Response . AddHeader ( "Content-Length" , filet . Length . ToString ( ) ) ;
// 指定返回的是一个不能被客户端读取的流,必须被下载
Response . ContentType = "application/ms-excel" ;
// 把文件流发送到客户端
Response . WriteFile ( filet . FullName ) ;
// 停止页面的执行
Response . End ( ) ;
}
}
#endregion
#region 私 有 方 法
/// <summary>
/// 数据行和列
/// </summary>
/// <returns></returns>
private XSSFSheet ExcelCreateRow ( XSSFSheet ws , XSSFWorkbook hssfworkbook , int sRows , int eRows , ICellStyle style , int cStart , int cEnd )
{
CellRangeAddress region ;
for ( int i = sRows ; i < = eRows ; i + + )
{
ws . CreateRow ( i ) ;
ws . GetRow ( i ) . HeightInPoints = 18.8f ;
for ( int j = cStart ; j < = cEnd ; j + + )
{
ws . GetRow ( i ) . CreateCell ( j ) ;
ws . GetRow ( i ) . GetCell ( j ) . CellStyle = style ;
}
//合并数据
region = new CellRangeAddress ( i , i , 5 , 6 ) ;
ws . AddMergedRegion ( region ) ;
}
return ws ;
}
/// <summary>
/// 创建头部
/// </summary>
/// <returns></returns>
private XSSFSheet ExcelCreateRowTitle ( XSSFSheet ws , XSSFWorkbook hssfworkbook , int sRows , int eRows , ICellStyle style , int cStart , int cEnd )
{
var noneStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , HorizontalAlignment . Center , 14 , true , true ) ;
for ( int i = sRows ; i < = eRows ; i + + )
{
ws . CreateRow ( i ) ;
ws . GetRow ( i ) . HeightInPoints =
i = = sRows ? 27f :
i = = ( sRows + 1 ) ? 28.5f :
i = = ( sRows + 2 ) ? 26.3f :
i = = ( sRows + 3 ) ? 28.5f :
i = = ( sRows + 4 ) ? 28.5f :
i = = ( sRows + 5 ) ? 26.3f :
i = = ( sRows + 6 ) ? 18.8f :
16.5f ;
for ( int j = cStart ; j < = cEnd ; j + + )
{
ws . GetRow ( i ) . CreateCell ( j ) ;
ws . GetRow ( i ) . GetCell ( j ) . CellStyle = i = = sRows ? noneStyle : style ;
}
}
return ws ;
}
/// <summary>
/// 查询指定条数分页
/// </summary>
/// <returns></returns>
public static DataTable GetPageToTable ( DataTable dt , int StartNum , int EndNum )
{
//0页代表每页数据, 直接返回
if ( EndNum = = 0 ) return dt ;
//数据源为空返回空DataTable
if ( dt = = null ) return new DataTable ( ) ;
DataTable newdt = dt . Copy ( ) ;
newdt . Clear ( ) ; //copy dt的框架
if ( StartNum > = dt . Rows . Count )
return newdt ; //源数据记录数小于等于要显示的记录, 直接返回dt
if ( EndNum > dt . Rows . Count )
EndNum = dt . Rows . Count ;
for ( int i = StartNum ; i < = EndNum - 1 ; i + + )
{
DataRow newdr = newdt . NewRow ( ) ;
DataRow dr = dt . Rows [ i ] ;
foreach ( DataColumn column in dt . Columns )
{
newdr [ column . ColumnName ] = dr [ column . ColumnName ] ;
}
newdt . Rows . Add ( newdr ) ;
}
return newdt ;
}
#endregion
}
}