2577 lines
203 KiB
C#
2577 lines
203 KiB
C#
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 TestRecordtPrint : PageBase
|
||
{
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
//检测类型
|
||
this.drpNDT.DataTextField = "NDT_Code";
|
||
this.drpNDT.DataValueField = "NDT_ID";
|
||
this.drpNDT.DataSource = BLL.HJGL_TestingService.GetNDTTypeNameList();
|
||
this.drpNDT.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpNDT);
|
||
//是否打印
|
||
this.drpIsPrint.DataTextField = "Text";
|
||
this.drpIsPrint.DataValueField = "Value";
|
||
this.drpIsPrint.DataSource = BLL.DropListService.IsTrueOrFalseDrpList();
|
||
this.drpIsPrint.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpIsPrint);
|
||
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 (this.drpIsPrint.SelectedValue != "null")
|
||
{
|
||
if (Convert.ToBoolean(drpIsPrint.SelectedValue))
|
||
{
|
||
str += " and isnull(TrustItem.Record_Printer,'')!=''";
|
||
}
|
||
else
|
||
{
|
||
str += " and isnull(TrustItem.Record_Printer,'')=''";
|
||
}
|
||
}
|
||
|
||
if (this.drpNDT.SelectedValueArray.Length > 1 || (this.drpNDT.SelectedValueArray.Length == 1 && this.drpNDT.SelectedValue != "null"))
|
||
{
|
||
var drpwhere = string.Empty;
|
||
var drpls = this.drpNDT.SelectedValueArray.Where(p => p != "null").ToList();
|
||
|
||
foreach (var drp in drpls)
|
||
{
|
||
if (string.IsNullOrEmpty(drpwhere))
|
||
{
|
||
drpwhere += "'" + drp + "'";
|
||
}
|
||
else
|
||
{
|
||
drpwhere += ",'" + drp + "'";
|
||
}
|
||
}
|
||
str += " and Trust.CH_NDTMethod in (" + drpwhere + ") ";
|
||
}
|
||
|
||
string strSql = @"SELECT v.*,iso.ISO_IsoNo,ndt.NDT_Code,project.ProjectCode,
|
||
v.CH_TrustID+','+isnull(v.JOT_JointDesc,'')+','+v.ISO_ID as NewIds,v.STE_ID,v.STE_ID2,v.WME_ID,v.WME_Name
|
||
FROM
|
||
(SELECT Trust.CH_TrustID, Trust.CH_TrustCode,
|
||
Trust.BatchId,
|
||
JointInfo.ISO_ID,
|
||
Trust.CH_NDTMethod,
|
||
Trust.CH_TrustDate,
|
||
Trust.ProjectId,
|
||
TrustItem.Record_Printer,
|
||
JointInfo.STE_ID,
|
||
JointInfo.STE_ID2,
|
||
JointInfo.WME_ID,
|
||
WeldMethod.WME_Name,
|
||
CONVERT(varchar(12) , TrustItem.Record_PrintDate, 111 ) AS Record_PrintDate,
|
||
JointInfo.JOT_JointDesc,
|
||
dbo.HJGL_Fun_GetTrustRecordJoint(Trust.CH_TrustID,JointInfo.ISO_ID,JointInfo.JOT_JointDesc,JointInfo.STE_ID,JointInfo.STE_ID2,JointInfo.WME_ID) AS JOT_JointNo
|
||
FROM dbo.HJGL_CH_TrustItem AS TrustItem
|
||
LEFT JOIN dbo.HJGL_CH_Trust AS Trust ON TrustItem.CH_TrustID=Trust.CH_TrustID
|
||
LEFT JOIN dbo.HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID = TrustItem.JOT_ID
|
||
LEFT JOIN HJGL_BS_WeldMethod as WeldMethod on WeldMethod.WME_ID=JointInfo.WME_ID
|
||
WHERE Trust.ProjectId=@ProjectId " + str;
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@ProjectId", ProjectId));
|
||
|
||
//if (this.drpNDT.SelectedValue != BLL.Const._Null)
|
||
//{
|
||
// strSql += " AND Trust.CH_NDTMethod=@NDTType ";
|
||
// listStr.Add(new SqlParameter("@NDTType", this.drpNDT.SelectedValue));
|
||
//}
|
||
|
||
strSql += @"GROUP by Trust.CH_TrustID,Trust.CH_TrustCode,Trust.BatchId,JointInfo.ISO_ID,Trust.CH_NDTMethod,
|
||
TrustItem.Record_Printer, CONVERT(varchar(12) , TrustItem.Record_PrintDate, 111 ),
|
||
Trust.CH_TrustDate,Trust.ProjectId, JointInfo.JOT_JointDesc,JointInfo.STE_ID,JointInfo.STE_ID2,JointInfo.WME_ID,WeldMethod.WME_Name) v
|
||
LEFT JOIN dbo.HJGL_PW_IsoInfo iso ON iso.ISO_ID = v.ISO_ID
|
||
LEFT JOIN HJGL_BS_NDTType AS ndt ON ndt.NDT_ID = v.CH_NDTMethod
|
||
LEFT JOIN Base_Project AS project ON project.ProjectId = v.ProjectId";
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
Grid2.DataSource = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||
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)
|
||
{
|
||
Grid1.SortDirection = e.SortDirection;
|
||
Grid1.SortField = e.SortField;
|
||
BindGrid();
|
||
}
|
||
#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>
|
||
/// <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 Text_TextChanged(object sender, EventArgs e)
|
||
{
|
||
BindGrid1(this.Grid1.SelectedRowID);
|
||
}
|
||
/// <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, (4 * 256));//(3.5)3.55
|
||
ws.SetColumnWidth(1, (8 * 256) - 95);//(7.08)7.09
|
||
ws.SetColumnWidth(2, (14 * 256) - 95);//(13.08)13.09
|
||
ws.SetColumnWidth(3, (16 * 256) - 95);//(15.08)15.09
|
||
ws.SetColumnWidth(4, (7 * 256) - 95);//(6.08)6.09
|
||
ws.SetColumnWidth(5, (7 * 256) - 95);//(6.08)6.09
|
||
ws.SetColumnWidth(6, (7 * 256) - 95);//(6.08)6.09
|
||
ws.SetColumnWidth(7, (9 * 256) + 15);//(8.5)8.55
|
||
ws.SetColumnWidth(8, (8 * 256) + 15);//(7.5)7.55
|
||
ws.SetColumnWidth(9, (13 * 256) - 95);//(12.08)12.09
|
||
ws.SetColumnWidth(10, (2 * 256) - 95);//(1.08)1.09
|
||
ws.SetColumnWidth(11, (3 * 256) - 95);//(2.08)2.09
|
||
ws.SetColumnWidth(12, (4 * 256) - 95);//(3.08)3.09
|
||
ws.SetColumnWidth(13, (4 * 256 + 95));//(3.08)3.09
|
||
|
||
#endregion
|
||
|
||
for (int gi = 0; gi < Grid2.Rows.Count; gi++)
|
||
{
|
||
if (Grid2.SelectedRowIndexArray.Contains(gi))
|
||
{
|
||
System.Web.UI.WebControls.HiddenField hidCH_TrustID = Grid2.Rows[gi].FindControl("hidCH_TrustID") as System.Web.UI.WebControls.HiddenField;
|
||
System.Web.UI.WebControls.HiddenField hidJOT_JointDesc = Grid2.Rows[gi].FindControl("hidJOT_JointDesc") as System.Web.UI.WebControls.HiddenField;
|
||
System.Web.UI.WebControls.HiddenField hidISO_ID = Grid2.Rows[gi].FindControl("hidISO_ID") as System.Web.UI.WebControls.HiddenField;
|
||
System.Web.UI.WebControls.HiddenField hidCH_NDTMethod = Grid2.Rows[gi].FindControl("hidCH_NDTMethod") as System.Web.UI.WebControls.HiddenField;
|
||
System.Web.UI.WebControls.HiddenField hidNDT_Code = Grid2.Rows[gi].FindControl("hidNDT_Code") as System.Web.UI.WebControls.HiddenField;
|
||
System.Web.UI.WebControls.HiddenField hidSTE_ID = Grid2.Rows[gi].FindControl("hidSTE_ID") as System.Web.UI.WebControls.HiddenField;
|
||
System.Web.UI.WebControls.HiddenField hidSTE_ID2 = Grid2.Rows[gi].FindControl("hidSTE_ID2") as System.Web.UI.WebControls.HiddenField;
|
||
System.Web.UI.WebControls.HiddenField hidWME_ID = Grid2.Rows[gi].FindControl("hidWME_ID") as System.Web.UI.WebControls.HiddenField;
|
||
System.Web.UI.WebControls.HiddenField hidWME_Name = Grid2.Rows[gi].FindControl("hidWME_Name") as System.Web.UI.WebControls.HiddenField;
|
||
|
||
|
||
var dbfnName = hidNDT_Code.Value == "RT" ? "HJGL_sp_rpt_TrustItemRecordRT" : hidNDT_Code.Value == "PT" ? "HJGL_sp_rpt_TrustRecordPTItem" : hidNDT_Code.Value == "MT" ? "HJGL_sp_rpt_TrustRecordPTItem" : hidNDT_Code.Value == "UT" ? "HJGL_sp_rpt_TrustRecordUTItem" : "";
|
||
if (string.IsNullOrEmpty(dbfnName)) continue;
|
||
//打印赋值
|
||
var trustItems = from x in Funs.DB.HJGL_CH_TrustItem
|
||
join y in Funs.DB.HJGL_PW_JointInfo
|
||
on x.JOT_ID equals y.JOT_ID
|
||
where x.CH_TrustID == hidCH_TrustID.Value && y.JOT_JointDesc == hidJOT_JointDesc.Value
|
||
&& y.ISO_ID == hidISO_ID.Value
|
||
select x;
|
||
if (trustItems != null && trustItems.Count() > 0)
|
||
{
|
||
foreach (var trustItem in trustItems)
|
||
{
|
||
trustItem.Record_Printer = this.CurrUser.UserName;
|
||
trustItem.Record_PrintDate = DateTime.Now;
|
||
BLL.HJGL_CH_TrustItemService.UpdateTrustItem(trustItem);
|
||
}
|
||
}
|
||
//头部
|
||
var listTitleStr = new List<SqlParameter>();
|
||
listTitleStr.Add(new SqlParameter("@CH_TrustID", hidCH_TrustID.Value));
|
||
listTitleStr.Add(new SqlParameter("@ISO_ID", hidISO_ID.Value));
|
||
listTitleStr.Add(new SqlParameter("@IsRepair", "0"));
|
||
listTitleStr.Add(new SqlParameter("@Desc", hidJOT_JointDesc.Value));
|
||
listTitleStr.Add(new SqlParameter("@Flag", ""));
|
||
listTitleStr.Add(new SqlParameter("@STE_Code", ""));
|
||
|
||
|
||
SqlParameter[] titleparameter = listTitleStr.ToArray();
|
||
var tbTitle = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_TrustRecord", titleparameter);
|
||
if (tbTitle.Rows.Count > 0)
|
||
{
|
||
//列表
|
||
var tb = new DataTable();
|
||
var listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@CH_TrustID", hidCH_TrustID.Value));
|
||
listStr.Add(new SqlParameter("@ISO_ID", hidISO_ID.Value));
|
||
listStr.Add(new SqlParameter("@IsRepair", "0"));
|
||
listStr.Add(new SqlParameter("@Desc", hidJOT_JointDesc.Value));
|
||
listStr.Add(new SqlParameter("@Flag", "0"));
|
||
listStr.Add(new SqlParameter("@STE_Code", ""));
|
||
listStr.Add(new SqlParameter("@STE_ID", hidSTE_ID.Value));
|
||
listStr.Add(new SqlParameter("@STE_ID2", hidSTE_ID2.Value));
|
||
listStr.Add(new SqlParameter("@WME_Name", hidWME_Name.Value));
|
||
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
CellRangeAddress region;
|
||
tb = SQLHelper.GetDataTableRunProc(dbfnName, parameter);
|
||
|
||
//数据处理
|
||
if (tb.Rows.Count > 0)
|
||
{
|
||
//尾页面总数
|
||
var pageNum = 0d;
|
||
//尾部增加行
|
||
var endaddNum = 0;
|
||
//公共样式
|
||
ICellStyle style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true); //头部样式
|
||
ICellStyle titleStyleOne = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true, true);
|
||
ICellStyle titleStyleTwo = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 16, true, true, "方正姚体");
|
||
ICellStyle titleStyleThree = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 22, true, true);
|
||
|
||
if (hidNDT_Code.Value == "RT")
|
||
{
|
||
//计算页
|
||
pageNum =
|
||
tb.Rows.Count < 10 ? 1
|
||
: Math.Ceiling((float)(tb.Rows.Count - 10) / 26) + 1;
|
||
|
||
//: (tb.Rows.Count > 11 && tb.Rows.Count < 38) ? 2
|
||
//: Math.Ceiling((float)(tb.Rows.Count - 38) / 37) + 2;
|
||
//循环页
|
||
for (int i = 1; i <= pageNum; i++)
|
||
{
|
||
|
||
//取数据开始和结束条数
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
//excel数据开始行和结束行
|
||
var tStart = 0;
|
||
var tEnd = 0;
|
||
|
||
#region 头部和每页数据参数
|
||
//第一页和第二页需要创建头
|
||
if (i == 1)
|
||
{
|
||
//尾部增加行
|
||
endaddNum = 4;
|
||
//创建头部行和列
|
||
ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 16, style, 0, 13);
|
||
//取数据开始和结束条数
|
||
dStart = 0;
|
||
dEnd = 10;
|
||
//excel数据开始行和结束行
|
||
tStart = rowIndex + 17;
|
||
tEnd = rowIndex + 26;
|
||
|
||
#region 头部
|
||
//行1
|
||
region = new CellRangeAddress(rowIndex, rowIndex, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("YA-BK-107.2-2019");
|
||
ws.GetRow(rowIndex).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(13).CellStyle = titleStyleOne;
|
||
//行2
|
||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("宁波甬安检测技术有限公司");
|
||
ws.GetRow(rowIndex + 1).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(13).CellStyle = titleStyleTwo;
|
||
//行3
|
||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("射 线 检 测 记 录");
|
||
ws.GetRow(rowIndex + 2).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(13).CellStyle = titleStyleThree;
|
||
//行4
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("工程编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["TestEngineeringCode"].ToString());
|
||
ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("指导书编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue(tbTitle.Rows[0]["GuideBookCode"].ToString());
|
||
ws.GetRow(rowIndex + 3).GetCell(7).SetCellValue("记录编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 8, 9);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue(tbTitle.Rows[0]["RecordCode"].ToString());
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 10, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(10).SetCellValue(string.Format("共{0}页 第{1}页", pageNum, i));
|
||
//行5
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("委托单位");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 2, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue(tbTitle.Rows[0]["ConUnitName"].ToString());
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("施工单位");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 6, 8);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue("镇海石化建安工程有限公司");
|
||
ws.GetRow(rowIndex + 4).GetCell(9).SetCellValue("委托日期");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 10, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue(tbTitle.Rows[0]["CH_TrustDate"].ToString());
|
||
//行6
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("工程名称");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 2, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue("镇海石化建安工程有限公司无损检测");
|
||
ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue("施工号");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 6, 8);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue(tbTitle.Rows[0]["ProjectCode"].ToString());
|
||
ws.GetRow(rowIndex + 5).GetCell(9).SetCellValue("委托人");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 10, 11);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue(tbTitle.Rows[0]["TrustManName"].ToString());
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 12, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(12).SetCellValue(tbTitle.Rows[0]["BatchCode"].ToString());
|
||
//行7
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 8, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("工件信息");
|
||
ws.GetRow(rowIndex + 6).GetCell(1).SetCellValue("工件编号");
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(2).SetCellValue(tbTitle.Rows[0]["ISO_IsoNo"].ToString());
|
||
ws.GetRow(rowIndex + 6).GetCell(4).SetCellValue("工件名称");
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 8);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue(tbTitle.Rows[0]["ProjectName"].ToString());
|
||
ws.GetRow(rowIndex + 6).GetCell(9).SetCellValue("工件类型");
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 10, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(10).SetCellValue("□容器□管道□试件");
|
||
//行8
|
||
ws.GetRow(rowIndex + 7).GetCell(1).SetCellValue("工件材质");
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(2).SetCellValue(tbTitle.Rows[0]["STE_Code"].ToString());
|
||
ws.GetRow(rowIndex + 7).GetCell(4).SetCellValue("坡口型式");
|
||
ws.GetRow(rowIndex + 7).GetCell(5).SetCellValue(tbTitle.Rows[0]["JST_Name"].ToString());
|
||
ws.GetRow(rowIndex + 7).GetCell(6).SetCellValue("检测比例");
|
||
ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue(tbTitle.Rows[0]["NDTR_Name"].ToString());
|
||
ws.GetRow(rowIndex + 7).GetCell(8).SetCellValue("焊接方法");
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(9).SetCellValue(tbTitle.Rows[0]["WME_Name"].ToString());
|
||
//行9
|
||
ws.GetRow(rowIndex + 8).GetCell(1).SetCellValue("热处理状况");
|
||
ws.GetRow(rowIndex + 8).GetCell(2).SetCellValue("□消应力 □");
|
||
ws.GetRow(rowIndex + 8).GetCell(3).SetCellValue("检测时机");
|
||
ws.GetRow(rowIndex + 8).GetCell(4).SetCellValue("焊后");
|
||
ws.GetRow(rowIndex + 8).GetCell(5).SetCellValue("表面状况");
|
||
ws.GetRow(rowIndex + 8).GetCell(6).SetCellValue("机械打磨");
|
||
ws.GetRow(rowIndex + 8).GetCell(7).SetCellValue("检测地点");
|
||
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 8).GetCell(8).SetCellValue("□厂房 □现场 □曝光室");
|
||
//行10
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 10, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(0).SetCellValue("器材");
|
||
ws.GetRow(rowIndex + 9).GetCell(1).SetCellValue("射线种类");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).SetCellValue("□X □Y");
|
||
ws.GetRow(rowIndex + 9).GetCell(3).SetCellValue("仪器型号和编号");
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 4, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(4).SetCellValue("");
|
||
ws.GetRow(rowIndex + 9).GetCell(7).SetCellValue("焦点尺寸");
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(8).SetCellValue("□0.6□2.0□3.0□5.5");
|
||
//行11
|
||
ws.GetRow(rowIndex + 10).GetCell(1).SetCellValue("胶片型号/分类");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 2, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(2).SetCellValue("Agfa C7、C5类□/Agfa C4、C4类□");
|
||
ws.GetRow(rowIndex + 10).GetCell(5).SetCellValue("增感方式");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 6, 8);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(6).SetCellValue("Pb(□0.03/0.1,□0.1/□0.1)");
|
||
ws.GetRow(rowIndex + 10).GetCell(9).SetCellValue("像质计");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 10, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(10).SetCellValue("□ FE JB □专用FE");
|
||
//行12
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 14, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(0).SetCellValue("检测技术参数");
|
||
ws.GetRow(rowIndex + 11).GetCell(1).SetCellValue("标准、合格等级");
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(2).SetCellValue(tbTitle.Rows[0]["AcceptGrade2"].ToString());
|
||
ws.GetRow(rowIndex + 11).GetCell(4).SetCellValue("检测技术等级");
|
||
ws.GetRow(rowIndex + 11).GetCell(5).SetCellValue("AB");
|
||
ws.GetRow(rowIndex + 11).GetCell(6).SetCellValue("透照技术");
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 7, 8);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(7).SetCellValue("□单片,□双片");
|
||
ws.GetRow(rowIndex + 11).GetCell(9).SetCellValue("透照方式");
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 10, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(10).SetCellValue("□SD □SS □FZ ");
|
||
//行13
|
||
ws.GetRow(rowIndex + 12).GetCell(1).SetCellValue("曝光参数");
|
||
ws.GetRow(rowIndex + 12).GetCell(2).SetCellValue("KV");
|
||
ws.GetRow(rowIndex + 12).GetCell(3).SetCellValue("");
|
||
ws.GetRow(rowIndex + 12).GetCell(4).SetCellValue("mA×mi");
|
||
ws.GetRow(rowIndex + 12).GetCell(5).SetCellValue("");
|
||
ws.GetRow(rowIndex + 12).GetCell(6).SetCellValue("Ci×min");
|
||
ws.GetRow(rowIndex + 12).GetCell(7).SetCellValue("焦距 F");
|
||
ws.GetRow(rowIndex + 12).GetCell(8).SetCellValue("mm");
|
||
ws.GetRow(rowIndex + 12).GetCell(9).SetCellValue("有效长度");
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 10, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(10).SetCellValue("");
|
||
//行14
|
||
ws.GetRow(rowIndex + 13).GetCell(1).SetCellValue("显定影配方");
|
||
ws.GetRow(rowIndex + 13).GetCell(2).SetCellValue("手工配方");
|
||
ws.GetRow(rowIndex + 13).GetCell(3).SetCellValue("暗室处理方式");
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 4, 5);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(4).SetCellValue("□自动□手工");
|
||
ws.GetRow(rowIndex + 13).GetCell(6).SetCellValue("显定影参数");
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 7, 8);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(7).SetCellValue("℃,显 min,定 min");
|
||
ws.GetRow(rowIndex + 13).GetCell(9).SetCellValue("检测区域");
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 10, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(10).SetCellValue("℃,显 min,定 min");
|
||
//行15
|
||
ws.GetRow(rowIndex + 14).GetCell(1).SetCellValue("底片黑度");
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(2).SetCellValue("□1.5~4.5/□2.0~4.5");
|
||
ws.GetRow(rowIndex + 14).GetCell(4).SetCellValue("观片技术");
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(5).SetCellValue("□单片,□双片");
|
||
ws.GetRow(rowIndex + 14).GetCell(7).SetCellValue("无用射线防护");
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(8).SetCellValue("□背散射防护,□滤光板防护,□侧散射防护");
|
||
//行16
|
||
ws.GetRow(rowIndex + 15).GetCell(0).SetCellValue("");
|
||
ws.GetRow(rowIndex + 15).GetCell(1).SetCellValue("其它说明");
|
||
region = new CellRangeAddress(rowIndex + 15, rowIndex + 15, 2, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 15).GetCell(2).SetCellValue("");
|
||
//行17
|
||
ws.GetRow(rowIndex + 16).GetCell(0).SetCellValue("序号");
|
||
ws.GetRow(rowIndex + 16).GetCell(1).SetCellValue("焊缝编号");
|
||
ws.GetRow(rowIndex + 16).GetCell(2).SetCellValue("检件规格");
|
||
ws.GetRow(rowIndex + 16).GetCell(3).SetCellValue("焊工号");
|
||
ws.GetRow(rowIndex + 16).GetCell(4).SetCellValue("底片编号");
|
||
ws.GetRow(rowIndex + 16).GetCell(5).SetCellValue("返修次数");
|
||
ws.GetRow(rowIndex + 16).GetCell(6).SetCellValue("灵敏度值");
|
||
ws.GetRow(rowIndex + 16).GetCell(7).SetCellValue("缺陷性质");
|
||
ws.GetRow(rowIndex + 16).GetCell(8).SetCellValue("缺陷定量");
|
||
ws.GetRow(rowIndex + 16).GetCell(9).SetCellValue("超标缺陷部位");
|
||
region = new CellRangeAddress(rowIndex + 16, rowIndex + 16, 10, 11);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 16).GetCell(10).SetCellValue("评定结果");
|
||
region = new CellRangeAddress(rowIndex + 16, rowIndex + 16, 12, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 16).GetCell(12).SetCellValue("备注");
|
||
#endregion
|
||
|
||
}
|
||
else
|
||
{
|
||
////尾部增加行
|
||
//endaddNum = 2;
|
||
////创建头部行和列
|
||
//ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 13, true);
|
||
////取数据开始和结束条数
|
||
//dStart = 10;
|
||
//dEnd = 36;
|
||
////excel数据开始行和结束行
|
||
//tStart = rowIndex + 6;
|
||
//tEnd = rowIndex + 32;
|
||
|
||
//尾部增加行
|
||
endaddNum = 2;
|
||
//创建头部行和列
|
||
ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 13, true);
|
||
//取数据开始和结束条数
|
||
var pNum = (i - 2) * 26;
|
||
dStart = 10 + pNum;
|
||
dEnd = 36 + pNum;
|
||
//excel数据开始行和结束行
|
||
tStart = rowIndex + 6;
|
||
tEnd = rowIndex + 31;
|
||
|
||
#region 头部(续)
|
||
|
||
//行1
|
||
region = new CellRangeAddress(rowIndex, rowIndex, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("YA-BK-107.3-2019");
|
||
ws.GetRow(rowIndex).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(13).CellStyle = titleStyleOne;
|
||
|
||
//行2
|
||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("宁波甬安检测技术有限公司");
|
||
ws.GetRow(rowIndex + 1).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(13).CellStyle = titleStyleTwo;
|
||
//行3
|
||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("射 线 检 测 记 录");
|
||
ws.GetRow(rowIndex + 2).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(13).CellStyle = titleStyleThree;
|
||
//行4
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("工程编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue("");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("记录编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 7, 9);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(7).SetCellValue("");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 10, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(10).SetCellValue(string.Format("共{0}页 第{1}页", pageNum, i));
|
||
//行5
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("工件编号");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 2, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue("");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("工件名称");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 7, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("");
|
||
//行6
|
||
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("序号");
|
||
ws.GetRow(rowIndex + 5).GetCell(1).SetCellValue("焊缝编号");
|
||
ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue("检件规格");
|
||
ws.GetRow(rowIndex + 5).GetCell(3).SetCellValue("焊工号");
|
||
ws.GetRow(rowIndex + 5).GetCell(4).SetCellValue("底片编号");
|
||
ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue("返修次数");
|
||
ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue("灵敏度值");
|
||
ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("缺陷性质");
|
||
ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue("缺陷定量");
|
||
ws.GetRow(rowIndex + 5).GetCell(9).SetCellValue("超标缺陷部位");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 10, 11);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue("评定结果");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 12, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(12).SetCellValue("备注");
|
||
|
||
#endregion
|
||
}
|
||
//else
|
||
//{
|
||
// //尾部增加行
|
||
// endaddNum = 1;
|
||
// var pNum = (i - 2) * 37;
|
||
// //取数据开始和结束条数
|
||
// dStart = 39 + ((i - 3) * 37);
|
||
// dEnd = 39 + pNum;
|
||
// //excel数据开始行和结束行
|
||
// tStart = rowIndex;
|
||
// tEnd = rowIndex + 36;
|
||
//}
|
||
#endregion
|
||
|
||
#region 数据
|
||
//创建数据行和列
|
||
ws = ExcelCreateRow(ws, hssfworkbook, tStart, tEnd, style, 0, 13, hidNDT_Code.Value);
|
||
//获取当前页数据
|
||
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]["JOT_JointNo"].ToString());
|
||
ws.GetRow(dataRow).GetCell(2).SetCellValue(pageTb.Rows[j]["JOT_JointDesc"].ToString());
|
||
ws.GetRow(dataRow).GetCell(3).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString());
|
||
ws.GetRow(dataRow).GetCell(4).SetCellValue(pageTb.Rows[j]["FilmNum"].ToString());
|
||
ws.GetRow(dataRow).GetCell(5).SetCellValue(pageTb.Columns.Contains("RepairMark") ? pageTb.Rows[j]["RepairMark"].ToString() : "");
|
||
ws.GetRow(dataRow).GetCell(6).SetCellValue("");
|
||
ws.GetRow(dataRow).GetCell(7).SetCellValue("");
|
||
ws.GetRow(dataRow).GetCell(8).SetCellValue("");
|
||
ws.GetRow(dataRow).GetCell(9).SetCellValue("");
|
||
ws.GetRow(dataRow).GetCell(10).SetCellValue("");
|
||
ws.GetRow(dataRow).GetCell(12).SetCellValue(pageTb.Rows[j]["CheckAddress"].ToString());
|
||
}
|
||
#endregion
|
||
|
||
#region 尾部
|
||
if (i == 1)
|
||
{
|
||
//创建尾部行1
|
||
ws.CreateRow(tEnd + 1);
|
||
ICellStyle endStyleOne = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 6);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 1).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 1).GetCell(eIndex).CellStyle = endStyleOne;
|
||
}
|
||
region = new CellRangeAddress(tEnd + 1, tEnd + 1, 10, 12);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 1).HeightInPoints = 22.5f;
|
||
ws.GetRow(tEnd + 1).GetCell(0).SetCellValue("复核:");
|
||
ws.GetRow(tEnd + 1).GetCell(2).SetCellValue("评片:");
|
||
ws.GetRow(tEnd + 1).GetCell(4).SetCellValue("冲洗:");
|
||
ws.GetRow(tEnd + 1).GetCell(6).SetCellValue("摄片:");
|
||
ws.GetRow(tEnd + 1).GetCell(8).SetCellValue("日期:");
|
||
ws.GetRow(tEnd + 1).GetCell(10).SetCellValue("摄片张数:");
|
||
//创建尾部行2
|
||
ws.CreateRow(tEnd + 2);
|
||
ICellStyle endStyleTwo = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 7);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 2).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 2).GetCell(eIndex).CellStyle = endStyleTwo;
|
||
}
|
||
region = new CellRangeAddress(tEnd + 2, tEnd + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 2).HeightInPoints = 39f;
|
||
ws.GetRow(tEnd + 2).GetCell(0).SetCellValue("说明:1.透照方式:Z-纵缝透照、FW-环缝外透、FN-环缝内透、FZ-环缝中心透照、SD-双壁单影、SS-双壁双影;2.缺陷性质:A-裂纹、B-未熔合、C-未焊透、D-条形缺陷、E-圆形缺陷、F-深孔、G-内凹、H-咬边。3.缺陷定量:条状缺陷1条长度5mm记为L=5,条状缺陷3条最大长度8mm记为L=8×3,圆形缺陷6点记为d=6,大于1/2壁厚的圆形缺陷和深孔记为ΦX");
|
||
}
|
||
#endregion
|
||
|
||
rowIndex = tEnd + endaddNum;
|
||
}
|
||
}
|
||
else if (hidNDT_Code.Value == "PT")
|
||
{
|
||
//计算页
|
||
pageNum =
|
||
tb.Rows.Count < 9 ? 1
|
||
: Math.Ceiling((float)(tb.Rows.Count - 9) / 26) + 1;
|
||
|
||
////计算页
|
||
//pageNum =
|
||
// tb.Rows.Count < 15 ? 1
|
||
// : (tb.Rows.Count > 15 && tb.Rows.Count < 41) ? 2
|
||
// : Math.Ceiling((float)(tb.Rows.Count - 41) / 37) + 2;
|
||
//循环页
|
||
for (int i = 1; i <= pageNum; i++)
|
||
{
|
||
//每页数据开始和结束条数
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
//数据开始行和结束行
|
||
var tStart = 0;
|
||
var tEnd = 0;
|
||
|
||
#region 头部和每页数据参数
|
||
//第一页和第二页需要创建头
|
||
if (i == 1)
|
||
{
|
||
//尾部增加行
|
||
endaddNum = 5;
|
||
//创建头部行和列
|
||
ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 17, style, 0, 13);
|
||
//取数据开始和结束条数
|
||
dStart = 0;
|
||
dEnd = 9;
|
||
//数据开始行和结束行
|
||
tStart = rowIndex + 18;
|
||
tEnd = rowIndex + 26;
|
||
|
||
#region 头部
|
||
//行1
|
||
region = new CellRangeAddress(rowIndex, rowIndex, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("YA-BK-111-2019");
|
||
ws.GetRow(rowIndex).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(13).CellStyle = titleStyleOne;
|
||
//行2
|
||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("宁波甬安检测技术有限公司");
|
||
ws.GetRow(rowIndex + 1).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(13).CellStyle = titleStyleTwo;
|
||
//行3
|
||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("渗 透 检 测 记 录");
|
||
ws.GetRow(rowIndex + 2).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(13).CellStyle = titleStyleThree;
|
||
//行4
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("工程编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["TestEngineeringCode"].ToString());
|
||
ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("指导书编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue(tbTitle.Rows[0]["GuideBookCode"].ToString());
|
||
ws.GetRow(rowIndex + 3).GetCell(7).SetCellValue("记录编号");
|
||
ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue(tbTitle.Rows[0]["RecordCode"].ToString());
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue(string.Format("共{0}页 第{1}页", pageNum, i));
|
||
//行5
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("委托单位");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue(tbTitle.Rows[0]["ConUnitName"].ToString());
|
||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue("施工单位");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue("镇海石化建安工程有限公司");
|
||
ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("委托日期");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue(tbTitle.Rows[0]["CH_TrustDate"].ToString());
|
||
//行6
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("工程名称");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue("镇海石化建安工程有限公司无损检测");
|
||
ws.GetRow(rowIndex + 5).GetCell(4).SetCellValue("施工号");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue(tbTitle.Rows[0]["ProjectCode"].ToString());
|
||
ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("委托人");
|
||
ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue(tbTitle.Rows[0]["TrustManName"].ToString());
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(12).SetCellValue(tbTitle.Rows[0]["BatchCode"].ToString());
|
||
//行7
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 9, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("工件信息");
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(1).SetCellValue("工件编号");
|
||
ws.GetRow(rowIndex + 6).GetCell(3).SetCellValue(tbTitle.Rows[0]["ISO_IsoNo"].ToString());
|
||
ws.GetRow(rowIndex + 6).GetCell(4).SetCellValue("工件名称");
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue(tbTitle.Rows[0]["ProjectName"].ToString());
|
||
//行8
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(1).SetCellValue("工件类型");
|
||
ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue("□管道□容器");
|
||
ws.GetRow(rowIndex + 7).GetCell(4).SetCellValue("工件材质");
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(5).SetCellValue(tbTitle.Rows[0]["STE_Code"].ToString());
|
||
ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue("热处理状况");
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(8).SetCellValue("□消应力□");
|
||
//行9
|
||
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 8).GetCell(1).SetCellValue("检测时机");
|
||
ws.GetRow(rowIndex + 8).GetCell(3).SetCellValue("□焊后 □机加工后□");
|
||
ws.GetRow(rowIndex + 8).GetCell(4).SetCellValue("表面状况");
|
||
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 8).GetCell(5).SetCellValue("□机械打磨 □光洁");
|
||
ws.GetRow(rowIndex + 8).GetCell(7).SetCellValue("检测比例");
|
||
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 8).GetCell(8).SetCellValue(tbTitle.Rows[0]["NDTR_Name"].ToString());
|
||
//行10
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(1).SetCellValue("检测地点");
|
||
ws.GetRow(rowIndex + 9).GetCell(3).SetCellValue("□实验室□厂房□现场");
|
||
ws.GetRow(rowIndex + 9).GetCell(4).SetCellValue("检测区域");
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 5, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(5).SetCellValue("□焊缝两侧+10mm □");
|
||
//行11
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 11, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(0).SetCellValue("器材");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(1).SetCellValue("渗透剂牌号");
|
||
ws.GetRow(rowIndex + 10).GetCell(3).SetCellValue("□DPT-5A, □");
|
||
ws.GetRow(rowIndex + 10).GetCell(4).SetCellValue("渗透剂批号");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(5).SetCellValue("");
|
||
ws.GetRow(rowIndex + 10).GetCell(7).SetCellValue("显像剂批号");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(8).SetCellValue("");
|
||
//行12
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(1).SetCellValue("灵敏度试块");
|
||
ws.GetRow(rowIndex + 11).GetCell(3).SetCellValue("B型试块");
|
||
ws.GetRow(rowIndex + 11).GetCell(4).SetCellValue("照度计型号/编号");
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(5).SetCellValue("DSE-200E/L");
|
||
ws.GetRow(rowIndex + 11).GetCell(7).SetCellValue("黑光灯型号/编号");
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(8).SetCellValue("");
|
||
//行13
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 16, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(0).SetCellValue("检测技术");
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(1).SetCellValue("检测标准");
|
||
ws.GetRow(rowIndex + 12).GetCell(3).SetCellValue(tbTitle.Rows[0]["CH_NDTCriteria"].ToString());
|
||
ws.GetRow(rowIndex + 12).GetCell(4).SetCellValue("合格等级");
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(5).SetCellValue(tbTitle.Rows[0]["AcceptGrade"].ToString());
|
||
ws.GetRow(rowIndex + 12).GetCell(7).SetCellValue("灵敏度等级");
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(8).SetCellValue("□A□B□C");
|
||
//行14
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(1).SetCellValue("检测方法");
|
||
ws.GetRow(rowIndex + 13).GetCell(3).SetCellValue("□Ⅱc-d,□");
|
||
ws.GetRow(rowIndex + 13).GetCell(4).SetCellValue("检测温度");
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(5).SetCellValue(" ℃");
|
||
ws.GetRow(rowIndex + 13).GetCell(7).SetCellValue("预处理方法");
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(8).SetCellValue("□溶剂清洗□");
|
||
//行15
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(1).SetCellValue("渗透剂施加方法");
|
||
ws.GetRow(rowIndex + 14).GetCell(3).SetCellValue("□喷□涂□刷");
|
||
ws.GetRow(rowIndex + 14).GetCell(4).SetCellValue("渗透时间");
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(5).SetCellValue(" min");
|
||
ws.GetRow(rowIndex + 14).GetCell(7).SetCellValue("去除方法");
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(8).SetCellValue("沾有清洗剂的布擦除");
|
||
//行16
|
||
region = new CellRangeAddress(rowIndex + 15, rowIndex + 15, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 15).GetCell(1).SetCellValue("干燥方法及时间");
|
||
ws.GetRow(rowIndex + 15).GetCell(3).SetCellValue("□自然干燥 □");
|
||
ws.GetRow(rowIndex + 15).GetCell(4).SetCellValue("显像时间");
|
||
region = new CellRangeAddress(rowIndex + 15, rowIndex + 15, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 15).GetCell(5).SetCellValue(" min");
|
||
ws.GetRow(rowIndex + 15).GetCell(7).SetCellValue("观察条件");
|
||
region = new CellRangeAddress(rowIndex + 15, rowIndex + 15, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 15).GetCell(8).SetCellValue("表面光照度 lx");
|
||
//行17
|
||
region = new CellRangeAddress(rowIndex + 16, rowIndex + 16, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 16).GetCell(1).SetCellValue("观察方式");
|
||
ws.GetRow(rowIndex + 16).GetCell(3).SetCellValue("目视");
|
||
ws.GetRow(rowIndex + 16).GetCell(4).SetCellValue("后处理方法");
|
||
region = new CellRangeAddress(rowIndex + 16, rowIndex + 16, 5, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 16).GetCell(5).SetCellValue("□溶剂清洗 □水清洗");
|
||
//行18
|
||
ws.GetRow(rowIndex + 17).GetCell(0).SetCellValue("序号");
|
||
region = new CellRangeAddress(rowIndex + 17, rowIndex + 17, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 17).GetCell(1).SetCellValue("检件编号/部位名称");
|
||
ws.GetRow(rowIndex + 17).GetCell(3).SetCellValue("检件规格");
|
||
ws.GetRow(rowIndex + 17).GetCell(4).SetCellValue("焊工号");
|
||
ws.GetRow(rowIndex + 17).GetCell(5).SetCellValue("缺陷性质");
|
||
ws.GetRow(rowIndex + 17).GetCell(6).SetCellValue("缺陷位置");
|
||
ws.GetRow(rowIndex + 17).GetCell(7).SetCellValue("缺陷尺寸 (mm)");
|
||
ws.GetRow(rowIndex + 17).GetCell(8).SetCellValue("质量等级");
|
||
region = new CellRangeAddress(rowIndex + 17, rowIndex + 17, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 17).GetCell(9).SetCellValue("备注");
|
||
#endregion
|
||
|
||
}
|
||
else// if (i == 2)
|
||
{
|
||
//尾部增加行
|
||
endaddNum = 2;
|
||
//创建头部行和列
|
||
ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 13, true);
|
||
//取数据开始和结束条数
|
||
var pNum = (i - 2) * 26;
|
||
dStart = 9 + pNum;
|
||
dEnd = 35 + pNum;
|
||
//excel数据开始行和结束行
|
||
tStart = rowIndex + 6;
|
||
tEnd = rowIndex + 31;
|
||
|
||
////尾部增加行
|
||
//endaddNum = 12;
|
||
////创建头部行和列
|
||
//ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 13, true);
|
||
////取数据开始和结束条数
|
||
//dStart = 15;
|
||
//dEnd = 41;
|
||
////数据开始行和结束行
|
||
//tStart = rowIndex + 6;
|
||
//tEnd = rowIndex + 32;
|
||
|
||
#region 头部(续)
|
||
|
||
//行1
|
||
region = new CellRangeAddress(rowIndex, rowIndex, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("YA-BK-111-2019");
|
||
ws.GetRow(rowIndex).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(13).CellStyle = titleStyleOne;
|
||
//行2
|
||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("宁波甬安检测技术有限公司");
|
||
ws.GetRow(rowIndex + 1).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(13).CellStyle = titleStyleTwo;
|
||
//行3
|
||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("渗 透 检 测 记 录");
|
||
ws.GetRow(rowIndex + 2).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(13).CellStyle = titleStyleThree;
|
||
//行4
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("工程编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["TestEngineeringCode"].ToString());
|
||
ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("记录编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 8);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue(tbTitle.Rows[0]["RecordCode"].ToString());
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue(string.Format("共{0}页 第{1}页", pageNum, i));
|
||
//行5
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("工程编号");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue(tbTitle.Rows[0]["ISO_IsoNo"].ToString());
|
||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue("工件名称");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue(tbTitle.Rows[0]["ProjectName"].ToString());
|
||
//行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("缺陷性质");
|
||
ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue("缺陷位置");
|
||
ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("缺陷尺寸 (mm)");
|
||
ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue("质量等级");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(9).SetCellValue("备注");
|
||
|
||
#endregion
|
||
}
|
||
//else
|
||
//{
|
||
// //尾部增加行
|
||
// endaddNum = i == pageNum ? 6 : 10;
|
||
// var pNum = (i - 2) * 37;
|
||
// //取数据开始和结束条数
|
||
// dStart = 42 + ((i - 3) * 37);
|
||
// dEnd = 42 + pNum;
|
||
// //数据开始行和结束行
|
||
// tStart = rowIndex;
|
||
// tEnd = rowIndex + 36;
|
||
//}
|
||
#endregion
|
||
|
||
#region 数据
|
||
|
||
//创建数据行和列
|
||
ws = ExcelCreateRow(ws, hssfworkbook, tStart, tEnd, style, 0, 13, hidNDT_Code.Value);
|
||
//获取当前页数据
|
||
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]["JOT_JointNo"].ToString());
|
||
ws.GetRow(dataRow).GetCell(2).SetCellValue(pageTb.Rows[j]["Specification"].ToString());
|
||
ws.GetRow(dataRow).GetCell(3).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString());
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
//if (i == 1 || i == pageNum)
|
||
if (i == 1)
|
||
{
|
||
//创建尾部行1
|
||
ws.CreateRow(tEnd + 1);
|
||
ICellStyle endStyleOne = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 1).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 1).GetCell(eIndex).CellStyle = endStyleOne;
|
||
}
|
||
ws.GetRow(tEnd + 1).HeightInPoints = 21f;
|
||
region = new CellRangeAddress(tEnd + 1, tEnd + 1, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 1).GetCell(0).SetCellValue("□经复验,检测灵敏度符合标准要求。");
|
||
//创建尾部行2
|
||
ws.CreateRow(tEnd + 2);
|
||
ICellStyle endStyleTwo = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 2).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 2).GetCell(eIndex).CellStyle = endStyleTwo;
|
||
}
|
||
ws.GetRow(tEnd + 2).HeightInPoints = 21f;
|
||
region = new CellRangeAddress(tEnd + 2, tEnd + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 2).GetCell(0).SetCellValue("检测部位见无损检测部位示意图");
|
||
//创建尾部行3
|
||
ws.CreateRow(tEnd + 3);
|
||
ICellStyle endStyleThree = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Right, 10);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 3).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 3).GetCell(eIndex).CellStyle = endStyleThree;
|
||
}
|
||
ws.GetRow(tEnd + 3).HeightInPoints = 21f;
|
||
region = new CellRangeAddress(tEnd + 3, tEnd + 3, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(tEnd + 3, tEnd + 3, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(tEnd + 3, tEnd + 3, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(tEnd + 3, tEnd + 3, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 3).GetCell(2).SetCellValue("检测:");
|
||
ws.GetRow(tEnd + 3).GetCell(4).SetCellValue("复核:");
|
||
ws.GetRow(tEnd + 3).GetCell(7).SetCellValue("日期:");
|
||
}
|
||
#endregion
|
||
|
||
rowIndex = tEnd + endaddNum;
|
||
}
|
||
}
|
||
else if (hidNDT_Code.Value == "MT")
|
||
{
|
||
//计算页
|
||
pageNum =
|
||
tb.Rows.Count < 9 ? 1
|
||
: Math.Ceiling((float)(tb.Rows.Count - 9) / 26) + 1;
|
||
|
||
////计算页
|
||
//pageNum =
|
||
// tb.Rows.Count < 15 ? 1
|
||
// : (tb.Rows.Count > 15 && tb.Rows.Count < 45) ? 2
|
||
// : Math.Ceiling((float)(tb.Rows.Count - 45) / 37) + 2;
|
||
//循环页
|
||
for (int i = 1; i <= pageNum; i++)
|
||
{
|
||
//每页数据开始和结束条数
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
//数据开始行和结束行
|
||
var tStart = 0;
|
||
var tEnd = 0;
|
||
|
||
#region 头部和每页数据参数
|
||
//第一页和第二页需要创建头
|
||
if (i == 1)
|
||
{
|
||
//尾部增加行
|
||
endaddNum = 5;
|
||
//创建头部行和列
|
||
ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 17, style, 0, 13);
|
||
//取数据开始和结束条数
|
||
dStart = 0;
|
||
dEnd = 9;
|
||
//数据开始行和结束行
|
||
tStart = rowIndex + 18;
|
||
tEnd = rowIndex + 26;
|
||
|
||
#region 头部
|
||
|
||
//行1
|
||
region = new CellRangeAddress(rowIndex, rowIndex, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("YA-BK-110-2019");
|
||
ws.GetRow(rowIndex).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(13).CellStyle = titleStyleOne;
|
||
//行2
|
||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("宁波甬安检测技术有限公司");
|
||
ws.GetRow(rowIndex + 1).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(13).CellStyle = titleStyleTwo;
|
||
//行3
|
||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("磁 粉 检 测 记 录");
|
||
ws.GetRow(rowIndex + 2).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(13).CellStyle = titleStyleThree;
|
||
//行4
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("工程编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["TestEngineeringCode"].ToString());
|
||
ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("指导书编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("YA-TYGY-MT-");
|
||
ws.GetRow(rowIndex + 3).GetCell(7).SetCellValue("记录编号");
|
||
ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue(tbTitle.Rows[0]["RecordCode"].ToString());
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue(string.Format("共{0}页 第{1}页", pageNum, i));
|
||
//行5
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("委托单位");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue(tbTitle.Rows[0]["ConUnitName"].ToString());
|
||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue("施工单位");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue("镇海石化建安工程有限公司");
|
||
ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("委托日期");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue(tbTitle.Rows[0]["CH_TrustDate"].ToString());
|
||
//行6
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("工程名称");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue("镇海石化建安工程有限公司无损检测");
|
||
ws.GetRow(rowIndex + 5).GetCell(4).SetCellValue("施工号");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue(tbTitle.Rows[0]["ProjectCode"].ToString());
|
||
ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("委托人");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 9);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue(tbTitle.Rows[0]["TrustManName"].ToString());
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 10, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue(tbTitle.Rows[0]["BatchCode"].ToString());
|
||
//行7
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 9, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("工件信息");
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(1).SetCellValue("工件编号");
|
||
ws.GetRow(rowIndex + 6).GetCell(3).SetCellValue(tbTitle.Rows[0]["ISO_IsoNo"].ToString());
|
||
ws.GetRow(rowIndex + 6).GetCell(4).SetCellValue("工件名称");
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue(tbTitle.Rows[0]["ProjectName"].ToString());
|
||
//行8
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(1).SetCellValue("工件类型");
|
||
ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue("□管道□容器");
|
||
ws.GetRow(rowIndex + 7).GetCell(4).SetCellValue("工件材质");
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(5).SetCellValue(tbTitle.Rows[0]["STE_Code"].ToString());
|
||
ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue("热处理状况");
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(8).SetCellValue("□消应力□");
|
||
//行9
|
||
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 8).GetCell(1).SetCellValue("检测时机");
|
||
ws.GetRow(rowIndex + 8).GetCell(3).SetCellValue("□焊后 □机加工后□");
|
||
ws.GetRow(rowIndex + 8).GetCell(4).SetCellValue("表面状况");
|
||
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 8).GetCell(5).SetCellValue("□机械打磨 □光洁");
|
||
ws.GetRow(rowIndex + 8).GetCell(7).SetCellValue("检测比例");
|
||
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 8).GetCell(8).SetCellValue(tbTitle.Rows[0]["NDTR_Name"].ToString());
|
||
//行10
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(1).SetCellValue("检测地点");
|
||
ws.GetRow(rowIndex + 9).GetCell(3).SetCellValue("□实验室□厂房□现场");
|
||
ws.GetRow(rowIndex + 9).GetCell(4).SetCellValue("检测区域");
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(5).SetCellValue("□焊缝两侧+10mm □");
|
||
ws.GetRow(rowIndex + 9).GetCell(7).SetCellValue("");
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(8).SetCellValue("");
|
||
//行11
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 12, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(0).SetCellValue("器材");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(1).SetCellValue("仪器型号");
|
||
ws.GetRow(rowIndex + 10).GetCell(3).SetCellValue("□MP-A3□MY-2□CDX-Ⅲ");
|
||
ws.GetRow(rowIndex + 10).GetCell(4).SetCellValue("仪器编号");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(5).SetCellValue("□743-006□0213□0486");
|
||
ws.GetRow(rowIndex + 10).GetCell(7).SetCellValue("提升力");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(8).SetCellValue("□≥45N□≥118N");
|
||
//行12
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(1).SetCellValue("灵敏度试片");
|
||
ws.GetRow(rowIndex + 11).GetCell(3).SetCellValue("□A1:30/100□");
|
||
ws.GetRow(rowIndex + 11).GetCell(4).SetCellValue("磁粉型号/批号");
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(5).SetCellValue("");
|
||
ws.GetRow(rowIndex + 11).GetCell(7).SetCellValue("运载介质");
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(8).SetCellValue("□水□机油□");
|
||
//行13
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(1).SetCellValue("磁悬液浓度/粒度");
|
||
ws.GetRow(rowIndex + 12).GetCell(3).SetCellValue("□1.2-2.4mL/100mL□");
|
||
ws.GetRow(rowIndex + 12).GetCell(4).SetCellValue("照度计型号/编号");
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(5).SetCellValue("□DSE-200E/L□");
|
||
ws.GetRow(rowIndex + 12).GetCell(7).SetCellValue("黑光灯型号/编号");
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(8).SetCellValue("□Z-125W□SB-100P/F");
|
||
//行14
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 16, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(0).SetCellValue("检测技术");
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(1).SetCellValue("检测标准");
|
||
ws.GetRow(rowIndex + 13).GetCell(3).SetCellValue("NB/T47013-2015");
|
||
ws.GetRow(rowIndex + 13).GetCell(4).SetCellValue("合格等级");
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(5).SetCellValue(tbTitle.Rows[0]["AcceptGrade"].ToString());
|
||
ws.GetRow(rowIndex + 13).GetCell(7).SetCellValue("磁化方法");
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(8).SetCellValue("□连续磁轭法□");
|
||
//行15
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(1).SetCellValue("磁化方向");
|
||
ws.GetRow(rowIndex + 14).GetCell(3).SetCellValue("□纵向□周向□复合磁化");
|
||
ws.GetRow(rowIndex + 14).GetCell(4).SetCellValue("磁化电流/电流值");
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(5).SetCellValue("□交流电/");
|
||
ws.GetRow(rowIndex + 14).GetCell(7).SetCellValue("磁极间距 ");
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(8).SetCellValue("□75~200mm□");
|
||
//行16
|
||
region = new CellRangeAddress(rowIndex + 15, rowIndex + 15, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 15).GetCell(1).SetCellValue("L/D值");
|
||
ws.GetRow(rowIndex + 15).GetCell(3).SetCellValue("");
|
||
ws.GetRow(rowIndex + 15).GetCell(4).SetCellValue("线圈安匝数");
|
||
region = new CellRangeAddress(rowIndex + 15, rowIndex + 15, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 15).GetCell(5).SetCellValue("");
|
||
ws.GetRow(rowIndex + 15).GetCell(7).SetCellValue("磁粉施加");
|
||
region = new CellRangeAddress(rowIndex + 15, rowIndex + 15, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 15).GetCell(8).SetCellValue("□喷□洒□");
|
||
//行17
|
||
region = new CellRangeAddress(rowIndex + 16, rowIndex + 16, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 16).GetCell(1).SetCellValue("磁化时间");
|
||
ws.GetRow(rowIndex + 16).GetCell(3).SetCellValue("□1-3s□");
|
||
ws.GetRow(rowIndex + 16).GetCell(4).SetCellValue("观察条件");
|
||
region = new CellRangeAddress(rowIndex + 16, rowIndex + 16, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 16).GetCell(5).SetCellValue("表面光照度 lx");
|
||
ws.GetRow(rowIndex + 16).GetCell(7).SetCellValue("观察方式");
|
||
region = new CellRangeAddress(rowIndex + 16, rowIndex + 16, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 16).GetCell(8).SetCellValue("目视");
|
||
//行18
|
||
ws.GetRow(rowIndex + 17).GetCell(0).SetCellValue("序号");
|
||
region = new CellRangeAddress(rowIndex + 17, rowIndex + 17, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 17).GetCell(1).SetCellValue("检件编号/部位名称");
|
||
ws.GetRow(rowIndex + 17).GetCell(3).SetCellValue("检件规格");
|
||
ws.GetRow(rowIndex + 17).GetCell(4).SetCellValue("焊工号");
|
||
ws.GetRow(rowIndex + 17).GetCell(5).SetCellValue("缺陷性质");
|
||
ws.GetRow(rowIndex + 17).GetCell(6).SetCellValue("缺陷位置");
|
||
ws.GetRow(rowIndex + 17).GetCell(7).SetCellValue("缺陷尺寸");
|
||
ws.GetRow(rowIndex + 17).GetCell(8).SetCellValue("质量等级");
|
||
region = new CellRangeAddress(rowIndex + 17, rowIndex + 17, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 17).GetCell(9).SetCellValue("备注");
|
||
|
||
#endregion
|
||
|
||
}
|
||
else //if (i == 2)
|
||
{
|
||
//尾部增加行
|
||
endaddNum = 2;
|
||
//创建头部行和列
|
||
ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 13, true);
|
||
//取数据开始和结束条数
|
||
var pNum = (i - 2) * 26;
|
||
dStart = 9 + pNum;
|
||
dEnd = 35 + pNum;
|
||
//excel数据开始行和结束行
|
||
tStart = rowIndex + 6;
|
||
tEnd = rowIndex + 31;
|
||
|
||
////尾部增加行
|
||
//endaddNum = 7;
|
||
////创建头部行和列
|
||
//ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 13, true);
|
||
////取数据开始和结束条数
|
||
//dStart = 15;
|
||
//dEnd = 45;
|
||
////数据开始行和结束行
|
||
//tStart = rowIndex + 6;
|
||
//tEnd = rowIndex + 36;
|
||
|
||
#region 头部(续)
|
||
|
||
//行1
|
||
region = new CellRangeAddress(rowIndex, rowIndex, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("YA-BK-110.1-2019");
|
||
ws.GetRow(rowIndex).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(13).CellStyle = titleStyleOne;
|
||
//行2
|
||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("宁波甬安检测技术有限公司");
|
||
ws.GetRow(rowIndex + 1).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(13).CellStyle = titleStyleTwo;
|
||
//行3
|
||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("磁 粉 检 测 记 录");
|
||
ws.GetRow(rowIndex + 2).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(13).CellStyle = titleStyleThree;
|
||
//行4
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("工程编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["TestEngineeringCode"].ToString());
|
||
ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("记录编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 8);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue(tbTitle.Rows[0]["RecordCode"].ToString());
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue(string.Format("共{0}页 第{1}页", pageNum, i));
|
||
//行5
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("工程编号");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue(tbTitle.Rows[0]["ISO_IsoNo"].ToString());
|
||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue("工件名称");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue(tbTitle.Rows[0]["ProjectName"].ToString());
|
||
//行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("缺陷性质");
|
||
ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue("缺陷位置");
|
||
ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("缺陷尺寸");
|
||
ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue("质量等级");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(9).SetCellValue("备注");
|
||
|
||
#endregion
|
||
}
|
||
//else
|
||
//{
|
||
// //尾部增加行
|
||
// endaddNum = 8;
|
||
// var pNum = (i - 2) * 37;
|
||
// //取数据开始和结束条数
|
||
// dStart = 46 + ((i - 3) * 37);
|
||
// dEnd = 46 + pNum;
|
||
// //数据开始行和结束行
|
||
// tStart = rowIndex;
|
||
// tEnd = rowIndex + 36;
|
||
//}
|
||
#endregion
|
||
|
||
#region 数据
|
||
|
||
//创建数据行和列
|
||
ws = ExcelCreateRow(ws, hssfworkbook, tStart, tEnd, style, 0, 13, hidNDT_Code.Value);
|
||
//获取当前页数据
|
||
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]["JOT_JointNo"].ToString());
|
||
ws.GetRow(dataRow).GetCell(2).SetCellValue(pageTb.Rows[j]["Specification"].ToString());
|
||
ws.GetRow(dataRow).GetCell(3).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString());
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
if (i == 1)
|
||
{
|
||
//创建尾部行1
|
||
ws.CreateRow(tEnd + 1);
|
||
ICellStyle endStyleOne = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 1).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 1).GetCell(eIndex).CellStyle = endStyleOne;
|
||
}
|
||
ws.GetRow(tEnd + 1).HeightInPoints = 21f;
|
||
region = new CellRangeAddress(tEnd + 1, tEnd + 1, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 1).GetCell(0).SetCellValue("□经复验,检测灵敏度符合标准要求。");
|
||
//创建尾部行2
|
||
ws.CreateRow(tEnd + 2);
|
||
ICellStyle endStyleTwo = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 2).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 2).GetCell(eIndex).CellStyle = endStyleTwo;
|
||
}
|
||
ws.GetRow(tEnd + 2).HeightInPoints = 21f;
|
||
region = new CellRangeAddress(tEnd + 2, tEnd + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 2).GetCell(0).SetCellValue("检测部位见无损检测部位示意图");
|
||
//创建尾部行3
|
||
ws.CreateRow(tEnd + 3);
|
||
ICellStyle endStyleThree = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Right, 10);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 3).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 3).GetCell(eIndex).CellStyle = endStyleThree;
|
||
}
|
||
ws.GetRow(tEnd + 3).HeightInPoints = 21f;
|
||
region = new CellRangeAddress(tEnd + 3, tEnd + 3, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(tEnd + 3, tEnd + 3, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(tEnd + 3, tEnd + 3, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(tEnd + 3, tEnd + 3, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 3).GetCell(2).SetCellValue("检测:");
|
||
ws.GetRow(tEnd + 3).GetCell(4).SetCellValue("复核:");
|
||
ws.GetRow(tEnd + 3).GetCell(7).SetCellValue("日期:");
|
||
}
|
||
#endregion
|
||
|
||
rowIndex = tEnd + endaddNum;
|
||
}
|
||
}
|
||
else if (hidNDT_Code.Value == "UT")
|
||
{
|
||
////计算页
|
||
//pageNum =
|
||
// tb.Rows.Count < 15 ? 1
|
||
// : (tb.Rows.Count > 15 && tb.Rows.Count < 45) ? 2
|
||
// : Math.Ceiling((float)(tb.Rows.Count - 45) / 37) + 2;
|
||
|
||
//计算页
|
||
pageNum =
|
||
tb.Rows.Count < 9 ? 1
|
||
: Math.Ceiling((float)(tb.Rows.Count - 9) / 26) + 1;
|
||
|
||
|
||
//循环页
|
||
for (int i = 1; i <= pageNum; i++)
|
||
{
|
||
//每页数据开始和结束条数
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
//数据开始行和结束行
|
||
var tStart = 0;
|
||
var tEnd = 0;
|
||
|
||
#region 头部和每页数据参数
|
||
//第一页和第二页需要创建头
|
||
if (i == 1)
|
||
{
|
||
//尾部增加行
|
||
endaddNum = 5;
|
||
//创建头部行和列
|
||
ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 16, style, 0, 13);
|
||
//取数据开始和结束条数
|
||
dStart = 0;
|
||
dEnd = 9;
|
||
//数据开始行和结束行
|
||
tStart = rowIndex + 17;
|
||
tEnd = rowIndex + 25;
|
||
|
||
#region 头部
|
||
|
||
//行1
|
||
region = new CellRangeAddress(rowIndex, rowIndex, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("YA-BK-108-2019");
|
||
ws.GetRow(rowIndex).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(13).CellStyle = titleStyleOne;
|
||
//行2
|
||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("宁波甬安检测技术有限公司");
|
||
ws.GetRow(rowIndex + 1).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(13).CellStyle = titleStyleTwo;
|
||
//行3
|
||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("超 声 波 检 测 记 录");
|
||
ws.GetRow(rowIndex + 2).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(13).CellStyle = titleStyleThree;
|
||
//行4
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("工程编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["TestEngineeringCode"].ToString());
|
||
ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("指导书编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("YA-TYGY-MT-");
|
||
ws.GetRow(rowIndex + 3).GetCell(7).SetCellValue("记录编号");
|
||
ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue(tbTitle.Rows[0]["RecordCode"].ToString());
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue(string.Format("共{0}页 第{1}页", pageNum, i));
|
||
//行5
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("委托单位");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue(tbTitle.Rows[0]["ConUnitName"].ToString());
|
||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue("施工单位");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue("镇海石化建安工程有限公司");
|
||
ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("委托日期");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 8, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue(tbTitle.Rows[0]["CH_TrustDate"].ToString());
|
||
//行6
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("工程名称");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue("镇海石化建安工程有限公司无损检测");
|
||
ws.GetRow(rowIndex + 5).GetCell(4).SetCellValue("施工号");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue(tbTitle.Rows[0]["ProjectCode"].ToString());
|
||
ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("委托人");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 9);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue(tbTitle.Rows[0]["TrustManName"].ToString());
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 10, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue(tbTitle.Rows[0]["BatchCode"].ToString());
|
||
//行7
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 9, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("工件信息");
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(1).SetCellValue("工件编号");
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 3, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(3).SetCellValue(tbTitle.Rows[0]["ISO_IsoNo"].ToString());
|
||
ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("工件名称");
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 6, 7);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(6).SetCellValue(tbTitle.Rows[0]["ProjectName"].ToString());
|
||
ws.GetRow(rowIndex + 6).GetCell(8).SetCellValue("工件类型");
|
||
region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 6).GetCell(9).SetCellValue("□容器 □管道 □");
|
||
//行8
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(1).SetCellValue("工件材质");
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 3, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue(tbTitle.Rows[0]["STE_Code"].ToString());
|
||
ws.GetRow(rowIndex + 7).GetCell(5).SetCellValue("坡口型式");
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 6, 7);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(6).SetCellValue("□V型 □U型 □X型");
|
||
ws.GetRow(rowIndex + 7).GetCell(8).SetCellValue("焊接方法");
|
||
region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 7).GetCell(9).SetCellValue(tbTitle.Rows[0]["WME_Name"].ToString());
|
||
//行9
|
||
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 8).GetCell(1).SetCellValue("热处理状况");
|
||
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 3, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 8).GetCell(3).SetCellValue("□消应力 □");
|
||
ws.GetRow(rowIndex + 8).GetCell(5).SetCellValue("检测时机");
|
||
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 6, 7);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 8).GetCell(6).SetCellValue("□焊后 □");
|
||
ws.GetRow(rowIndex + 8).GetCell(8).SetCellValue("表面状态");
|
||
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 8).GetCell(9).SetCellValue("□光洁 □机械打磨");
|
||
//行10
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(1).SetCellValue("检测比例");
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 3, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(3).SetCellValue(tbTitle.Rows[0]["NDTR_Name"].ToString());
|
||
ws.GetRow(rowIndex + 9).GetCell(5).SetCellValue("检测地点");
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 6, 7);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(6).SetCellValue("□实验室□厂房□现场");
|
||
ws.GetRow(rowIndex + 9).GetCell(8).SetCellValue("");
|
||
region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 9).GetCell(9).SetCellValue("");
|
||
//行11
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 11, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(0).SetCellValue("器材");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(1).SetCellValue("仪器型号/编号");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 3, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(3).SetCellValue("□HS610系列 □");
|
||
ws.GetRow(rowIndex + 10).GetCell(5).SetCellValue("探头型号");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 6, 7);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(6).SetCellValue("");
|
||
ws.GetRow(rowIndex + 10).GetCell(8).SetCellValue("探头实测值");
|
||
region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 10).GetCell(9).SetCellValue("");
|
||
//行12
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(1).SetCellValue("试块型号");
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 3, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(3).SetCellValue("");
|
||
ws.GetRow(rowIndex + 11).GetCell(5).SetCellValue("耦合剂");
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 6, 7);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(6).SetCellValue("□水 □机油 □化学浆糊");
|
||
ws.GetRow(rowIndex + 11).GetCell(8).SetCellValue("");
|
||
region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 11).GetCell(9).SetCellValue("");
|
||
//行13
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 15, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(0).SetCellValue("检测技术参数");
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(1).SetCellValue("检测标准");
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 3, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(3).SetCellValue(tbTitle.Rows[0]["CH_NDTCriteria"].ToString());
|
||
ws.GetRow(rowIndex + 12).GetCell(5).SetCellValue("合格等级");
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 6, 7);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(6).SetCellValue(tbTitle.Rows[0]["AcceptGrade"].ToString());
|
||
ws.GetRow(rowIndex + 12).GetCell(8).SetCellValue("检测技术等级");
|
||
region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 12).GetCell(9).SetCellValue("□B级□C级");
|
||
//行14
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(1).SetCellValue("检测方法");
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 3, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(3).SetCellValue("□横波一次反射法 □");
|
||
ws.GetRow(rowIndex + 13).GetCell(5).SetCellValue("检测面");
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 6, 7);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(6).SetCellValue("");
|
||
ws.GetRow(rowIndex + 13).GetCell(8).SetCellValue("检测区域");
|
||
region = new CellRangeAddress(rowIndex + 13, rowIndex + 13, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 13).GetCell(9).SetCellValue("□焊缝宽度+两侧各10mm □");
|
||
//行15
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(1).SetCellValue("扫查方式");
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 3, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(3).SetCellValue("□锯齿扫查 □斜平行扫查 □");
|
||
ws.GetRow(rowIndex + 14).GetCell(5).SetCellValue("探头移动范围");
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 6, 7);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(6).SetCellValue("□1.25P □0.75P □");
|
||
ws.GetRow(rowIndex + 14).GetCell(8).SetCellValue("耦合补偿");
|
||
region = new CellRangeAddress(rowIndex + 14, rowIndex + 14, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 14).GetCell(9).SetCellValue("");
|
||
//行16
|
||
region = new CellRangeAddress(rowIndex + 15, rowIndex + 15, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 15).GetCell(1).SetCellValue("检测灵敏度");
|
||
region = new CellRangeAddress(rowIndex + 15, rowIndex + 15, 3, 7);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 15).GetCell(3).SetCellValue("");
|
||
ws.GetRow(rowIndex + 15).GetCell(8).SetCellValue("其它说明");
|
||
region = new CellRangeAddress(rowIndex + 15, rowIndex + 15, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 15).GetCell(9).SetCellValue("");
|
||
//行17
|
||
ws.GetRow(rowIndex + 16).GetCell(0).SetCellValue("序号");
|
||
region = new CellRangeAddress(rowIndex + 16, rowIndex + 16, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 16).GetCell(1).SetCellValue("检件编号/部位名称");
|
||
ws.GetRow(rowIndex + 16).GetCell(3).SetCellValue("检件规格(mm×mm)");
|
||
ws.GetRow(rowIndex + 16).GetCell(4).SetCellValue("焊工号");
|
||
ws.GetRow(rowIndex + 16).GetCell(5).SetCellValue("检测长度(mm)");
|
||
ws.GetRow(rowIndex + 16).GetCell(6).SetCellValue("峰值波幅(dB)");
|
||
ws.GetRow(rowIndex + 16).GetCell(7).SetCellValue("缺陷位置 (mm)");
|
||
ws.GetRow(rowIndex + 16).GetCell(8).SetCellValue("缺陷深度(mm)");
|
||
ws.GetRow(rowIndex + 16).GetCell(9).SetCellValue("缺陷定量Φ/L/S/%/Δ");
|
||
region = new CellRangeAddress(rowIndex + 16, rowIndex + 16, 10, 12);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 16).GetCell(10).SetCellValue("质量等级");
|
||
ws.GetRow(rowIndex + 16).GetCell(13).SetCellValue("备注");
|
||
|
||
#endregion
|
||
|
||
}
|
||
else// if (i == 2)
|
||
{
|
||
//尾部增加行
|
||
endaddNum = 2;
|
||
//创建头部行和列
|
||
ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 13, true);
|
||
//取数据开始和结束条数
|
||
var pNum = (i - 2) * 26;
|
||
dStart = 9 + pNum;
|
||
dEnd = 35 + pNum;
|
||
//excel数据开始行和结束行
|
||
tStart = rowIndex + 6;
|
||
tEnd = rowIndex + 31;
|
||
|
||
////尾部增加行
|
||
//endaddNum = 7;
|
||
////创建头部行和列
|
||
//ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 13, true);
|
||
////取数据开始和结束条数
|
||
//dStart = 15;
|
||
//dEnd = 45;
|
||
////数据开始行和结束行
|
||
//tStart = rowIndex + 6;
|
||
//tEnd = rowIndex + 36;
|
||
|
||
#region 头部(续)
|
||
|
||
//行1
|
||
region = new CellRangeAddress(rowIndex, rowIndex, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("YA-BK-108.1-2019");
|
||
ws.GetRow(rowIndex).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex).GetCell(13).CellStyle = titleStyleOne;
|
||
//行2
|
||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("宁波甬安检测技术有限公司");
|
||
ws.GetRow(rowIndex + 1).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 1).GetCell(13).CellStyle = titleStyleTwo;
|
||
//行3
|
||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("超 声 波 检 测 记 录");
|
||
ws.GetRow(rowIndex + 2).GetCell(0).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(1).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(2).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(3).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(4).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(5).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(6).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(7).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(8).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(9).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(10).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(11).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(12).CellStyle =
|
||
ws.GetRow(rowIndex + 2).GetCell(13).CellStyle = titleStyleThree;
|
||
//行4
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("工程编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["TestEngineeringCode"].ToString());
|
||
ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("记录编号");
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 8);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue(tbTitle.Rows[0]["RecordCode"].ToString());
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue(string.Format("共{0}页 第{1}页", pageNum, i));
|
||
//行5
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("工程编号");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 2, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue(tbTitle.Rows[0]["ISO_IsoNo"].ToString());
|
||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue("工件名称");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue(tbTitle.Rows[0]["ProjectName"].ToString());
|
||
//行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("检件规格(mm×mm)");
|
||
ws.GetRow(rowIndex + 5).GetCell(4).SetCellValue("焊工号");
|
||
ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue("检测长度(mm)");
|
||
ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue("峰值波幅(dB)");
|
||
ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("缺陷位置 (mm)");
|
||
ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue("缺陷深度(mm)");
|
||
ws.GetRow(rowIndex + 5).GetCell(9).SetCellValue("缺陷定量Φ/L/S/%/Δ");
|
||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 10, 12);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue("质量等级");
|
||
ws.GetRow(rowIndex + 5).GetCell(13).SetCellValue("备注");
|
||
|
||
#endregion
|
||
}
|
||
//else
|
||
//{
|
||
// //尾部增加行
|
||
// endaddNum = 5;
|
||
// var pNum = (i - 2) * 37;
|
||
// //取数据开始和结束条数
|
||
// dStart = 46 + ((i - 3) * 37);
|
||
// dEnd = 46 + pNum;
|
||
// //数据开始行和结束行
|
||
// tStart = rowIndex;
|
||
// tEnd = rowIndex + 36;
|
||
//}
|
||
#endregion
|
||
|
||
#region 数据
|
||
|
||
//创建数据行和列
|
||
ws = ExcelCreateRow(ws, hssfworkbook, tStart, tEnd, style, 0, 13, hidNDT_Code.Value);
|
||
//获取当前页数据
|
||
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]["JOT_JointNo"].ToString());
|
||
ws.GetRow(dataRow).GetCell(3).SetCellValue(pageTb.Rows[j]["Specification"].ToString());
|
||
ws.GetRow(dataRow).GetCell(4).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString());
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
if (i == 1)
|
||
{
|
||
//创建尾部行1
|
||
ws.CreateRow(tEnd + 1);
|
||
ICellStyle endStyleOne = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 1).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 1).GetCell(eIndex).CellStyle = endStyleOne;
|
||
}
|
||
ws.GetRow(tEnd + 1).HeightInPoints = 24;
|
||
region = new CellRangeAddress(tEnd + 1, tEnd + 1, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 1).GetCell(0).SetCellValue("说明:缺陷定量中Φ-缺陷直径、L-缺陷长度、S-缺陷面积、%-1m2范围内缺陷面积比、Δ-底波降低量");
|
||
//创建尾部行2
|
||
ws.CreateRow(tEnd + 2);
|
||
ICellStyle endStyleTwo = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 2).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 2).GetCell(eIndex).CellStyle = endStyleTwo;
|
||
}
|
||
ws.GetRow(tEnd + 2).HeightInPoints = 24;
|
||
region = new CellRangeAddress(tEnd + 2, tEnd + 2, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 2).GetCell(0).SetCellValue("检测部位见无损检测部位示意图。 ");
|
||
//创建尾部行3
|
||
ws.CreateRow(tEnd + 3);
|
||
ICellStyle endStyleThree = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 3).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 3).GetCell(eIndex).CellStyle = endStyleThree;
|
||
}
|
||
ws.GetRow(tEnd + 3).HeightInPoints = 24;
|
||
region = new CellRangeAddress(tEnd + 3, tEnd + 3, 0, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 3).GetCell(0).SetCellValue("□检测结束后,经复验,检测时基线和灵敏度未超出标准允许变化。");
|
||
//创建尾部行4
|
||
ws.CreateRow(tEnd + 4);
|
||
ICellStyle endStyleFour = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Right, 10);
|
||
//创建尾部列
|
||
for (int eIndex = 0; eIndex <= 13; eIndex++)
|
||
{
|
||
ws.GetRow(tEnd + 4).CreateCell(eIndex);
|
||
ws.GetRow(tEnd + 4).GetCell(eIndex).CellStyle = endStyleThree;
|
||
}
|
||
ws.GetRow(tEnd + 4).HeightInPoints = 21f;
|
||
region = new CellRangeAddress(tEnd + 4, tEnd + 4, 0, 1);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(tEnd + 4, tEnd + 4, 3, 4);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(tEnd + 4, tEnd + 4, 6, 7);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(tEnd + 4, tEnd + 4, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(tEnd + 4).GetCell(0).SetCellValue("检测:");
|
||
ws.GetRow(tEnd + 4).GetCell(5).SetCellValue("复核:");
|
||
ws.GetRow(tEnd + 4).GetCell(8).SetCellValue("日期:");
|
||
}
|
||
#endregion
|
||
|
||
rowIndex = tEnd + endaddNum;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
ws.SetMargin(MarginType.LeftMargin, 0);
|
||
ws.SetMargin(MarginType.RightMargin, 0);
|
||
|
||
//ws.SetMargin(MarginType.BottomMargin, 0.2);
|
||
//ws.SetMargin(MarginType.TopMargin, 0.2);
|
||
//ws.SetMargin(MarginType.FooterMargin, 0.1);
|
||
//ws.SetMargin(MarginType.HeaderMargin, 0.1);
|
||
|
||
|
||
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, string ndtCode)
|
||
{
|
||
CellRangeAddress region;
|
||
for (int i = sRows; i <= eRows; i++)
|
||
{
|
||
ws.CreateRow(i);
|
||
ws.GetRow(i).HeightInPoints = 21f;
|
||
for (int j = cStart; j <= cEnd; j++)
|
||
{
|
||
ws.GetRow(i).CreateCell(j);
|
||
ws.GetRow(i).GetCell(j).CellStyle = style;
|
||
}
|
||
if (ndtCode == "RT")
|
||
{
|
||
region = new CellRangeAddress(i, i, 10, 11);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(i, i, 12, 13);
|
||
ws.AddMergedRegion(region);
|
||
}
|
||
else if (ndtCode == "PT")
|
||
{
|
||
region = new CellRangeAddress(i, i, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(i, i, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
}
|
||
else if (ndtCode == "MT")
|
||
{
|
||
region = new CellRangeAddress(i, i, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(i, i, 9, 13);
|
||
ws.AddMergedRegion(region);
|
||
}
|
||
else if (ndtCode == "UT")
|
||
{
|
||
region = new CellRangeAddress(i, i, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(i, i, 10, 12);
|
||
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, bool xuTitle = false)
|
||
{
|
||
var noneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true);
|
||
|
||
for (int i = sRows; i <= eRows; i++)
|
||
{
|
||
ws.CreateRow(i);
|
||
if (xuTitle)
|
||
{
|
||
ws.GetRow(i).HeightInPoints = i == (sRows + 5) ? 30f : 25f;
|
||
}
|
||
else
|
||
{
|
||
ws.GetRow(i).HeightInPoints = i == (sRows + 16) ? 30f : 25f;
|
||
}
|
||
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
|
||
|
||
}
|
||
} |