2024-05-08 16:27:28 +08:00
using System ;
using System.Collections.Generic ;
using System.Data ;
using System.Data.SqlClient ;
using System.Diagnostics ;
using System.Drawing.Imaging ;
using System.IO ;
using System.Linq ;
using System.Web ;
using System.Web.UI ;
using System.Web.UI.WebControls ;
using System.Windows.Forms ;
using BLL ;
using Newtonsoft.Json.Linq ;
using NPOI.HSSF.UserModel ;
using NPOI.SS.UserModel ;
using NPOI.SS.Util ;
using NPOI.XSSF.Streaming ;
using NPOI.XSSF.UserModel ;
using BorderStyle = NPOI . SS . UserModel . BorderStyle ;
namespace FineUIPro.Web.WeldingProcess.TestPackageManage
{
public partial class TestPackageManageAudit : PageBase
{
#region 定 义 项
/// <summary>
/// 试压包主键
/// </summary>
public string PTP_ID
{
get
{
return ( string ) ViewState [ "PTP_ID" ] ;
}
set
{
ViewState [ "PTP_ID" ] = value ;
}
}
/// <summary>
/// 未通过数
/// </summary>
public int Count
{
get
{
return ( int ) ViewState [ "Count" ] ;
}
set
{
ViewState [ "Count" ] = value ;
}
}
#endregion
#region 加 载 页 面
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load ( object sender , EventArgs e )
{
if ( ! IsPostBack )
{
this . ddlPageSize . SelectedValue = this . Grid1 . PageSize . ToString ( ) ;
this . PTP_ID = string . Empty ;
this . txtSearchDate . Text = string . Format ( "{0:yyyy-MM}" , System . DateTime . Now ) ;
//打印报表项
this . drpPrintTypeList . DataSource = BLL . Common_ReportPrintService . TestPackageSelectPrint ( ) ;
this . drpPrintTypeList . DataTextField = "Title" ;
this . drpPrintTypeList . DataValueField = "Id" ;
this . drpPrintTypeList . DataBind ( ) ;
Funs . FineUIPleaseSelect ( this . drpPrintTypeList ) ;
// 审核人
BLL . Project_UserService . InitProjectUserDropDownList ( drpAuditMan , true , this . CurrUser . LoginProjectId , Resources . Lan . PleaseSelect ) ;
this . InitTreeMenu ( ) ; //加载树
}
}
#endregion
#region 加 载 树 装 置 - 单 位 - 工 作 区
/// <summary>
/// 加载树
/// </summary>
private void InitTreeMenu ( )
{
this . tvControlItem . Nodes . Clear ( ) ;
TreeNode rootNode = new TreeNode ( ) ;
rootNode . Text = "单位-装置-月份" ;
rootNode . NodeID = "0" ;
rootNode . Expanded = true ;
this . tvControlItem . Nodes . Add ( rootNode ) ;
DateTime startTime = Convert . ToDateTime ( this . txtSearchDate . Text . Trim ( ) + "-01" ) ;
DateTime endTime = startTime . AddMonths ( 1 ) ;
List < Model . Base_Unit > units = new List < Model . Base_Unit > ( ) ; ///单位
var pUnit = BLL . Project_UnitService . GetProject_UnitByProjectIdUnitId ( this . CurrUser . LoginProjectId , this . CurrUser . UnitId ) ;
if ( pUnit = = null | | pUnit . UnitType = = BLL . Const . UnitType_1 | | pUnit . UnitType = = BLL . Const . UnitType_2
| | pUnit . UnitType = = BLL . Const . UnitType_3 | | pUnit . UnitType = = BLL . Const . UnitType_4 )
{
units = ( from x in Funs . DB . Base_Unit
join y in Funs . DB . Project_Unit on x . UnitId equals y . UnitId
where y . ProjectId = = this . CurrUser . LoginProjectId & & y . UnitType . Contains ( BLL . Const . UnitType_5 )
select x ) . ToList ( ) ;
}
else
{
units . Add ( BLL . Base_UnitService . GetUnit ( this . CurrUser . UnitId ) ) ;
}
List < Model . PTP_TestPackage > testPackageLists = ( from x in Funs . DB . PTP_TestPackage
where x . ProjectId = = this . CurrUser . LoginProjectId & & x . TableDate > = startTime & & x . TableDate < endTime
select x ) . ToList ( ) ;
if ( units ! = null )
{
foreach ( var unit in units )
{
TreeNode rootUnitNode = new TreeNode ( ) ; //定义根节点
rootUnitNode . Text = unit . UnitName ;
rootUnitNode . NodeID = unit . UnitId ;
rootUnitNode . Expanded = true ;
rootUnitNode . ToolTip = "施工单位" ;
rootNode . Nodes . Add ( rootUnitNode ) ;
var testPackageUnitList = testPackageLists . Where ( x = > x . UnitId = = unit . UnitId ) . ToList ( ) ;
this . BindNodes ( rootUnitNode , testPackageUnitList ) ;
}
}
else
{
ShowNotify ( "请先增加施工单位!" , MessageBoxIcon . Warning ) ;
return ;
}
}
#endregion
#region 绑 定 树 节 点
/// <summary>
/// 绑定树节点
/// </summary>
/// <param name="node"></param>
private void BindNodes ( TreeNode node , List < Model . PTP_TestPackage > testPackageUnitList )
{
if ( node . ToolTip = = "施工单位" )
{
var installId = ( from x in testPackageUnitList
where x . UnitId = = node . NodeID
select x . InstallationId ) . Distinct ( ) ;
if ( installId . Count ( ) > 0 )
{
var install = from x in Funs . DB . Project_Installation
where installId . Contains ( x . InstallationId )
orderby x . InstallationCode
select x ;
foreach ( var q in install )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = q . InstallationName ;
newNode . NodeID = q . InstallationId + "|" + node . NodeID ;
newNode . ToolTip = "装置" ;
newNode . Expanded = true ;
node . Nodes . Add ( newNode ) ;
this . BindNodes ( newNode , testPackageUnitList ) ;
}
}
}
else if ( node . ToolTip = = "装置" )
{
string installationId = Funs . GetStrListByStr ( node . NodeID , '|' ) [ 0 ] ;
var pointListMonth = ( from x in testPackageUnitList
where x . InstallationId = = installationId
select string . Format ( "{0:yyyy-MM}" , x . TableDate ) ) . Distinct ( ) ;
foreach ( var item in pointListMonth )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = item ;
newNode . NodeID = item + "|" + node . NodeID ;
newNode . ToolTip = "月份" ;
node . Nodes . Add ( newNode ) ;
this . BindNodes ( newNode , testPackageUnitList ) ;
}
}
//else if (node.ToolTip == "月份")
//{
// string installationId = Funs.GetStrListByStr(node.ParentNode.NodeID, '|')[0];
// var days = (from x in testPackageUnitList
// where x.InstallationId == installationId
// orderby x.TableDate descending
// select x.TableDate).Distinct();
// foreach (var item in days)
// {
// TreeNode newNode = new TreeNode();
// newNode.Text = string.Format("{0:yyyy-MM-dd}", item);
// newNode.NodeID = item.ToString() + "|" + node.NodeID;
// newNode.ToolTip = "日期";
// node.Nodes.Add(newNode);
// this.BindNodes(newNode, testPackageUnitList);
// }
//}
else if ( node . ToolTip = = "月份" )
{
DateTime startTime = Convert . ToDateTime ( this . txtSearchDate . Text . Trim ( ) + "-01" ) ;
DateTime endTime = startTime . AddMonths ( 1 ) ;
string installationId = Funs . GetStrListByStr ( node . ParentNode . NodeID , '|' ) [ 0 ] ;
var dReports = from x in testPackageUnitList
where x . InstallationId = = installationId
& & x . TableDate > = startTime & & x . TableDate < endTime
orderby x . TestPackageNo descending
select x ;
foreach ( var item in dReports )
{
TreeNode newNode = new TreeNode ( ) ;
if ( ! string . IsNullOrEmpty ( item . TestPackageNo ) )
{
newNode . Text = item . TestPackageNo ;
}
else
{
newNode . Text = "未知" ;
}
if ( ! item . AduditDate . HasValue | | string . IsNullOrEmpty ( item . Auditer ) )
{
newNode . Text = "<font color='#FF7575'>" + newNode . Text + "</font>" ;
node . Text = "<font color='#FF7575'>" + node . Text + "</font>" ;
node . ParentNode . Text = "<font color='#FF7575'>" + node . ParentNode . Text + "</font>" ;
}
newNode . NodeID = item . PTP_ID ;
newNode . EnableClickEvent = true ;
node . Nodes . Add ( newNode ) ;
}
}
}
#endregion
#region 点 击 TreeView
/// <summary>
/// 点击TreeView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand ( object sender , TreeCommandEventArgs e )
{
this . PTP_ID = tvControlItem . SelectedNodeID ;
this . BindGrid ( ) ;
}
#endregion
#region 数 据 绑 定
/// <summary>
/// 数据绑定
/// </summary>
private void BindGrid ( )
{
this . SetTextTemp ( ) ;
this . PageInfoLoad ( ) ; ///页面输入保存信息
string strSql = @ "SELECT * FROM dbo.View_PTP_TestPackageAudit
WHERE ProjectId = @ProjectId AND PTP_ID = @PTP_ID ";
List < SqlParameter > listStr = new List < SqlParameter > ( ) ;
listStr . Add ( new SqlParameter ( "@ProjectId" , this . CurrUser . LoginProjectId ) ) ;
listStr . Add ( new SqlParameter ( "@PTP_ID" , this . PTP_ID ) ) ;
SqlParameter [ ] parameter = listStr . ToArray ( ) ;
DataTable tb = SQLHelper . GetDataTableRunText ( strSql , parameter ) ;
// 2.获取当前分页数据
//var table = this.GetPagedDataTable(Grid1, tb1);
Grid1 . RecordCount = tb . Rows . Count ;
var table = this . GetPagedDataTable ( Grid1 , tb ) ;
Grid1 . DataSource = table ;
Grid1 . DataBind ( ) ;
this . ShowGridItem ( ) ;
}
/// <summary>
/// 行颜色设置
/// </summary>
private void ShowGridItem ( )
{
Count = 0 ;
int Count1 = 0 , Count2 = 0 , Count3 = 0 , Count4 = 0 ;
int rowsCount = this . Grid1 . Rows . Count ;
for ( int i = 0 ; i < rowsCount ; i + + )
{
int IsoInfoCount = Funs . GetNewIntOrZero ( this . Grid1 . Rows [ i ] . Values [ 3 ] . ToString ( ) ) ; //总焊口
int IsoInfoCountT = Funs . GetNewIntOrZero ( this . Grid1 . Rows [ i ] . Values [ 4 ] . ToString ( ) ) ; //完成总焊口
int CountS = Funs . GetNewIntOrZero ( this . Grid1 . Rows [ i ] . Values [ 5 ] . ToString ( ) ) ; ; //合格数
int CountU = Funs . GetNewIntOrZero ( this . Grid1 . Rows [ i ] . Values [ 6 ] . ToString ( ) ) ; ; //不合格数
decimal Rate = 0 ;
bool convertible = decimal . TryParse ( this . Grid1 . Rows [ i ] . Values [ 9 ] . ToString ( ) , out Rate ) ; //应检测比例
decimal Ratio = Funs . GetNewDecimalOrZero ( this . Grid1 . Rows [ i ] . Values [ 10 ] . ToString ( ) ) ; //实际检测比例
if ( IsoInfoCount > IsoInfoCountT ) //未焊完
{
Count1 + = 1 ;
this . Grid1 . Rows [ i ] . RowCssClass = "Cyan" ;
}
else if ( Rate > Ratio ) //已焊完,未达检测比例
{
Count2 + = 1 ;
this . Grid1 . Rows [ i ] . RowCssClass = "Yellow" ;
}
else if ( CountU > 0 ) //已焊完,已达检测比例,但有不合格
{
Count3 + = 1 ;
this . Grid1 . Rows [ i ] . RowCssClass = "Green" ;
}
else
{
Count4 + = 1 ;
this . Grid1 . Rows [ i ] . RowCssClass = "Purple" ;
}
}
Count = Count1 + Count2 + Count2 ;
this . lab1 . Text = Count1 . ToString ( ) ;
this . lab2 . Text = Count2 . ToString ( ) ;
this . lab3 . Text = Count3 . ToString ( ) ;
this . lab4 . Text = Count4 . ToString ( ) ;
}
#region 加 载 页 面 输 入 保 存 信 息
/// <summary>
/// 加载页面输入保存信息
/// </summary>
private void PageInfoLoad ( )
{
this . btnAudit . Hidden = true ;
this . btnCancelAudit . Hidden = true ;
var testPackageManage = BLL . TestPackageManageEditService . GetTestPackageByID ( this . PTP_ID ) ;
if ( testPackageManage ! = null )
{
this . txtTestPackageNo . Text = testPackageManage . TestPackageNo ;
//if (!string.IsNullOrEmpty(testPackageManage.UnitId))
//{
// var unit = BLL.Base_UnitService.GetUnit(testPackageManage.UnitId);
// if (unit != null)
// {
// this.drpUnit.Text = unit.UnitName;
// }
//}
if ( ! string . IsNullOrEmpty ( testPackageManage . InstallationId ) )
{
var install = BLL . Project_InstallationService . GetProject_InstallationByInstallationId ( testPackageManage . InstallationId ) ;
if ( install ! = null )
{
this . drpInstallation . Text = install . InstallationName ;
}
}
this . txtTestPackageName . Text = testPackageManage . TestPackageName ;
//this.txtTestPackageCode.Text = testPackageManage.TestPackageCode;
if ( ! string . IsNullOrEmpty ( testPackageManage . TestType ) )
{
var testType = BLL . Base_PressureService . GetPressureByPressureId ( testPackageManage . TestType ) ;
if ( testType ! = null )
{
this . drpTestType . Text = testType . PressureName ;
}
}
this . txtTestService . Text = testPackageManage . TestService ;
this . txtTestHeat . Text = testPackageManage . TestHeat ;
this . txtTestAmbientTemp . Text = testPackageManage . TestAmbientTemp ;
this . txtTestMediumTemp . Text = testPackageManage . TestMediumTemp ;
this . txtVacuumTestService . Text = testPackageManage . VacuumTestService ;
this . txtVacuumTestPressure . Text = testPackageManage . VacuumTestPressure ;
this . txtTightnessTestTime . Text = testPackageManage . TightnessTestTime ;
this . txtTightnessTestTemp . Text = testPackageManage . TightnessTestTemp ;
this . txtTightnessTest . Text = testPackageManage . TightnessTest ;
this . txtTestPressure . Text = testPackageManage . TestPressure ;
this . txtTestPressureTemp . Text = testPackageManage . TestPressureTemp ;
this . txtTestPressureTime . Text = testPackageManage . TestPressureTime ;
this . txtOperationMedium . Text = testPackageManage . OperationMedium ;
this . txtPurgingMedium . Text = testPackageManage . PurgingMedium ;
this . txtCleaningMedium . Text = testPackageManage . CleaningMedium ;
this . txtLeakageTestService . Text = testPackageManage . LeakageTestService ;
this . txtLeakageTestPressure . Text = testPackageManage . LeakageTestPressure ;
this . txtAllowSeepage . Text = testPackageManage . AllowSeepage ;
this . txtFactSeepage . Text = testPackageManage . FactSeepage ;
this . txtModifyDate . Text = string . Format ( "{0:yyyy-MM-dd}" , testPackageManage . ModifyDate ) ;
if ( ! string . IsNullOrEmpty ( testPackageManage . Modifier ) )
{
var users = BLL . Sys_UserService . GetUsersByUserId ( testPackageManage . Modifier ) ;
if ( users ! = null )
{
this . drpModifier . Text = users . UserName ;
}
}
this . txtTableDate . Text = string . Format ( "{0:yyyy-MM-dd}" , testPackageManage . TableDate ) ;
if ( ! string . IsNullOrEmpty ( testPackageManage . Tabler ) )
{
var users = BLL . Sys_UserService . GetUsersByUserId ( testPackageManage . Tabler ) ;
if ( users ! = null )
{
this . drpTabler . Text = users . UserName ;
}
}
this . txtRemark . Text = testPackageManage . Remark ;
this . txtAuditDate . Text = string . Format ( "{0:yyyy-MM-dd}" , testPackageManage . AduditDate ) ;
if ( ! string . IsNullOrEmpty ( testPackageManage . Auditer ) )
{
this . drpAuditMan . SelectedValue = testPackageManage . Auditer ;
}
if ( string . IsNullOrEmpty ( testPackageManage . Auditer ) | | ! testPackageManage . AduditDate . HasValue )
{
this . btnAudit . Hidden = false ;
this . drpAuditMan . Enabled = true ;
this . txtAuditDate . Enabled = true ;
}
else
{
this . btnCancelAudit . Hidden = false ;
this . drpAuditMan . Enabled = false ;
this . txtAuditDate . Enabled = false ;
}
}
}
#endregion
#region 清 空 输 入 框
/// <summary>
/// 清空输入框
/// </summary>
private void SetTextTemp ( )
{
this . txtTestPackageNo . Text = string . Empty ;
//this.drpUnit.Text = string.Empty;
this . drpInstallation . Text = string . Empty ;
this . txtTestPackageName . Text = string . Empty ;
//this.txtTestPackageCode.Text = string.Empty;
this . drpTestType . Text = string . Empty ;
this . txtTestService . Text = string . Empty ;
this . txtTestHeat . Text = string . Empty ;
this . txtTestAmbientTemp . Text = string . Empty ;
this . txtTestMediumTemp . Text = string . Empty ;
this . txtVacuumTestService . Text = string . Empty ;
this . txtVacuumTestPressure . Text = string . Empty ;
this . txtTightnessTestTime . Text = string . Empty ;
this . txtTightnessTestTemp . Text = string . Empty ;
this . txtTightnessTest . Text = string . Empty ;
this . txtTestPressure . Text = string . Empty ;
this . txtTestPressureTemp . Text = string . Empty ;
this . txtTestPressureTime . Text = string . Empty ;
this . txtOperationMedium . Text = string . Empty ;
this . txtPurgingMedium . Text = string . Empty ;
this . txtCleaningMedium . Text = string . Empty ;
this . txtLeakageTestService . Text = string . Empty ;
this . txtLeakageTestPressure . Text = string . Empty ;
this . txtAllowSeepage . Text = string . Empty ;
this . txtFactSeepage . Text = string . Empty ;
this . drpModifier . Text = string . Empty ;
this . txtModifyDate . Text = string . Empty ;
this . drpTabler . Text = string . Empty ;
this . txtTableDate . Text = string . Empty ;
this . txtRemark . Text = string . Empty ;
this . drpAuditMan . SelectedValue = BLL . Const . _Null ;
this . txtAuditDate . Text = string . Empty ;
}
#endregion
#endregion
#region 分 页 排 序
#region 页 索 引 改 变 事 件
/// <summary>
/// 页索引改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange ( object sender , GridPageEventArgs e )
{
BindGrid ( ) ;
}
#endregion
#region 排 序
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort ( object sender , GridSortEventArgs e )
{
BindGrid ( ) ;
}
#endregion
#region 分 页 选 择 下 拉 改 变 事 件
/// <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 ( ) ;
}
#endregion
#endregion
#region 试 压 包 审 核 事 件
#region 审 核 检 测 单
/// <summary>
/// 审核检测单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAudit_Click ( object sender , EventArgs e )
{
if ( CommonService . GetAllButtonPowerList ( this . CurrUser . LoginProjectId , this . CurrUser . UserId , Const . TestPackageManageAuditMenuId , Const . BtnAuditing ) )
{
var updateTestPackage = BLL . TestPackageManageEditService . GetTestPackageByID ( this . PTP_ID ) ;
if ( updateTestPackage ! = null )
{
if ( Count = = 0 )
{
string isnoHot = BLL . TestPackageManageEditService . IsExistNoHotHardItem ( this . PTP_ID ) ;
if ( string . IsNullOrEmpty ( isnoHot ) )
{
string inspectionIsoRate = BLL . TestPackageManageEditService . InspectionIsoRate ( this . PTP_ID ) ;
if ( string . IsNullOrEmpty ( inspectionIsoRate ) )
{
if ( ! String . IsNullOrEmpty ( this . txtAuditDate . Text ) & & this . drpAuditMan . SelectedValue ! = BLL . Const . _Null )
{
updateTestPackage . AduditDate = Funs . GetNewDateTime ( this . txtAuditDate . Text ) ;
updateTestPackage . Auditer = this . drpAuditMan . SelectedValue ;
BLL . TestPackageManageAuditService . AuditTestPackage ( updateTestPackage ) ;
this . InitTreeMenu ( ) ;
this . BindGrid ( ) ;
ShowNotify ( "审核完成!" , MessageBoxIcon . Success ) ;
}
else
{
Alert . ShowInTop ( "请填写审核人和审核日期!" , MessageBoxIcon . Warning ) ;
}
}
else
{
Alert . ShowInTop ( inspectionIsoRate , MessageBoxIcon . Warning ) ;
return ;
}
}
else
{
Alert . ShowInTop ( isnoHot , MessageBoxIcon . Warning ) ;
return ;
}
}
else
{
Alert . ShowInTop ( "管线未全部通过不允许审核操作!" , MessageBoxIcon . Warning ) ;
return ;
}
}
else
{
Alert . ShowInTop ( "请选择要审核的单据!" , MessageBoxIcon . Warning ) ;
return ;
}
}
else
{
Alert . ShowInTop ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
return ;
}
}
#endregion
#region 取 消 审 核 检 测 单
/// <summary>
/// 取消审核检测单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnCancelAudit_Click ( object sender , EventArgs e )
{
if ( CommonService . GetAllButtonPowerList ( this . CurrUser . LoginProjectId , this . CurrUser . UserId , Const . TestPackageManageAuditMenuId , Const . BtnCancelAuditing ) )
{
var updateTestPackage = BLL . TestPackageManageEditService . GetTestPackageByID ( this . PTP_ID ) ;
if ( updateTestPackage ! = null )
{
updateTestPackage . Auditer = null ;
updateTestPackage . AduditDate = null ;
BLL . TestPackageManageAuditService . AuditTestPackage ( updateTestPackage ) ;
this . InitTreeMenu ( ) ;
this . BindGrid ( ) ;
ShowNotify ( "取消审核完成!" , MessageBoxIcon . Success ) ;
}
else
{
ShowNotify ( "请确认单据!" , MessageBoxIcon . Warning ) ;
}
}
else
{
ShowNotify ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
}
}
#endregion
#endregion
#region 关 闭 弹 出 窗 口 及 刷 新 页 面
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close ( object sender , WindowCloseEventArgs e )
{
this . PTP_ID = this . hdPTP_ID . Text ;
this . BindGrid ( ) ;
this . InitTreeMenu ( ) ;
this . hdPTP_ID . Text = string . Empty ;
}
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Tree_TextChanged ( object sender , EventArgs e )
{
this . InitTreeMenu ( ) ;
this . BindGrid ( ) ;
}
#endregion
#region 试 压 包 打 印
/// <summary>
/// 试压包打印
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPrint_Click ( object sender , EventArgs e )
{
var selectValArray = this . drpPrintTypeList . SelectedValueArray ;
if ( selectValArray . Length < = 0 )
{
Alert . ShowInTop ( "请选择打印报表!" , MessageBoxIcon . Warning ) ;
return ;
}
string selectValStr = string . Join ( "," , selectValArray ) . Replace ( "null," , "" ) ;
if ( selectValStr = = "null" )
{
Alert . ShowInTop ( "请选择打印报表!" , MessageBoxIcon . Warning ) ;
return ;
}
CreateDataExcel ( selectValArray ) ;
}
#region 绘 画 模 版
//1-TP-01-试压包路径表UG-FW-001
private void template1 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
//插入图片部分
var img1 = Server . MapPath ( "~/res/images/bsf/1.png" ) ;
var img2 = Server . MapPath ( "~/res/images/bsf/2.png" ) ;
var img3 = Server . MapPath ( "~/res/images/bsf/3.png" ) ;
var img4 = Server . MapPath ( "~/res/images/bsf/4.png" ) ;
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 16 , style , 0 , 18 , true ) ;
ws . GetRow ( rowIndex ) . GetCell ( 15 ) . SetCellValue ( "Form No." ) ;
ws . GetRow ( rowIndex ) . GetCell ( 16 ) . SetCellValue ( "TP-06" ) ;
//设置列宽度
ws . SetColumnWidth ( 0 , 1 * 256 ) ;
ws . SetColumnWidth ( 1 , 1 * 256 ) ;
ws . SetColumnWidth ( 2 , 7 * 256 ) ;
ws . SetColumnWidth ( 3 , 7 * 256 ) ;
ws . SetColumnWidth ( 4 , 7 * 256 ) ;
ws . SetColumnWidth ( 5 , 12 * 256 ) ;
ws . SetColumnWidth ( 6 , 10 * 256 ) ;
ws . SetColumnWidth ( 7 , 10 * 256 ) ;
ws . SetColumnWidth ( 8 , 6 * 256 ) ;
ws . SetColumnWidth ( 9 , 10 * 256 ) ;
ws . SetColumnWidth ( 10 , 10 * 256 ) ;
ws . SetColumnWidth ( 11 , 6 * 256 ) ;
ws . SetColumnWidth ( 12 , 10 * 256 ) ;
ws . SetColumnWidth ( 13 , 10 * 256 ) ;
ws . SetColumnWidth ( 14 , 6 * 256 ) ;
ws . SetColumnWidth ( 15 , 10 * 256 ) ;
ws . SetColumnWidth ( 16 , 10 * 256 ) ;
ws . SetColumnWidth ( 17 , 6 * 256 ) ;
ws . SetColumnWidth ( 18 , 1 * 256 ) ;
//设置前1-5行高度
ws . GetRow ( 0 ) . Height = 15 * 20 ;
ws . GetRow ( 1 ) . Height = 15 * 20 ;
ws . GetRow ( 2 ) . Height = 14 * 20 ;
ws . GetRow ( 3 ) . Height = 12 * 20 ;
ws . GetRow ( 4 ) . Height = 22 * 20 ;
//插入图片
InsertImage ( hssfworkbook , ws , 2 , 2 , 2 , 3 , img1 , 1.3 , 1.1 ) ;
InsertImage ( hssfworkbook , ws , 2 , 4 , 2 , 5 , img2 , 1.4 , 1.1 ) ;
InsertImage ( hssfworkbook , ws , 2 , 14 , 2 , 15 , img3 , 1.6 , 1.1 ) ;
InsertImage ( hssfworkbook , ws , 2 , 16 , 2 , 17 , img4 , 1.6 , 1.1 ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 5 ) . SetCellValue ( "巴斯夫(广东)一体化项目 \r\n\t BASF(Guangdong) Integrated Project Citral Cluster" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 5 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 16 , true , true , "Times New Roman" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 5 , 14 ) ) ;
ws . GetRow ( 2 ) . Height = 55 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 8 , 1 , 17 ) ) ;
var setStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 26 , true , true , "Arial" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 1 ) . SetCellValue ( "管道试压包流转路径表 \r\n Piping Test Package Routing Form" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 1 ) . CellStyle = setStyle ;
//设置6-10 行 行高度
ws . GetRow ( rowIndex + 5 ) . Height = 25 * 20 ;
ws . GetRow ( rowIndex + 6 ) . Height = 13 * 20 ;
ws . GetRow ( rowIndex + 7 ) . Height = 27 * 20 ;
ws . GetRow ( rowIndex + 8 ) . Height = 22 * 20 ;
ws . GetRow ( rowIndex + 9 ) . Height = 15 * 20 ;
ws . GetRow ( rowIndex + 10 ) . Height = 32 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 10 , rowIndex + 10 , 1 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 10 , rowIndex + 10 , 4 , 5 ) ) ;
ws . GetRow ( rowIndex + 11 ) . Height = 11 * 20 ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 1 ) . SetCellValue ( "试压包号\r\nTest Package No." ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 4 ) . SetCellValue ( "UG-130-FW-HT-0001" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 12 , rowIndex + 13 , 2 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 12 , rowIndex + 13 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 12 , rowIndex + 13 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 12 , rowIndex + 13 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 12 , rowIndex + 13 , 15 , 16 ) ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . SetCellValue ( "ACTIVITY" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None ,
BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 6 ) . SetCellValue ( "CC7" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 6 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None ,
BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . SetCellValue ( "JIANLI" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None ,
BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 12 ) . SetCellValue ( "WORLEY" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 12 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None ,
BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 15 ) . SetCellValue ( "BASF" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 15 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None ,
BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 15 , rowIndex + 65 , style , 0 , 18 , true ) ;
2024-06-05 08:24:19 +08:00
for ( int i = 15 ; i < 66 ; i + + )
{
2024-05-08 16:27:28 +08:00
ws . GetRow ( rowIndex + i ) . Height = 28 * 20 ;
}
var image1 = Server . MapPath ( "~/res/images/bsf/图片1.png" ) ;
var image2 = Server . MapPath ( "~/res/images/bsf/图片2.png" ) ;
var image3 = Server . MapPath ( "~/res/images/bsf/图片3.png" ) ;
var image4 = Server . MapPath ( "~/res/images/bsf/图片4.png" ) ;
var image5 = Server . MapPath ( "~/res/images/bsf/图片5.png" ) ;
var image6 = Server . MapPath ( "~/res/images/bsf/图片6.png" ) ;
var image7 = Server . MapPath ( "~/res/images/bsf/图片7.png" ) ;
var image8 = Server . MapPath ( "~/res/images/bsf/图片8.png" ) ;
var image9 = Server . MapPath ( "~/res/images/bsf/图片9.png" ) ;
var image10 = Server . MapPath ( "~/res/images/bsf/图片10.png" ) ;
InsertImage ( hssfworkbook , ws , 15 , 2 , 17 , 4 , image1 , 1.55 , 1.32 ) ;
InsertImage ( hssfworkbook , ws , 18 , 2 , 20 , 4 , image10 , 0.02 , 2.27 ) ;
InsertImage ( hssfworkbook , ws , 21 , 2 , 23 , 4 , image2 , 1.55 , 1.12 ) ;
InsertImage ( hssfworkbook , ws , 24 , 2 , 26 , 4 , image10 , 0.02 , 2.27 ) ;
InsertImage ( hssfworkbook , ws , 27 , 2 , 29 , 4 , image3 , 1.55 , 1.12 ) ;
InsertImage ( hssfworkbook , ws , 30 , 2 , 33 , 4 , image10 , 0.02 , 2.27 ) ;
InsertImage ( hssfworkbook , ws , 33 , 2 , 35 , 4 , image4 , 1.55 , 1.12 ) ;
InsertImage ( hssfworkbook , ws , 36 , 2 , 38 , 4 , image10 , 0.02 , 2.27 ) ;
InsertImage ( hssfworkbook , ws , 39 , 2 , 41 , 4 , image5 , 1.55 , 1.12 ) ;
InsertImage ( hssfworkbook , ws , 42 , 2 , 44 , 4 , image10 , 0.02 , 2.27 ) ;
InsertImage ( hssfworkbook , ws , 45 , 2 , 47 , 4 , image6 , 1.55 , 1.12 ) ;
InsertImage ( hssfworkbook , ws , 48 , 2 , 50 , 4 , image10 , 0.02 , 2.27 ) ;
InsertImage ( hssfworkbook , ws , 51 , 2 , 53 , 4 , image7 , 1.55 , 1.12 ) ;
InsertImage ( hssfworkbook , ws , 54 , 2 , 55 , 4 , image10 , 0.02 , 2.27 ) ;
InsertImage ( hssfworkbook , ws , 57 , 2 , 59 , 4 , image8 , 1.55 , 1.12 ) ;
InsertImage ( hssfworkbook , ws , 60 , 2 , 62 , 4 , image10 , 0.02 , 2.27 ) ;
InsertImage ( hssfworkbook , ws , 63 , 2 , 65 , 4 , image9 , 1.55 , 1.12 ) ;
//循环数据表格部分
ws . GetRow ( rowIndex + 15 ) . Height = 30 * 20 ;
ws . GetRow ( rowIndex + 16 ) . Height = 30 * 20 ;
ws . GetRow ( rowIndex + 17 ) . Height = 30 * 20 ;
#region 第 一 层 签 名
ws . GetRow ( rowIndex + 15 ) . GetCell ( 5 ) . SetCellValue ( "姓名\r\nNAME" ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 5 ) . SetCellValue ( "签名\r\nSIGNATURE" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 5 ) . SetCellValue ( "日期\r\nDATE" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 15 , 16 ) , ws ) ;
#endregion
#region 第 二 层 签 名
ws . GetRow ( rowIndex + 21 ) . GetCell ( 5 ) . SetCellValue ( "姓名\r\nNAME" ) ;
ws . GetRow ( rowIndex + 22 ) . GetCell ( 5 ) . SetCellValue ( "签名\r\nSIGNATURE" ) ;
ws . GetRow ( rowIndex + 23 ) . GetCell ( 5 ) . SetCellValue ( "日期\r\nDATE" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 22 , rowIndex + 22 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 22 , rowIndex + 22 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 22 , rowIndex + 22 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 22 , rowIndex + 22 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 22 , rowIndex + 22 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 22 , rowIndex + 22 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 22 , rowIndex + 22 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 22 , rowIndex + 22 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 15 , 16 ) , ws ) ;
#endregion
#region 第 三 层 签 名
ws . GetRow ( rowIndex + 27 ) . GetCell ( 5 ) . SetCellValue ( "姓名\r\nNAME" ) ;
ws . GetRow ( rowIndex + 28 ) . GetCell ( 5 ) . SetCellValue ( "签名\r\nSIGNATURE" ) ;
ws . GetRow ( rowIndex + 29 ) . GetCell ( 5 ) . SetCellValue ( "日期\r\nDATE" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 28 , rowIndex + 28 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 28 , rowIndex + 28 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 28 , rowIndex + 28 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 28 , rowIndex + 28 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 28 , rowIndex + 28 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 28 , rowIndex + 28 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 28 , rowIndex + 28 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 28 , rowIndex + 28 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 29 , rowIndex + 29 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 29 , rowIndex + 29 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 29 , rowIndex + 29 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 29 , rowIndex + 29 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 29 , rowIndex + 29 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 29 , rowIndex + 29 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 29 , rowIndex + 29 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 29 , rowIndex + 29 , 15 , 16 ) , ws ) ;
#endregion
#region 第 四 层 签 名
ws . GetRow ( rowIndex + 33 ) . GetCell ( 5 ) . SetCellValue ( "姓名\r\nNAME" ) ;
ws . GetRow ( rowIndex + 34 ) . GetCell ( 5 ) . SetCellValue ( "签名\r\nSIGNATURE" ) ;
ws . GetRow ( rowIndex + 35 ) . GetCell ( 5 ) . SetCellValue ( "日期\r\nDATE" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 33 , rowIndex + 33 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 33 , rowIndex + 33 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 33 , rowIndex + 33 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 33 , rowIndex + 33 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 33 , rowIndex + 33 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 33 , rowIndex + 33 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 33 , rowIndex + 33 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 33 , rowIndex + 33 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 34 , rowIndex + 34 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 34 , rowIndex + 34 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 34 , rowIndex + 34 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 34 , rowIndex + 34 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 34 , rowIndex + 34 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 34 , rowIndex + 34 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 34 , rowIndex + 34 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 34 , rowIndex + 34 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 35 , rowIndex + 35 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 35 , rowIndex + 35 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 35 , rowIndex + 35 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 35 , rowIndex + 35 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 35 , rowIndex + 35 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 35 , rowIndex + 35 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 35 , rowIndex + 35 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 35 , rowIndex + 35 , 15 , 16 ) , ws ) ;
#endregion
#region 第 五 层 签 名
ws . GetRow ( rowIndex + 39 ) . GetCell ( 5 ) . SetCellValue ( "姓名\r\nNAME" ) ;
ws . GetRow ( rowIndex + 40 ) . GetCell ( 5 ) . SetCellValue ( "签名\r\nSIGNATURE" ) ;
ws . GetRow ( rowIndex + 41 ) . GetCell ( 5 ) . SetCellValue ( "日期\r\nDATE" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 39 , rowIndex + 39 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 39 , rowIndex + 39 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 39 , rowIndex + 39 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 39 , rowIndex + 39 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 39 , rowIndex + 39 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 39 , rowIndex + 39 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 39 , rowIndex + 39 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 39 , rowIndex + 39 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 40 , rowIndex + 40 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 40 , rowIndex + 40 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 40 , rowIndex + 40 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 40 , rowIndex + 40 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 40 , rowIndex + 40 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 40 , rowIndex + 40 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 40 , rowIndex + 40 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 40 , rowIndex + 40 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 41 , rowIndex + 41 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 41 , rowIndex + 41 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 41 , rowIndex + 41 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 41 , rowIndex + 41 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 41 , rowIndex + 41 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 41 , rowIndex + 41 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 41 , rowIndex + 41 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 41 , rowIndex + 41 , 15 , 16 ) , ws ) ;
#endregion
#region 第 六 层 签 名
ws . GetRow ( rowIndex + 45 ) . GetCell ( 5 ) . SetCellValue ( "姓名\r\nNAME" ) ;
ws . GetRow ( rowIndex + 46 ) . GetCell ( 5 ) . SetCellValue ( "签名\r\nSIGNATURE" ) ;
ws . GetRow ( rowIndex + 47 ) . GetCell ( 5 ) . SetCellValue ( "日期\r\nDATE" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 45 , rowIndex + 45 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 45 , rowIndex + 45 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 45 , rowIndex + 45 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 45 , rowIndex + 45 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 45 , rowIndex + 45 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 45 , rowIndex + 45 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 45 , rowIndex + 45 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 45 , rowIndex + 45 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 46 , rowIndex + 46 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 46 , rowIndex + 46 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 46 , rowIndex + 46 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 46 , rowIndex + 46 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 46 , rowIndex + 46 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 46 , rowIndex + 46 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 46 , rowIndex + 46 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 46 , rowIndex + 46 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 47 , rowIndex + 47 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 47 , rowIndex + 47 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 47 , rowIndex + 47 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 47 , rowIndex + 47 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 47 , rowIndex + 47 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 47 , rowIndex + 47 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 47 , rowIndex + 47 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 47 , rowIndex + 47 , 15 , 16 ) , ws ) ;
#endregion
#region 第 七 层 签 名
ws . GetRow ( rowIndex + 51 ) . GetCell ( 5 ) . SetCellValue ( "姓名\r\nNAME" ) ;
ws . GetRow ( rowIndex + 52 ) . GetCell ( 5 ) . SetCellValue ( "签名\r\nSIGNATURE" ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 5 ) . SetCellValue ( "日期\r\nDATE" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 51 , rowIndex + 51 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 51 , rowIndex + 51 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 51 , rowIndex + 51 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 51 , rowIndex + 51 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 51 , rowIndex + 51 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 51 , rowIndex + 51 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 51 , rowIndex + 51 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 51 , rowIndex + 51 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 52 , rowIndex + 52 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 52 , rowIndex + 52 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 52 , rowIndex + 52 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 52 , rowIndex + 52 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 52 , rowIndex + 52 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 52 , rowIndex + 52 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 52 , rowIndex + 52 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 52 , rowIndex + 52 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 15 , 16 ) , ws ) ;
#endregion
#region 第 八 层 签 名
ws . GetRow ( rowIndex + 57 ) . GetCell ( 5 ) . SetCellValue ( "姓名\r\nNAME" ) ;
ws . GetRow ( rowIndex + 58 ) . GetCell ( 5 ) . SetCellValue ( "签名\r\nSIGNATURE" ) ;
ws . GetRow ( rowIndex + 59 ) . GetCell ( 5 ) . SetCellValue ( "日期\r\nDATE" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 57 , rowIndex + 57 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 57 , rowIndex + 57 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 57 , rowIndex + 57 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 57 , rowIndex + 57 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 57 , rowIndex + 57 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 57 , rowIndex + 57 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 57 , rowIndex + 57 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 57 , rowIndex + 57 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 58 , rowIndex + 58 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 58 , rowIndex + 58 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 58 , rowIndex + 58 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 58 , rowIndex + 58 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 58 , rowIndex + 58 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 58 , rowIndex + 58 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 58 , rowIndex + 58 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 58 , rowIndex + 58 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 59 , rowIndex + 59 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 59 , rowIndex + 59 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 59 , rowIndex + 59 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 59 , rowIndex + 59 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 59 , rowIndex + 59 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 59 , rowIndex + 59 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 59 , rowIndex + 59 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 59 , rowIndex + 59 , 15 , 16 ) , ws ) ;
#endregion
#region 第 九 层 签 名
ws . GetRow ( rowIndex + 63 ) . GetCell ( 5 ) . SetCellValue ( "姓名\r\nNAME" ) ;
ws . GetRow ( rowIndex + 64 ) . GetCell ( 5 ) . SetCellValue ( "签名\r\nSIGNATURE" ) ;
ws . GetRow ( rowIndex + 65 ) . GetCell ( 5 ) . SetCellValue ( "日期\r\nDATE" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 63 , rowIndex + 63 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 63 , rowIndex + 63 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 63 , rowIndex + 63 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 63 , rowIndex + 63 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 63 , rowIndex + 63 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 63 , rowIndex + 63 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 63 , rowIndex + 63 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 63 , rowIndex + 63 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 64 , rowIndex + 64 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 64 , rowIndex + 64 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 64 , rowIndex + 64 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 64 , rowIndex + 64 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 64 , rowIndex + 64 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 64 , rowIndex + 64 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 64 , rowIndex + 64 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 64 , rowIndex + 64 , 15 , 16 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 65 , rowIndex + 65 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 65 , rowIndex + 65 , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 65 , rowIndex + 65 , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 65 , rowIndex + 65 , 15 , 16 ) ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 65 , rowIndex + 65 , 6 , 7 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 65 , rowIndex + 65 , 9 , 10 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 65 , rowIndex + 65 , 12 , 13 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 65 , rowIndex + 65 , 15 , 16 ) , ws ) ;
#endregion
#endregion
#region 边 框 设 置
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 1 , 1 , 1 , 17 ) , ws ) ;
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 65 , 65 , 1 , 17 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 65 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 65 , 17 , 17 ) , ws ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//6-TP-05-P&ID清单UG-FW-001 模版
private void template6 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
//插入图片部分
var img1 = Server . MapPath ( "~/res/images/bsf/1.png" ) ;
var img2 = Server . MapPath ( "~/res/images/bsf/2.png" ) ;
var img3 = Server . MapPath ( "~/res/images/bsf/3.png" ) ;
var img4 = Server . MapPath ( "~/res/images/bsf/4.png" ) ;
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 14 , style , 0 , 17 , true ) ;
ws . GetRow ( rowIndex ) . GetCell ( 15 ) . SetCellValue ( "Form No." ) ;
ws . GetRow ( rowIndex ) . GetCell ( 16 ) . SetCellValue ( "TP-06" ) ;
//设置列宽度
ws . SetColumnWidth ( 0 , 3 * 256 ) ;
ws . SetColumnWidth ( 1 , 3 * 256 ) ;
ws . SetColumnWidth ( 2 , 8 * 256 ) ;
ws . SetColumnWidth ( 3 , 5 * 256 ) ;
ws . SetColumnWidth ( 4 , 5 * 256 ) ;
ws . SetColumnWidth ( 5 , 8 * 256 ) ;
ws . SetColumnWidth ( 6 , 8 * 256 ) ;
ws . SetColumnWidth ( 7 , 4 * 256 ) ;
ws . SetColumnWidth ( 8 , 8 * 256 ) ;
ws . SetColumnWidth ( 9 , 8 * 256 ) ;
ws . SetColumnWidth ( 10 , 8 * 256 ) ;
ws . SetColumnWidth ( 11 , 8 * 256 ) ;
ws . SetColumnWidth ( 12 , 1 * 256 ) ;
ws . SetColumnWidth ( 13 , 9 * 256 ) ;
ws . SetColumnWidth ( 14 , 9 * 256 ) ;
ws . SetColumnWidth ( 15 , 10 * 256 ) ;
ws . SetColumnWidth ( 16 , 6 * 256 ) ;
ws . SetColumnWidth ( 17 , 6 * 256 ) ;
//设置前3行高度
ws . GetRow ( 0 ) . Height = 15 * 20 ;
ws . GetRow ( 1 ) . Height = 15 * 20 ;
ws . GetRow ( 2 ) . Height = 14 * 20 ;
//设置3-15行的行高度
for ( int i = 3 ; i < 15 ; i + + )
{
ws . GetRow ( i ) . Height = 18 * 20 ;
}
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 0 , 0 , 1 , 1 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 1 , 1 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 16 , 16 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 2 , 2 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 1 , 14 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 1 , 1 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 16 , 16 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderLeft ( 2 , new CellRangeAddress ( 9 , 14 , 2 , 2 ) , ws ) ;
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 7 , 7 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 8 , 8 , 2 , 16 ) , ws ) ;
//插入图片
InsertImage ( hssfworkbook , ws , 3 , 2 , 4 , 3 , img1 , 1.2 , 1.8 ) ;
InsertImage ( hssfworkbook , ws , 3 , 3 , 4 , 4 , img2 , 1.9 , 1.9 ) ;
InsertImage ( hssfworkbook , ws , 3 , 13 , 4 , 14 , img3 , 1.5 , 1.5 ) ;
InsertImage ( hssfworkbook , ws , 3 , 15 , 4 , 16 , img4 , 1.5 , 1.5 ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "巴斯夫(广东)一体化项目" ) ;
var setStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "BASF (GUANGDONG) INTEGRATED PROJECT" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . SetCellValue ( "试压包流程图清单" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . SetCellValue ( "TEST PACKAGE P&ID DRAWING LIST" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . CellStyle = setStyle ;
var cellStyle2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , false , false , "Arial Unicode MS" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . SetCellValue ( "Test Package No" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 5 ) . SetCellValue ( "UG-130-FW-HT-001" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 5 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . SetCellValue ( "Area" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 13 ) . SetCellValue ( "C400" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 2 ) . SetCellValue ( "试压包号" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 9 ) . SetCellValue ( "区域" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 2 ) . SetCellValue ( "System No" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 5 ) . SetCellValue ( "FIRE WATER" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 5 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 9 ) . SetCellValue ( "Test Pressure" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 13 ) . SetCellValue ( "2" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 13 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . SetCellValue ( "系统号" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . SetCellValue ( "试验压力" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 9 ) . SetCellValue ( "Test Type" ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 13 ) . SetCellValue ( "Hydro Test" ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 13 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 9 ) . SetCellValue ( "试验方式" ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
#endregion
#region 表 格 部 分
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , 15 , rowIndex + 49 , style , 0 , 17 , true ) ;
for ( int i = 15 ; i < 50 ; i + + )
{
ws . GetRow ( i ) . Height = 20 * 20 ;
ws . GetRow ( i ) . GetCell ( 0 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None ) ;
ws . GetRow ( i ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 9 , 13 ) ) ;
}
ws . GetRow ( 15 ) . Height = 40 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 5 , 13 ) ) ;
//数据表头部分
ws . GetRow ( rowIndex + 15 ) . GetCell ( 2 ) . SetCellValue ( "No\r\n序号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 3 ) . SetCellValue ( "P&ID Drawing No.\r\n流程图号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 9 ) . SetCellValue ( "Drawing Description\r\n图纸名称" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 14 ) . SetCellValue ( "Rev\r\n版本" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 15 ) . SetCellValue ( "Sheet No.\r\n页码" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 16 ) . SetCellValue ( "Remark\r\n备注" ) ;
#endregion
#region 尾 部
//此处的尾部行数需要根据 得到的动态数据量 来计算, 默认写死从50行开始。
ws = ExcelCreateRow ( ws , hssfworkbook , 49 , rowIndex + 55 , style , 0 , 17 , true ) ;
for ( int i = 49 ; i < = 55 ; i + + )
{
ws . GetRow ( i ) . Height = 18 * 20 ;
ws . GetRow ( i ) . GetCell ( 0 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
}
for ( int i = 2 ; i < 17 ; i + + )
{
ws . GetRow ( rowIndex + 55 ) . GetCell ( i ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None , BorderStyle . None ) ;
}
ws . GetRow ( rowIndex + 55 ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None ) ;
ws . GetRow ( rowIndex + 55 ) . GetCell ( 16 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None , BorderStyle . None ) ;
ws . GetRow ( rowIndex + 55 ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . Medium , BorderStyle . None , BorderStyle . Medium ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 2 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 5 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 7 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 10 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 14 , 16 ) ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 2 , 4 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 2 ) . SetCellValue ( "PREPARED" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 5 ) . SetCellValue ( "REVIEW" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 7 , 9 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 7 ) . SetCellValue ( "JIANLI" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 10 , 13 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 10 ) . SetCellValue ( "Worley" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 14 , 16 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 14 ) . SetCellValue ( "BASF" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 54 , rowIndex + 54 , 2 , 6 ) ) ;
ws . GetRow ( rowIndex + 54 ) . GetCell ( 2 ) . SetCellValue ( "CC7" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//8-TP-06-单线图清单UG-FW-001 模版
private void template8 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
//插入图片部分
var img1 = Server . MapPath ( "~/res/images/bsf/1.png" ) ;
var img2 = Server . MapPath ( "~/res/images/bsf/2.png" ) ;
var img3 = Server . MapPath ( "~/res/images/bsf/3.png" ) ;
var img4 = Server . MapPath ( "~/res/images/bsf/4.png" ) ;
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 14 , style , 0 , 17 , true ) ;
ws . GetRow ( rowIndex ) . GetCell ( 15 ) . SetCellValue ( "Form No." ) ;
ws . GetRow ( rowIndex ) . GetCell ( 16 ) . SetCellValue ( "TP-06" ) ;
//设置列宽度
ws . SetColumnWidth ( 0 , 3 * 256 ) ;
ws . SetColumnWidth ( 1 , 3 * 256 ) ;
ws . SetColumnWidth ( 2 , 8 * 256 ) ;
ws . SetColumnWidth ( 3 , 5 * 256 ) ;
ws . SetColumnWidth ( 4 , 5 * 256 ) ;
ws . SetColumnWidth ( 5 , 8 * 256 ) ;
ws . SetColumnWidth ( 6 , 8 * 256 ) ;
ws . SetColumnWidth ( 7 , 4 * 256 ) ;
ws . SetColumnWidth ( 8 , 8 * 256 ) ;
ws . SetColumnWidth ( 9 , 8 * 256 ) ;
ws . SetColumnWidth ( 10 , 8 * 256 ) ;
ws . SetColumnWidth ( 11 , 8 * 256 ) ;
ws . SetColumnWidth ( 12 , 1 * 256 ) ;
ws . SetColumnWidth ( 13 , 9 * 256 ) ;
ws . SetColumnWidth ( 14 , 9 * 256 ) ;
ws . SetColumnWidth ( 15 , 10 * 256 ) ;
ws . SetColumnWidth ( 16 , 6 * 256 ) ;
ws . SetColumnWidth ( 17 , 6 * 256 ) ;
//设置前3行高度
ws . GetRow ( 0 ) . Height = 15 * 20 ;
ws . GetRow ( 1 ) . Height = 15 * 20 ;
ws . GetRow ( 2 ) . Height = 14 * 20 ;
//设置3-15行的行高度
for ( int i = 3 ; i < 15 ; i + + )
{
ws . GetRow ( i ) . Height = 18 * 20 ;
}
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 0 , 0 , 1 , 1 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 1 , 1 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 16 , 16 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 2 , 2 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 1 , 14 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 1 , 1 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 16 , 16 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderLeft ( 2 , new CellRangeAddress ( 9 , 14 , 2 , 2 ) , ws ) ;
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 7 , 7 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 8 , 8 , 2 , 16 ) , ws ) ;
//插入图片
InsertImage ( hssfworkbook , ws , 3 , 2 , 4 , 3 , img1 , 1.2 , 1.8 ) ;
InsertImage ( hssfworkbook , ws , 3 , 3 , 4 , 4 , img2 , 1.9 , 1.9 ) ;
InsertImage ( hssfworkbook , ws , 3 , 13 , 4 , 14 , img3 , 1.5 , 1.5 ) ;
InsertImage ( hssfworkbook , ws , 3 , 15 , 4 , 16 , img4 , 1.5 , 1.5 ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "巴斯夫(广东)一体化项目" ) ;
var setStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "BASF (GUANGDONG) INTEGRATED PROJECT" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . SetCellValue ( "试压包单线图清单" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . SetCellValue ( "TEST PACKAGE ISOMETRIC LIST" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . CellStyle = setStyle ;
var cellStyle2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , false , false , "Arial Unicode MS" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . SetCellValue ( "Test Package No" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 5 ) . SetCellValue ( "UG-130-FW-HT-001" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 5 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . SetCellValue ( "Area" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 13 ) . SetCellValue ( "C400" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 2 ) . SetCellValue ( "试压包号" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 9 ) . SetCellValue ( "区域" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 2 ) . SetCellValue ( "System No" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 5 ) . SetCellValue ( "FIRE WATER" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 5 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 9 ) . SetCellValue ( "Test Pressure" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 13 ) . SetCellValue ( "2" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 13 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . SetCellValue ( "系统号" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . SetCellValue ( "试验压力" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 9 ) . SetCellValue ( "Test Type" ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 13 ) . SetCellValue ( "Hydro Test" ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 13 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 9 ) . SetCellValue ( "试验方式" ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
#endregion
#region 表 格 部 分
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , 15 , rowIndex + 49 , style , 0 , 17 , true ) ;
for ( int i = 15 ; i < 50 ; i + + )
{
ws . GetRow ( i ) . Height = 22 * 20 ;
ws . GetRow ( i ) . GetCell ( 0 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None ) ;
ws . GetRow ( i ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 9 , 13 ) ) ;
}
ws . GetRow ( 15 ) . Height = 30 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 5 , 13 ) ) ;
//数据表头部分
ws . GetRow ( rowIndex + 15 ) . GetCell ( 2 ) . SetCellValue ( "No\r\n序号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 3 ) . SetCellValue ( "Isometric Drawing No.\r\n单线图号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 9 ) . SetCellValue ( "Line Number No\r\n 管线号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 14 ) . SetCellValue ( "Rev\r\n版本" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 15 ) . SetCellValue ( "Sheet No.\r\n页码" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 16 ) . SetCellValue ( "Remark\r\n备注" ) ;
#endregion
#region 尾 部
//此处的尾部行数需要根据 得到的动态数据量 来计算, 默认写死从50行开始。
ws = ExcelCreateRow ( ws , hssfworkbook , 49 , rowIndex + 55 , style , 0 , 17 , true ) ;
for ( int i = 49 ; i < = 55 ; i + + )
{
ws . GetRow ( i ) . Height = 18 * 20 ;
ws . GetRow ( i ) . GetCell ( 0 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
}
for ( int i = 2 ; i < 17 ; i + + )
{
ws . GetRow ( rowIndex + 55 ) . GetCell ( i ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None , BorderStyle . None ) ;
}
ws . GetRow ( rowIndex + 55 ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None ) ;
ws . GetRow ( rowIndex + 55 ) . GetCell ( 16 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None , BorderStyle . None ) ;
ws . GetRow ( rowIndex + 55 ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . Medium , BorderStyle . None , BorderStyle . Medium ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 2 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 5 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 7 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 10 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 14 , 16 ) ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 2 , 4 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 2 ) . SetCellValue ( "PREPARED" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 5 ) . SetCellValue ( "REVIEW" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 7 , 9 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 7 ) . SetCellValue ( "JIANLI" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 10 , 13 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 10 ) . SetCellValue ( "Worley" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 14 , 16 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 14 ) . SetCellValue ( "BASF" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 54 , rowIndex + 54 , 2 , 6 ) ) ;
ws . GetRow ( rowIndex + 54 ) . GetCell ( 2 ) . SetCellValue ( "CC7" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//11-TP-07-盲板清单UG-FW-001
private void template11 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
//插入图片部分
var img1 = Server . MapPath ( "~/res/images/bsf/1.png" ) ;
var img2 = Server . MapPath ( "~/res/images/bsf/2.png" ) ;
var img3 = Server . MapPath ( "~/res/images/bsf/3.png" ) ;
var img4 = Server . MapPath ( "~/res/images/bsf/4.png" ) ;
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 14 , style , 0 , 17 , true ) ;
ws . GetRow ( rowIndex ) . GetCell ( 15 ) . SetCellValue ( "Form No." ) ;
ws . GetRow ( rowIndex ) . GetCell ( 16 ) . SetCellValue ( "TP-06" ) ;
//设置列宽度
ws . SetColumnWidth ( 0 , 2 * 256 ) ;
ws . SetColumnWidth ( 1 , 1 * 256 ) ;
ws . SetColumnWidth ( 2 , 8 * 256 ) ;
ws . SetColumnWidth ( 3 , 5 * 256 ) ;
ws . SetColumnWidth ( 4 , 5 * 256 ) ;
ws . SetColumnWidth ( 5 , 8 * 256 ) ;
ws . SetColumnWidth ( 6 , 8 * 256 ) ;
ws . SetColumnWidth ( 7 , 10 * 256 ) ;
ws . SetColumnWidth ( 8 , 10 * 256 ) ;
ws . SetColumnWidth ( 9 , 11 * 256 ) ;
ws . SetColumnWidth ( 10 , 9 * 256 ) ;
ws . SetColumnWidth ( 11 , 8 * 256 ) ;
ws . SetColumnWidth ( 12 , 1 * 256 ) ;
ws . SetColumnWidth ( 13 , 9 * 256 ) ;
ws . SetColumnWidth ( 14 , 9 * 256 ) ;
ws . SetColumnWidth ( 15 , 9 * 256 ) ;
ws . SetColumnWidth ( 16 , 8 * 256 ) ;
ws . SetColumnWidth ( 17 , 1 * 256 ) ;
//设置前3行高度
ws . GetRow ( 0 ) . Height = 15 * 20 ;
ws . GetRow ( 1 ) . Height = 15 * 20 ;
ws . GetRow ( 2 ) . Height = 14 * 20 ;
//设置3-15行的行高度
for ( int i = 3 ; i < 15 ; i + + )
{
ws . GetRow ( i ) . Height = 18 * 20 ;
}
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 0 , 0 , 1 , 1 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 1 , 1 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 16 , 16 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 2 , 2 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 1 , 14 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 1 , 1 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 16 , 16 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderLeft ( 2 , new CellRangeAddress ( 9 , 14 , 2 , 2 ) , ws ) ;
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 7 , 7 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 8 , 8 , 2 , 16 ) , ws ) ;
//插入图片
InsertImage ( hssfworkbook , ws , 3 , 2 , 4 , 3 , img1 , 1.2 , 1.8 ) ;
InsertImage ( hssfworkbook , ws , 3 , 3 , 4 , 4 , img2 , 1.9 , 1.9 ) ;
InsertImage ( hssfworkbook , ws , 3 , 13 , 4 , 14 , img3 , 1.5 , 1.5 ) ;
InsertImage ( hssfworkbook , ws , 3 , 15 , 4 , 16 , img4 , 1.5 , 1.5 ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "巴斯夫(广东)一体化项目" ) ;
var setStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "BASF (GUANGDONG) INTEGRATED PROJECT" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . SetCellValue ( "试压包盲板清单" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . SetCellValue ( "TEST PACKAGE BLIND LIST" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . CellStyle = setStyle ;
var cellStyle2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , false , false , "Arial Unicode MS" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . SetCellValue ( "Test Package No" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 5 ) . SetCellValue ( "UG-130-FW-HT-001" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 5 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . SetCellValue ( "Area" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 13 ) . SetCellValue ( "C400" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 2 ) . SetCellValue ( "试压包号" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 9 ) . SetCellValue ( "区域" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 2 ) . SetCellValue ( "System No" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 5 ) . SetCellValue ( "FIRE WATER" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 5 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 9 ) . SetCellValue ( "Test Pressure" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 13 ) . SetCellValue ( "2" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 13 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . SetCellValue ( "系统号" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . SetCellValue ( "试验压力" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 9 ) . SetCellValue ( "Test Type" ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 13 ) . SetCellValue ( "Hydro Test" ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 13 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 9 ) . SetCellValue ( "试验方式" ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 5 , 13 ) ) ;
#endregion
#region 表 格 部 分
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , 15 , rowIndex + 49 , style , 0 , 17 , true ) ;
for ( int i = 15 ; i < 50 ; i + + )
{
ws . GetRow ( i ) . Height = 22 * 20 ;
ws . GetRow ( i ) . GetCell ( 0 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None ) ;
ws . GetRow ( i ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 11 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 14 , 15 ) ) ;
}
ws . GetRow ( 15 ) . Height = 40 * 20 ;
//数据表头部分
ws . GetRow ( rowIndex + 15 ) . GetCell ( 2 ) . SetCellValue ( "No\r\n序号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 3 ) . SetCellValue ( "Isometric Drawing No.\r\n单线图号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 7 ) . SetCellValue ( "Blind No.\r\n盲板编号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 8 ) . SetCellValue ( "Inch\r\n尺寸" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 9 ) . SetCellValue ( "Thick(mm)\r\n厚度" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 10 ) . SetCellValue ( "Material\r\n材质" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 11 ) . SetCellValue ( "Installed Date\r\n安装日期" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 14 ) . SetCellValue ( "Removed Date\r\n拆除日期" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 16 ) . SetCellValue ( "Remark\r\n备注" ) ;
#endregion
#region 尾 部
//此处的尾部行数需要根据 得到的动态数据量 来计算, 默认写死从50行开始。
ws = ExcelCreateRow ( ws , hssfworkbook , 49 , rowIndex + 55 , style , 0 , 17 , true ) ;
for ( int i = 49 ; i < = 55 ; i + + )
{
ws . GetRow ( i ) . Height = 18 * 20 ;
ws . GetRow ( i ) . GetCell ( 0 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
}
for ( int i = 2 ; i < 17 ; i + + )
{
ws . GetRow ( rowIndex + 55 ) . GetCell ( i ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None , BorderStyle . None ) ;
}
ws . GetRow ( rowIndex + 55 ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None ) ;
ws . GetRow ( rowIndex + 55 ) . GetCell ( 16 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None , BorderStyle . None ) ;
ws . GetRow ( rowIndex + 55 ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . Medium , BorderStyle . None , BorderStyle . Medium ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 2 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 5 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 7 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 10 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 14 , 16 ) ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 2 , 4 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 2 ) . SetCellValue ( "PREPARED" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 5 ) . SetCellValue ( "REVIEW" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 7 , 9 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 7 ) . SetCellValue ( "JIANLI" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 10 , 13 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 10 ) . SetCellValue ( "Worley" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 14 , 16 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 14 ) . SetCellValue ( "BASF" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 54 , rowIndex + 54 , 2 , 6 ) ) ;
ws . GetRow ( rowIndex + 54 ) . GetCell ( 2 ) . SetCellValue ( "CC7" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//13-弹簧支吊架安装检验记录SHT 3503-J403
private void template13 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 1 , rowIndex + 1 , style , 1 , 7 , true ) ;
ws . SetColumnWidth ( 0 , 2 * 256 ) ;
for ( int i = 1 ; i < 8 ; i + + )
{
ws . SetColumnWidth ( i , 16 * 256 ) ;
}
ws . GetRow ( rowIndex + 1 ) . Height = 20 * 20 * 6 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 1 , 2 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 1 ) . SetCellValue ( "SH/T 3503—J403" ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
style1 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 3 , 5 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . SetCellValue ( "弹簧支/吊架安装检验记录\nSpring Support/Hanger Installation Inspection Record" ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , false , false , "Arial Unicode MS" ) ;
style2 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 6 , 7 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 6 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 6 ) . SetCellValue ( " 工程名称:\n Project Name:\n\n\n 单位工程名称:\n Unit Name:" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 2 , rowIndex + 18 , style , 1 , 7 , true ) ;
for ( int i = 2 ; i < 19 ; i + + )
{
if ( i = = 2 )
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 * 4 ;
else
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 * 2 ;
}
ws . GetRow ( rowIndex + 2 ) . GetCell ( 1 ) . SetCellValue ( "管道编号/单线号\nPiping No./Line No." ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 2 ) . SetCellValue ( "支/吊架位号\nSupport/Hanger Item No." ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 3 ) . SetCellValue ( "结构型式\nType" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 4 ) . SetCellValue ( "位移方向\nDisplacement Direction" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 5 ) . SetCellValue ( "设计冷态负荷值\nDesign Cold Load" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 6 ) . SetCellValue ( "安装冷态负荷值\nInstallation Cold Load" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 7 ) . SetCellValue ( "检查结果\nInspection Result" ) ;
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 19 , rowIndex + 21 , style , 1 , 7 , true ) ;
ws . GetRow ( rowIndex + 19 ) . Height = 20 * 20 * 2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 19 , rowIndex + 19 , 1 , 7 ) ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 1 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 1 ) . SetCellValue ( " 备注:\n Remarks:" ) ;
ws . GetRow ( rowIndex + 20 ) . Height = 20 * 20 * 2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 20 , rowIndex + 20 , 1 , 2 ) ) ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 1 ) . SetCellValue ( "建设/监理单位\nOwner/JianLi Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 20 , rowIndex + 20 , 3 , 5 ) ) ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 3 ) . SetCellValue ( "总 承 包 单 位\nGeneral Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 20 , rowIndex + 20 , 6 , 7 ) ) ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 6 ) . SetCellValue ( "施 工 单 位\nConstruction Contractor" ) ;
ws . GetRow ( rowIndex + 21 ) . Height = 20 * 20 * 6 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 1 , 2 ) ) ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 1 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 1 ) . SetCellValue ( " 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 3 , 5 ) ) ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 3 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 3 ) . SetCellValue ( " 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 6 , 7 ) ) ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 6 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 6 ) . SetCellValue ( " 施工班组长:\n Foreman:\n 质量检查员:\n Quality Inspector:\n 专业工程师:\n Discipline Engineer: \n 日期(DATE): 年 月 日" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//14-滑动固定管托安装检验记录SHT 3503-J404
private void template14 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 1 , rowIndex + 1 , style , 1 , 7 , true ) ;
ws . SetColumnWidth ( 0 , 2 * 256 ) ;
for ( int i = 1 ; i < 8 ; i + + )
{
ws . SetColumnWidth ( i , 16 * 256 ) ;
}
ws . GetRow ( rowIndex + 1 ) . Height = 20 * 20 * 5 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 1 , 2 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 1 ) . SetCellValue ( "SH/T 3503—J404" ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
style1 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 3 , 5 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . SetCellValue ( "滑动/固定管托安装检验记录\nSliding/Fixed Pipe Shoe Installation Inspection Record" ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , false , false , "Arial Unicode MS" ) ;
style2 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 6 , 7 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 6 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 6 ) . SetCellValue ( " 工程名称:\n Project Name:\n\n\n 单位工程名称:\n Unit Name:" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 2 , rowIndex + 14 , style , 1 , 7 , true ) ;
for ( int i = 2 ; i < 15 ; i + + )
{
if ( i = = 2 )
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 * 3 ;
else
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 * 2 ;
}
ws . GetRow ( rowIndex + 2 ) . GetCell ( 1 ) . SetCellValue ( "管道编号/单线号\nPiping No./ Line" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 2 ) . SetCellValue ( "管托编号\nPipe Shoe No." ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 3 ) . SetCellValue ( "型 式\nType" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 4 ) . SetCellValue ( "位移方向\nDisplacement Direction" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 5 ) . SetCellValue ( "设计位移量\nDesign Displacement" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 6 ) . SetCellValue ( "安装位移量\nInstallation Displacement" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 7 ) . SetCellValue ( "检验结果\nInspection Result" ) ;
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 15 , rowIndex + 18 , style , 1 , 7 , true ) ;
ws . GetRow ( rowIndex + 15 ) . Height = 20 * 20 * 3 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 1 , 7 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 1 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 1 ) . SetCellValue ( " 注:本表用于设计温度>350℃管道和低于-29℃管道中, 管托有位移要求的滑动和固定管托的安装检验。\nNote: This form is applicable to the installation inspection on sliding/fixed pipe shoes with displacement requirement used in piping at a design temperature above 350℃and in piping at a design temperature below -29℃." ) ;
ws . GetRow ( rowIndex + 16 ) . Height = 20 * 20 * 3 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 1 , 7 ) ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 1 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 1 ) . SetCellValue ( " 备注:\n Remarks:" ) ;
ws . GetRow ( rowIndex + 17 ) . Height = 20 * 20 * 3 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 1 , 2 ) ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 1 ) . SetCellValue ( "建设/监理单位\nOwner/JianLi Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 3 , 5 ) ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 3 ) . SetCellValue ( "总 承 包 单 位\nGeneral Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 6 , 7 ) ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 6 ) . SetCellValue ( "施 工 单 位\nConstruction Contractor" ) ;
ws . GetRow ( rowIndex + 18 ) . Height = 20 * 20 * 6 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 1 , 2 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 1 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 1 ) . SetCellValue ( " 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 3 , 5 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 3 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 3 ) . SetCellValue ( " 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 6 , 7 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 6 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 6 ) . SetCellValue ( " 施工班组长:\n Foreman:\n 质量检查员:\n Quality Inspector:\n 专业工程师:\n Discipline Engineer: \n 日期(DATE): 年 月 日" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//15-管道补偿器安装检验记录SHT 3503-J405
private void template15 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
#region 头 部
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false , "宋体" ) ;
int rowIndex = 0 ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 3 , style , 0 , 12 , true ) ;
//设置列宽
ws . SetColumnWidth ( 0 , 17 * 256 ) ;
ws . SetColumnWidth ( 1 , 12 * 256 ) ;
ws . SetColumnWidth ( 2 , 10 * 256 ) ;
ws . SetColumnWidth ( 3 , 17 * 256 ) ;
ws . SetColumnWidth ( 4 , 14 * 256 ) ;
ws . SetColumnWidth ( 5 , 12 * 256 ) ;
ws . SetColumnWidth ( 6 , 15 * 256 ) ;
ws . SetColumnWidth ( 7 , 12 * 256 ) ;
ws . SetColumnWidth ( 8 , 13 * 256 ) ;
ws . SetColumnWidth ( 9 , 12 * 256 ) ;
ws . SetColumnWidth ( 10 , 12 * 256 ) ;
ws . SetColumnWidth ( 11 , 12 * 256 ) ;
ws . SetColumnWidth ( 12 , 12 * 256 ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 3 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 0 ) . SetCellValue ( "SH/T 3503-J405" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 3 , 2 , 9 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 2 ) . SetCellValue ( "管道补偿器安装检验记录\r\nPipe Compensator Installation Inspection Record" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 0 , 10 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 1 , 1 , 10 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 2 , 2 , 10 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 3 , 3 , 10 , 12 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 10 ) . SetCellValue ( "工程名称:巴斯夫(广东)一体化项目专用化学品二区" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 10 ) . SetCellValue ( "Project Name:BASF (Guangdong) Integrated Project" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 10 ) . SetCellValue ( "单位工程名称:埋地消防系统" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 10 ) . SetCellValue ( "Unit Name: FW" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 4 , rowIndex + 5 , style , 0 , 12 , true ) ;
ws . GetRow ( rowIndex + 4 ) . Height = 30 * 20 ;
ws . GetRow ( rowIndex + 5 ) . Height = 45 * 20 ;
//设置表头部分
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 0 , 0 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . SetCellValue ( "管道编号/单线号\r\nPiping No./Line No" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 1 , 2 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( "补偿器编号\r\nCompensator No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 3 , 3 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 3 ) . SetCellValue ( "型式\r\nType" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 4 , 4 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 4 ) . SetCellValue ( "规格\r\nSpecification" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 5 , 5 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "材质\r\nMaterial" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 6 , 6 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 6 ) . SetCellValue ( "固定支架间距\r\nFixed Support SoacingM" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 7 , 7 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 7 ) . SetCellValue ( "设计压力\r\nDesign Pressure" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 8 , 8 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 8 ) . SetCellValue ( "设计温度\r\nDesign Temperature\r\n℃" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 4 , 9 , 11 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 9 ) . SetCellValue ( "轴/角向预变形量\r\nAxial/Angular Predeformation" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 9 ) . SetCellValue ( "单位\r\nUnit" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 10 ) . SetCellValue ( "设计值\r\nDesign Value" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 11 ) . SetCellValue ( "实测值\r\nActual Value" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 12 , 12 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 12 ) . SetCellValue ( "检验结果\r\nInspection Result" ) ;
//这里创建行数据
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 6 , rowIndex + 23 , style , 0 , 12 , true ) ;
for ( int i = 6 ; i < 24 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 ;
}
#endregion
#region 尾 部
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , true , false ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 24 , rowIndex + 30 , style , 0 , 12 , true ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 0 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 4 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 0 ) . SetCellValue ( "建设/监理单位\r\nOwner/Supervision Contractor" ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 4 ) . SetCellValue ( "总承包单位\r\nGeneral Contractor" ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 9 ) . SetCellValue ( "施工单位\r\nConstruction Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 0 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . GetRow ( rowIndex + 25 ) . Height = 31 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 9 ) . SetCellValue ( "记录人 : \r\nRecord Prepared by:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 9 ) . SetCellValue ( "质量检查员:\r\nQuality Inspector:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 29 , rowIndex + 29 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 9 ) . SetCellValue ( "焊接责任工程师:\r\nWelding Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 30 ) . GetCell ( 0 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 4 , 8 ) ) ;
ws . GetRow ( rowIndex + 30 ) . GetCell ( 4 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 30 ) . GetCell ( 9 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
RegionUtil . SetBorderTop ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 0 , 12 ) , ws ) ;
RegionUtil . SetBorderLeft ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 12 , 12 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 0 , 12 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 3 , 3 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 8 , 8 ) , ws ) ;
ws . GetRow ( rowIndex + 26 ) . Height = ws . GetRow ( rowIndex + 28 ) . Height = ws . GetRow ( rowIndex + 29 ) . Height = 7 * 20 ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//16-TP-08-静电接地清单UG-FW-001
private void template16 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
//插入图片部分
var img1 = Server . MapPath ( "~/res/images/bsf/1.png" ) ;
var img2 = Server . MapPath ( "~/res/images/bsf/2.png" ) ;
var img3 = Server . MapPath ( "~/res/images/bsf/3.png" ) ;
var img4 = Server . MapPath ( "~/res/images/bsf/4.png" ) ;
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 14 , style , 0 , 17 , true ) ;
ws . GetRow ( rowIndex ) . GetCell ( 15 ) . SetCellValue ( "Form No." ) ;
ws . GetRow ( rowIndex ) . GetCell ( 16 ) . SetCellValue ( "TP-06" ) ;
//设置列宽度
ws . SetColumnWidth ( 0 , 2 * 256 ) ;
ws . SetColumnWidth ( 1 , 1 * 256 ) ;
ws . SetColumnWidth ( 2 , 8 * 256 ) ;
ws . SetColumnWidth ( 3 , 5 * 256 ) ;
ws . SetColumnWidth ( 4 , 5 * 256 ) ;
ws . SetColumnWidth ( 5 , 8 * 256 ) ;
ws . SetColumnWidth ( 6 , 8 * 256 ) ;
ws . SetColumnWidth ( 7 , 10 * 256 ) ;
ws . SetColumnWidth ( 8 , 10 * 256 ) ;
ws . SetColumnWidth ( 9 , 11 * 256 ) ;
ws . SetColumnWidth ( 10 , 9 * 256 ) ;
ws . SetColumnWidth ( 11 , 8 * 256 ) ;
ws . SetColumnWidth ( 12 , 1 * 256 ) ;
ws . SetColumnWidth ( 13 , 9 * 256 ) ;
ws . SetColumnWidth ( 14 , 9 * 256 ) ;
ws . SetColumnWidth ( 15 , 9 * 256 ) ;
ws . SetColumnWidth ( 16 , 8 * 256 ) ;
ws . SetColumnWidth ( 17 , 1 * 256 ) ;
//设置前3行高度
ws . GetRow ( 0 ) . Height = 15 * 20 ;
ws . GetRow ( 1 ) . Height = 15 * 20 ;
ws . GetRow ( 2 ) . Height = 14 * 20 ;
//设置3-15行的行高度
for ( int i = 3 ; i < 15 ; i + + )
{
ws . GetRow ( i ) . Height = 18 * 20 ;
}
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 0 , 0 , 1 , 1 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 1 , 1 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 16 , 16 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 2 , 2 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 1 , 14 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 1 , 1 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 16 , 16 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderLeft ( 2 , new CellRangeAddress ( 9 , 14 , 2 , 2 ) , ws ) ;
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 7 , 7 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 8 , 8 , 2 , 16 ) , ws ) ;
//插入图片
InsertImage ( hssfworkbook , ws , 3 , 2 , 4 , 3 , img1 , 1.2 , 1.8 ) ;
InsertImage ( hssfworkbook , ws , 3 , 3 , 4 , 4 , img2 , 1.9 , 1.9 ) ;
InsertImage ( hssfworkbook , ws , 3 , 13 , 4 , 14 , img3 , 1.5 , 1.5 ) ;
InsertImage ( hssfworkbook , ws , 3 , 15 , 4 , 16 , img4 , 1.5 , 1.5 ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "巴斯夫(广东)一体化项目" ) ;
var setStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "BASF (GUANGDONG) INTEGRATED PROJECT" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . SetCellValue ( "管道静电接地清单" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . SetCellValue ( "LIST OF PIPING ELECTROSTATIC GROUNDING" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . CellStyle = setStyle ;
var cellStyle2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , false , false , "Arial Unicode MS" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . SetCellValue ( "Test Package No" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 5 ) . SetCellValue ( "UG-130-FW-HT-001" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 5 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . SetCellValue ( "Area" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 13 ) . SetCellValue ( "C400" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 2 ) . SetCellValue ( "试压包号" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 9 ) . SetCellValue ( "区域" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 2 ) . SetCellValue ( "System No" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 5 ) . SetCellValue ( "FIRE WATER" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 5 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 9 ) . SetCellValue ( "Test Pressure" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 13 ) . SetCellValue ( "2" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 13 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . SetCellValue ( "系统号" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . SetCellValue ( "试验压力" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 9 ) . SetCellValue ( "Test Type" ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 13 ) . SetCellValue ( "Hydro Test" ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 13 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 9 ) . SetCellValue ( "试验方式" ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 5 , 13 ) ) ;
#endregion
#region 表 格 部 分
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , 15 , rowIndex + 49 , style , 0 , 17 , true ) ;
for ( int i = 15 ; i < 50 ; i + + )
{
ws . GetRow ( i ) . Height = 20 * 20 ;
ws . GetRow ( i ) . GetCell ( 0 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None ) ;
ws . GetRow ( i ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 8 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 10 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 13 , 15 ) ) ;
}
ws . GetRow ( 15 ) . Height = 28 * 20 ;
//数据表头部分
ws . GetRow ( rowIndex + 15 ) . GetCell ( 2 ) . SetCellValue ( "No\r\n序号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 3 ) . SetCellValue ( "Isometric Drawing No\r\n单线图号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 8 ) . SetCellValue ( "接头型式\r\nConnection Type" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 10 ) . SetCellValue ( "规格\r\nSpecification" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 13 ) . SetCellValue ( "材质\r\nMaterial" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 16 ) . SetCellValue ( "Remark\r\n备注" ) ;
#endregion
#region 尾 部
//此处的尾部行数需要根据 得到的动态数据量 来计算, 默认写死从50行开始。
ws = ExcelCreateRow ( ws , hssfworkbook , 49 , rowIndex + 55 , style , 0 , 17 , true ) ;
for ( int i = 49 ; i < = 55 ; i + + )
{
ws . GetRow ( i ) . Height = 18 * 20 ;
ws . GetRow ( i ) . GetCell ( 0 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
}
for ( int i = 2 ; i < 17 ; i + + )
{
ws . GetRow ( rowIndex + 55 ) . GetCell ( i ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None , BorderStyle . None ) ;
}
ws . GetRow ( rowIndex + 55 ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None ) ;
ws . GetRow ( rowIndex + 55 ) . GetCell ( 16 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None , BorderStyle . None ) ;
ws . GetRow ( rowIndex + 55 ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . Medium , BorderStyle . None , BorderStyle . Medium ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 2 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 5 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 7 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 10 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 14 , 16 ) ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 2 , 4 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 2 ) . SetCellValue ( "PREPARED" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 5 ) . SetCellValue ( "REVIEW" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 7 , 9 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 7 ) . SetCellValue ( "JIANLI" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 10 , 13 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 10 ) . SetCellValue ( "Worley" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 14 , 16 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 14 ) . SetCellValue ( "BASF" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 54 , rowIndex + 54 , 2 , 6 ) ) ;
ws . GetRow ( rowIndex + 54 ) . GetCell ( 2 ) . SetCellValue ( "CC7" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//17-管道焊接接头热处理报告SHT 3503-J411
private void template17 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 1 , rowIndex + 3 , style , 1 , 12 , true ) ;
ws . SetColumnWidth ( 0 , 2 * 256 ) ;
ws . SetColumnWidth ( 1 , 13 * 256 ) ;
ws . SetColumnWidth ( 2 , 12 * 256 ) ;
ws . SetColumnWidth ( 3 , 12 * 256 ) ;
ws . SetColumnWidth ( 4 , 10 * 256 ) ;
ws . SetColumnWidth ( 5 , 10 * 256 ) ;
ws . SetColumnWidth ( 6 , 10 * 256 ) ;
ws . SetColumnWidth ( 7 , 10 * 256 ) ;
ws . SetColumnWidth ( 8 , 12 * 256 ) ;
ws . SetColumnWidth ( 9 , 12 * 256 ) ;
ws . SetColumnWidth ( 10 , 12 * 256 ) ;
ws . SetColumnWidth ( 11 , 15 * 256 ) ;
ws . SetColumnWidth ( 12 , 15 * 256 ) ;
ws . GetRow ( rowIndex + 1 ) . Height = 18 * 20 * 5 ;
ws . GetRow ( rowIndex + 2 ) . Height = 18 * 20 ;
ws . GetRow ( rowIndex + 3 ) . Height = 18 * 20 * 3 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 1 , 4 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 1 ) . SetCellValue ( "SH/T 3503—J411-1" ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
style1 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 5 , 8 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 5 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 5 ) . SetCellValue ( "管道焊接接头热处理报告\nPiping Welded Joint Heat Treatment Report " ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , false , false , "Arial Unicode MS" ) ;
style2 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 9 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 9 ) . SetCellValue ( "工程名称:\nProject Name:\n\n\n单位工程名称:\nUnit Name:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 2 , 12 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 1 ) . SetCellValue ( "Report No." ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 1 ) . SetCellValue ( "Heat Treatment Method" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 2 , 6 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 7 ) . SetCellValue ( "Heat Treatment Equipment" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 8 , 12 ) ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 4 , rowIndex + 12 , style , 1 , 12 , true ) ;
for ( int i = 4 ; i < 13 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 ;
if ( 4 = = i )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 1 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 2 , 2 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 3 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 4 , 5 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 8 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 9 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 10 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 11 , 11 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 12 , 12 ) ) ;
}
if ( 5 = = i )
continue ;
}
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( "Piping No./Line No." ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 2 ) . SetCellValue ( "Weld No." ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 3 ) . SetCellValue ( "Temp. Measuring Point No." ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 4 ) . SetCellValue ( "HT Temperature ℃" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 6 ) . SetCellValue ( "Holding Time h" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 8 ) . SetCellValue ( "Material" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 9 ) . SetCellValue ( "Specification" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 10 ) . SetCellValue ( "Heat Treatment Date" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 11 ) . SetCellValue ( "Recording Curve No." ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 12 ) . SetCellValue ( "Hardness Report No." ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 4 ) . SetCellValue ( "Required" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . SetCellValue ( "Actual" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 6 ) . SetCellValue ( "Required" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 7 ) . SetCellValue ( "Actual" ) ;
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 13 , rowIndex + 15 , style , 1 , 12 , true ) ;
ws . GetRow ( rowIndex + 13 ) . Height = 18 * 20 ;
ws . GetRow ( rowIndex + 14 ) . Height = 18 * 20 ;
ws . GetRow ( rowIndex + 15 ) . Height = 18 * 20 * 4 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 13 , rowIndex + 13 , 1 , 12 ) ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 1 ) . SetCellValue ( "Conclusion:" ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 1 ) . CellStyle = style2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 14 , rowIndex + 14 , 1 , 3 ) ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 1 ) . SetCellValue ( "Owner/Supervision Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 14 , rowIndex + 14 , 4 , 6 ) ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 4 ) . SetCellValue ( "General Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 14 , rowIndex + 14 , 7 , 9 ) ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 7 ) . SetCellValue ( "Construction Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 14 , rowIndex + 14 , 10 , 12 ) ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 10 ) . SetCellValue ( "Heat Treatment Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 1 , 3 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 1 ) . SetCellValue ( " Discipline Engineer:\n\n\n\n Date:" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 1 ) . CellStyle = style2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 4 , 6 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 4 ) . SetCellValue ( " Discipline Engineer:\n\n\n\n Date:" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 4 ) . CellStyle = style2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 7 , 9 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 7 ) . SetCellValue ( " Foreman:\n Quality Inspector:\n Discipline Engineer:\n\n Date:" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 7 ) . CellStyle = style2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 10 , 12 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 10 ) . SetCellValue ( " Operator:\n Discipline Engineer:\n\n\n Date:" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 10 ) . CellStyle = style2 ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//18-金属材料化学成分检验报告SHT 3503-J129
private void template18 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 1 , rowIndex + 4 , style , 1 , 15 , true ) ;
ws . SetColumnWidth ( 0 , 2 * 256 ) ;
for ( int i = 1 ; i < 16 ; i + + )
{
if ( i = = 3 | | i = = 4 )
ws . SetColumnWidth ( i , 4 * 256 ) ;
2024-06-05 08:24:19 +08:00
else if ( i = = 15 )
2024-05-08 16:27:28 +08:00
ws . SetColumnWidth ( i , 8 * 256 ) ;
else
ws . SetColumnWidth ( i , 5 * 256 ) ;
}
ws . GetRow ( rowIndex + 1 ) . Height = 20 * 20 * 6 ;
for ( int i = 2 ; i < 5 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 * 3 ;
}
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 1 , 4 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 1 ) . SetCellValue ( "SH/T 3503—J129" ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
style1 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 5 , 10 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 5 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 5 ) . SetCellValue ( "金属材料化学成分检验报告\nMetal Material Chemical Composition Test Report\n\n第 页 共 页 Page of " ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , false , false , "Arial Unicode MS" ) ;
style2 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 11 , 15 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 11 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 11 ) . SetCellValue ( " 工程名称:\n Project Name:\n\n\n 单位工程名称:\n Unit Name:" ) ;
for ( int i = 2 ; i < 5 ; i + + )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 1 , 2 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 5 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 8 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 11 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 13 , 15 ) ) ;
}
ws . GetRow ( rowIndex + 2 ) . GetCell ( 1 ) . SetCellValue ( "委托单位\nEntrusted by" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 6 ) . SetCellValue ( "施工单位\nConstruction Contractor" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 11 ) . SetCellValue ( "报告编号\nReport No." ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 1 ) . SetCellValue ( "检件名称\nTest Piece Description" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 6 ) . SetCellValue ( "检验标准\nTest Criteria" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 11 ) . SetCellValue ( "被检验材料标准\nMaterial Specification" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( "检验方法\nTest Method" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 6 ) . SetCellValue ( "设备型号\nEquipment Model" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 11 ) . SetCellValue ( "检件材质\nTest Piece Material" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 5 , rowIndex + 17 , style , 1 , 15 , true ) ;
for ( int i = 5 ; i < 18 ; i + + )
{
2024-06-05 08:24:19 +08:00
if ( i = = 6 )
{
2024-05-08 16:27:28 +08:00
ws . GetRow ( rowIndex + i ) . Height = 60 * 20 ;
continue ;
2024-06-05 08:24:19 +08:00
}
2024-05-08 16:27:28 +08:00
if ( i = = 5 )
{
ws . GetRow ( rowIndex + i ) . Height = 60 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 1 , 2 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 3 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 5 , 5 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 6 , 15 ) ) ;
}
else
{
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 1 , 2 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 4 ) ) ;
}
}
ws . GetRow ( rowIndex + 5 ) . GetCell ( 1 ) . SetCellValue ( "质量证明文件编号/炉批号\nQuality Certificate No./Heat No. or Lot No." ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 3 ) . SetCellValue ( "检验部位编号\nTest Position No." ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . SetCellValue ( "规格\nSpecification" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 6 ) . SetCellValue ( "元素含量%\nElement Content" ) ;
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 18 , rowIndex + 19 , style , 1 , 15 , true ) ;
ws . GetRow ( rowIndex + 18 ) . Height = 20 * 20 * 4 ;
ws . GetRow ( rowIndex + 19 ) . Height = 90 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 1 , 15 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 1 ) . SetCellValue ( " 检验结论Conclusion: \n 共检验点,符合标准要求点,不符合标准要求点,具体检验部位详见示意图。\n Totally points are tested, where points are conforming and points are nonconforming. For specific test positions, see the sketch." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 19 , rowIndex + 19 , 1 , 5 ) ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 1 ) . SetCellValue ( "\n 试验人Tested by: \n\n\n 资格Qualification: " ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 19 , rowIndex + 19 , 6 , 10 ) ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 6 ) . SetCellValue ( "\n 审核人Reviewed by: \n\n\n 资格Qualification: " ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 19 , rowIndex + 19 , 11 , 15 ) ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 11 ) . SetCellValue ( " 检测单位:(公章)\n\n Inspection Agency: (Official Seal)\n\n 报告日期Date: 年 月 日" ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 1 ) . CellStyle = ws . GetRow ( rowIndex + 19 ) . GetCell ( 1 ) . CellStyle = ws . GetRow ( rowIndex + 19 ) . GetCell ( 6 ) . CellStyle = ws . GetRow ( rowIndex + 19 ) . GetCell ( 11 ) . CellStyle = style2 ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//19-硬度检查报告SHT 3503-J130
private void template19 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 1 , rowIndex + 5 , style , 1 , 12 , true ) ;
ws . SetColumnWidth ( 0 , 2 * 256 ) ;
ws . SetColumnWidth ( 1 , 10 * 256 ) ;
ws . SetColumnWidth ( 2 , 5 * 256 ) ;
ws . SetColumnWidth ( 3 , 5 * 256 ) ;
ws . SetColumnWidth ( 4 , 5 * 256 ) ;
ws . SetColumnWidth ( 5 , 10 * 256 ) ;
ws . SetColumnWidth ( 6 , 5 * 256 ) ;
ws . SetColumnWidth ( 7 , 5 * 256 ) ;
ws . SetColumnWidth ( 8 , 5 * 256 ) ;
ws . SetColumnWidth ( 9 , 10 * 256 ) ;
ws . SetColumnWidth ( 10 , 5 * 256 ) ;
ws . SetColumnWidth ( 11 , 5 * 256 ) ;
ws . SetColumnWidth ( 12 , 5 * 256 ) ;
ws . GetRow ( rowIndex + 1 ) . Height = 18 * 20 * 7 ;
ws . GetRow ( rowIndex + 2 ) . Height = ws . GetRow ( rowIndex + 3 ) . Height = ws . GetRow ( rowIndex + 4 ) . Height = ws . GetRow ( rowIndex + 5 ) . Height = 41 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 1 , 3 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 1 ) . SetCellValue ( "SH/T 3503—J130" ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
style1 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 4 , 9 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 4 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 4 ) . SetCellValue ( "硬度检测报告\nHardness Test Report\n\n第 页 共 页 Page of " ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , false , false , "Arial Unicode MS" ) ;
style2 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 10 , 12 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 10 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 10 ) . SetCellValue ( "工程名称:\nProject Name:\n\n\n单位工程名称:\nUnit Name:" ) ;
for ( int i = 2 ; i < 6 ; i + + )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 2 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 6 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 10 , 12 ) ) ;
}
ws . GetRow ( rowIndex + 2 ) . GetCell ( 1 ) . SetCellValue ( "委托单位\nEntrusted by" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 5 ) . SetCellValue ( "施工单位\nConstruction Contractor" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 9 ) . SetCellValue ( "报告编号\nReport No." ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 1 ) . SetCellValue ( "检件名称\nTest Piece Description" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "检测标准\nTest Criteria" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 9 ) . SetCellValue ( "验收标准\nMaterial Specification" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( "检件规格\nTest Piece Specification" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "检件材质\nTest Piece Material" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 9 ) . SetCellValue ( "检测比例\nTest Percentage" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 1 ) . SetCellValue ( "检测方法\nTest Position No." ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . SetCellValue ( "热处理状态\nHT Status" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 9 ) . SetCellValue ( "设备型号\nEquipment Model" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 6 , rowIndex + 16 , style , 1 , 12 , true ) ;
for ( int i = 6 ; i < 17 ; i + + )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 1 , 2 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 5 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 7 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 11 , 12 ) ) ;
if ( i = = 6 )
ws . GetRow ( rowIndex + i ) . Height = 41 * 20 ;
else
ws . GetRow ( rowIndex + i ) . Height = 22 * 20 ;
}
ws . GetRow ( rowIndex + 6 ) . GetCell ( 1 ) . SetCellValue ( "检测部位编号\nTest Position No." ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 3 ) . SetCellValue ( "硬度值\nHardness Value" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . SetCellValue ( "检测部位编号\nTest Position No." ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 7 ) . SetCellValue ( "硬度值\nHardness Value" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 9 ) . SetCellValue ( "检测部位编号\nTest Position No." ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 11 ) . SetCellValue ( "硬度值\nHardness Value" ) ;
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 17 , rowIndex + 18 , style , 1 , 12 , true ) ;
ws . GetRow ( rowIndex + 17 ) . Height = 18 * 20 * 4 ;
ws . GetRow ( rowIndex + 18 ) . Height = 18 * 20 * 5 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 1 , 12 ) ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 1 ) . SetCellValue ( "检测结论:\nConclusion:\n共检测点, 符合标准要求点, 不符合标准要求点, 具体检测部位详见示意图。\nTotally points are tested, where points are conforming and points are nonconforming. For specific test positions, see the sketch." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 1 , 4 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 1 ) . SetCellValue ( "\n 试验人Tested by: \n\n\n 资格Qualification: " ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 5 , 8 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 5 ) . SetCellValue ( "\n 审核人Reviewed by: \n\n\n 资格Qualification: " ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 9 ) . SetCellValue ( " 检测单位:(公章)\n\n Inspection Agency: (Official Seal)\n\n 报告日期Date: 年 月 日" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 1 ) . CellStyle = ws . GetRow ( rowIndex + 18 ) . GetCell ( 1 ) . CellStyle = ws . GetRow ( rowIndex + 18 ) . GetCell ( 5 ) . CellStyle = ws . GetRow ( rowIndex + 18 ) . GetCell ( 9 ) . CellStyle = style2 ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//21-管道焊接工作记录SHT 3503-J415
2024-06-05 08:24:19 +08:00
private void template21_old ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
2024-05-08 16:27:28 +08:00
{
#region 头 部
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false , "宋体" ) ;
int rowIndex = 0 ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 3 , style , 0 , 12 , true ) ;
//设置列宽
ws . SetColumnWidth ( 0 , 17 * 256 ) ;
ws . SetColumnWidth ( 1 , 12 * 256 ) ;
ws . SetColumnWidth ( 2 , 10 * 256 ) ;
ws . SetColumnWidth ( 3 , 17 * 256 ) ;
ws . SetColumnWidth ( 4 , 14 * 256 ) ;
ws . SetColumnWidth ( 5 , 12 * 256 ) ;
ws . SetColumnWidth ( 6 , 15 * 256 ) ;
ws . SetColumnWidth ( 7 , 12 * 256 ) ;
ws . SetColumnWidth ( 8 , 13 * 256 ) ;
ws . SetColumnWidth ( 9 , 12 * 256 ) ;
ws . SetColumnWidth ( 10 , 12 * 256 ) ;
ws . SetColumnWidth ( 11 , 17 * 256 ) ;
ws . SetColumnWidth ( 12 , 12 * 256 ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 3 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 0 ) . SetCellValue ( "SH/T 3503-J415-1" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 3 , 2 , 9 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 2 ) . SetCellValue ( "管道焊接工作记录\r\nPiping Welding Record" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 0 , 10 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 1 , 1 , 10 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 2 , 2 , 10 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 3 , 3 , 10 , 12 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 10 ) . SetCellValue ( "工程名称:巴斯夫(广东)一体化项目专用化学品二区" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 10 ) . SetCellValue ( "Project Name:BASF (Guangdong) Integrated Project" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 10 ) . SetCellValue ( "单位工程名称:埋地消防系统" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 10 ) . SetCellValue ( "Unit Name: FW" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 4 , rowIndex + 5 , style , 0 , 12 , true ) ;
ws . GetRow ( rowIndex + 4 ) . Height = 30 * 20 ;
ws . GetRow ( rowIndex + 5 ) . Height = 45 * 20 ;
//设置表头部分
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 0 , 0 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . SetCellValue ( "管道编号/单线号\r\nPiping No./Line No" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 1 , 2 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( "焊口编号\r\nWeld No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 3 , 3 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 3 ) . SetCellValue ( "焊工代号\r\nWelder's Stamp No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 4 , 4 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 4 ) . SetCellValue ( "规格mm\r\nSpecification\r\nmm" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 5 , 5 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "材质\r\nMaterial" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 6 , 6 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 6 ) . SetCellValue ( "焊接位置\r\nWelding\r\nPosition" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 7 , 8 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 7 ) . SetCellValue ( "焊接方法\r\nWelding Process" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 9 , 10 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 9 ) . SetCellValue ( "焊材牌号\r\nWelding Material Designation" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 11 , 11 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 11 ) . SetCellValue ( "实际预热温度℃\r\nActual Preheating Temperature ℃" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 12 , 12 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 12 ) . SetCellValue ( "焊接日期\r\nWelding Date" ) ;
//这里创建行数据
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 6 , rowIndex + 23 , style , 0 , 12 , true ) ;
for ( int i = 6 ; i < 24 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 19 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 1 , 2 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 7 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 9 , 10 ) ) ;
}
#endregion
#region 尾 部
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , true , false ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 24 , rowIndex + 30 , style , 0 , 12 , true ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 0 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 4 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 0 ) . SetCellValue ( "建设/监理单位\r\nOwner/Supervision Contractor" ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 4 ) . SetCellValue ( "总承包单位\r\nGeneral Contractor" ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 9 ) . SetCellValue ( "施工单位\r\nConstruction Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 0 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . GetRow ( rowIndex + 25 ) . Height = 31 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 9 ) . SetCellValue ( "记录人 : \r\nRecord Prepared by:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 9 ) . SetCellValue ( "质量检查员:\r\nQuality Inspector:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 29 , rowIndex + 29 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 9 ) . SetCellValue ( "焊接责任工程师:\r\nWelding Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 30 ) . GetCell ( 0 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 4 , 8 ) ) ;
ws . GetRow ( rowIndex + 30 ) . GetCell ( 4 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 30 ) . GetCell ( 9 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
RegionUtil . SetBorderTop ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 0 , 12 ) , ws ) ;
RegionUtil . SetBorderLeft ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 12 , 12 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 0 , 12 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 3 , 3 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 8 , 8 ) , ws ) ;
ws . GetRow ( rowIndex + 26 ) . Height = ws . GetRow ( rowIndex + 28 ) . Height = ws . GetRow ( rowIndex + 29 ) . Height = 2 * 20 ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
2024-06-05 08:24:19 +08:00
//21-管道焊接工作记录SHT 3503-J415
private void template21 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
#region 头 部
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 15 , true , false , "宋体" ) ;
var styleTwo = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Left , 9.5 , true , false , "宋体" ) ;
var styleThree = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 9.5 , true , false , "宋体" ) ;
var style4 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10.5 , true , false , "宋体" ) ;
int rowIndex = 0 ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 3 , style , 0 , 14 , true ) ;
//设置列宽
ws . SetColumnWidth ( 0 , 18 * 256 ) ;
ws . SetColumnWidth ( 1 , 9 * 256 ) ;
ws . SetColumnWidth ( 2 , 6 * 256 ) ;
ws . SetColumnWidth ( 3 , 12 * 256 ) ;
ws . SetColumnWidth ( 4 , 18 * 256 ) ;
ws . SetColumnWidth ( 5 , 19 * 256 ) ;
ws . SetColumnWidth ( 6 , 13 * 256 ) ;
ws . SetColumnWidth ( 7 , 13 * 256 ) ;
ws . SetColumnWidth ( 8 , 14 * 256 ) ;
ws . SetColumnWidth ( 9 , 13 * 256 ) ;
ws . SetColumnWidth ( 10 , 13 * 256 ) ;
ws . SetColumnWidth ( 11 , 10 * 256 ) ;
ws . SetColumnWidth ( 12 , 16 * 256 ) ;
ws . SetColumnWidth ( 13 , 14 * 256 ) ;
ws . SetColumnWidth ( 14 , 19 * 256 ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 3 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 0 ) . SetCellValue ( "SH/T 3503-J415-1" ) ;
ws . GetRow ( rowIndex ) . GetCell ( 0 ) . CellStyle = styleThree ;
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 3 , 2 , 10 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 2 ) . SetCellValue ( "管道焊接工作记录\r\nPiping Welding Record" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 0 , 11 , 14 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 1 , 1 , 11 , 14 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 2 , 2 , 11 , 14 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 3 , 3 , 11 , 14 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 11 ) . SetCellValue ( "工程名称:巴斯夫(广东)一体化项目专用化学品二区" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 11 ) . SetCellValue ( "Project Name:BASF (Guangdong) Integrated Project" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 11 ) . SetCellValue ( "单位工程名称:埋地消防系统" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 11 ) . SetCellValue ( "Unit Name: FW" ) ;
ws . GetRow ( rowIndex ) . GetCell ( 11 ) . CellStyle = ws . GetRow ( rowIndex + 1 ) . GetCell ( 11 ) . CellStyle = ws . GetRow ( rowIndex + 2 ) . GetCell ( 11 ) . CellStyle = ws . GetRow ( rowIndex + 3 ) . GetCell ( 11 ) . CellStyle = styleTwo ;
ws . GetRow ( rowIndex ) . Height = ws . GetRow ( rowIndex + 1 ) . Height = ws . GetRow ( rowIndex + 2 ) . Height = ws . GetRow ( rowIndex + 3 ) . Height = 25 * 20 ;
//画线
RegionUtil . SetBorderBottom ( 0 , new CellRangeAddress ( rowIndex , rowIndex , 11 , 14 ) , ws ) ;
RegionUtil . SetBorderTop ( 0 , new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 11 , 14 ) , ws ) ;
RegionUtil . SetBorderBottom ( 0 , new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 11 , 14 ) , ws ) ;
RegionUtil . SetBorderTop ( 0 , new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 11 , 14 ) , ws ) ;
RegionUtil . SetBorderBottom ( 0 , new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 11 , 14 ) , ws ) ;
RegionUtil . SetBorderTop ( 0 , new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 11 , 14 ) , ws ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 4 , rowIndex + 5 , style4 , 0 , 14 , true ) ;
ws . GetRow ( rowIndex + 4 ) . Height = 25 * 20 ;
ws . GetRow ( rowIndex + 5 ) . Height = 25 * 20 ;
//设置表头部分
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 0 , 0 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . SetCellValue ( "管道编号/单线号\r\nPiping No./Line No" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 1 , 2 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( "焊口编号\r\nWeld No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 3 , 3 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 3 ) . SetCellValue ( "焊接形式\r\nWeld Type." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 4 , 4 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 4 ) . SetCellValue ( "焊工代号\r\nWelder's Stamp No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 5 , 5 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "规格mm\r\nSpecification mm" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 6 , 6 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 6 ) . SetCellValue ( "材质\r\nMaterial" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 7 , 7 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 7 ) . SetCellValue ( "焊接位置\r\nWelding\r\nPosition" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 8 , 9 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 8 ) . SetCellValue ( "焊接方法\r\nWelding Process" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 10 , 11 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 10 ) . SetCellValue ( "焊材牌号\r\nWelding Material Designation" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 12 , 12 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 12 ) . SetCellValue ( "实际预热温度℃\r\nActual Preheating Temperature ℃" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 13 , 13 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 13 ) . SetCellValue ( "焊接日期\r\nWelding Date" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 5 , 14 , 14 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 14 ) . SetCellValue ( "无损检查报告\r\nNDE Report." ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . CellStyle = ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . CellStyle
= ws . GetRow ( rowIndex + 4 ) . GetCell ( 3 ) . CellStyle = ws . GetRow ( rowIndex + 4 ) . GetCell ( 4 ) . CellStyle
= ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . CellStyle = ws . GetRow ( rowIndex + 4 ) . GetCell ( 6 ) . CellStyle
= ws . GetRow ( rowIndex + 4 ) . GetCell ( 7 ) . CellStyle = ws . GetRow ( rowIndex + 4 ) . GetCell ( 8 ) . CellStyle
= ws . GetRow ( rowIndex + 4 ) . GetCell ( 10 ) . CellStyle = ws . GetRow ( rowIndex + 4 ) . GetCell ( 12 ) . CellStyle
= ws . GetRow ( rowIndex + 4 ) . GetCell ( 13 ) . CellStyle = ws . GetRow ( rowIndex + 4 ) . GetCell ( 14 ) . CellStyle = styleThree ;
//这里创建行数据
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 6 , rowIndex + 23 , style , 0 , 14 , true ) ;
for ( int i = 6 ; i < 24 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 19 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 1 , 2 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 8 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 10 , 11 ) ) ;
}
#endregion
#region 尾 部
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , true , false ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 24 , rowIndex + 30 , style , 0 , 14 , true ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 0 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 5 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 10 , 14 ) ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 0 ) . SetCellValue ( "建设/监理单位\r\nOwner/Supervision Contractor" ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 0 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 5 ) . SetCellValue ( "总承包单位\r\nGeneral Contractor" ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 5 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 10 ) . SetCellValue ( "施工单位\r\nConstruction Contractor" ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 10 ) . CellStyle = style1 ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 0 , 14 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 0 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . GetRow ( rowIndex + 25 ) . Height = 31 * 20 ;
ws . GetRow ( rowIndex + 27 ) . Height = 31 * 20 ;
ws . GetRow ( rowIndex + 29 ) . Height = 31 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 5 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 10 , 14 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 10 ) . SetCellValue ( "记录人 : \r\nRecord Prepared by:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 10 , 14 ) ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 10 ) . SetCellValue ( "质量检查员:\r\nQuality Inspector:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 29 , rowIndex + 29 , 10 , 14 ) ) ;
ws . GetRow ( rowIndex + 29 ) . GetCell ( 10 ) . SetCellValue ( "焊接责任工程师:\r\nWelding Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 0 , 4 ) ) ;
ws . GetRow ( rowIndex + 30 ) . GetCell ( 0 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 5 , 9 ) ) ;
ws . GetRow ( rowIndex + 30 ) . GetCell ( 5 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 10 , 14 ) ) ;
ws . GetRow ( rowIndex + 30 ) . GetCell ( 10 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
RegionUtil . SetBorderTop ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 0 , 14 ) , ws ) ;
RegionUtil . SetBorderLeft ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 14 , 14 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 30 , rowIndex + 30 , 0 , 14 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 4 , 4 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 30 , 9 , 9 ) , ws ) ;
ws . GetRow ( rowIndex + 26 ) . Height = ws . GetRow ( rowIndex + 28 ) . Height = 5 * 20 ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
2024-05-08 16:27:28 +08:00
//22-射线检测比例确认表SHT 3503-J412-2007
2024-06-05 08:24:19 +08:00
private void template22_old ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
2024-05-08 16:27:28 +08:00
{
#region 头 部
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false , "宋体" ) ;
int rowIndex = 0 ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 4 , style , 0 , 20 , true ) ;
//设置列宽
ws . SetColumnWidth ( 0 , 11 * 256 ) ;
ws . SetColumnWidth ( 1 , 5 * 256 ) ;
ws . SetColumnWidth ( 2 , 8 * 256 ) ;
ws . SetColumnWidth ( 3 , 5 * 256 ) ;
ws . SetColumnWidth ( 4 , 5 * 256 ) ;
ws . SetColumnWidth ( 5 , 6 * 256 ) ;
ws . SetColumnWidth ( 6 , 6 * 256 ) ;
ws . SetColumnWidth ( 7 , 6 * 256 ) ;
ws . SetColumnWidth ( 8 , 6 * 256 ) ;
ws . SetColumnWidth ( 9 , 6 * 256 ) ;
ws . SetColumnWidth ( 10 , 6 * 256 ) ;
ws . SetColumnWidth ( 11 , 6 * 256 ) ;
ws . SetColumnWidth ( 12 , 21 * 256 ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 3 , 0 , 2 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 0 ) . SetCellValue ( "SH/T 3503-J412-1-2007" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 0 , 3 , 17 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 3 ) . SetCellValue ( "管道焊接接头射线检测比例确认表(一)" ) ;
ws . GetRow ( rowIndex ) . GetCell ( 3 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 16 , true , true ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 1 , 2 , 3 , 17 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . SetCellValue ( "Pipeline Welding Joints Radiographic Examination Rate Confirmation Form( I) " ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 16 , true , true ) ;
2024-06-05 08:24:19 +08:00
ws . AddMergedRegion ( new CellRangeAddress ( 0 , 3 , 18 , 20 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 3 , 3 , 3 , 17 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 18 ) . SetCellValue ( "工程名称:巴斯夫(广东)一体化项目专用化学品二区\nProject Name: BASF (Guangdong) Integrated Project\n单元名称: Citral\nUnit Name:Citral" ) ;
ws . GetRow ( rowIndex ) . GetCell ( 18 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , true , false ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 3 ) . SetCellValue ( "共 1 页 第 1 页" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . SetCellValue ( "执行标准\r\nApplicable code" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 4 , 1 , 5 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 4 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 4 , 8 , 15 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 4 , 16 , 17 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 4 , 18 , 20 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( "NB/T47013.2-2015" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 6 ) . SetCellValue ( "检测方法\r\nExam. Method" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 8 ) . SetCellValue ( "射线检测\r\nRT" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 16 ) . SetCellValue ( "检测比例\r\nExam. Rate" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 18 ) . SetCellValue ( "5%" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 5 , rowIndex + 6 , style , 0 , 20 , true ) ;
ws . GetRow ( rowIndex + 5 ) . Height = 28 * 20 ;
ws . GetRow ( rowIndex + 6 ) . Height = 42 * 20 ;
//设置表头部分
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 6 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 0 ) . SetCellValue ( "管道编号\r\nPipeline No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 6 , 2 , 2 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 2 ) . SetCellValue ( "材质\r\nMaterial" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 3 , 4 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 3 ) . SetCellValue ( "规 格/Size" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 3 , 4 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 3 ) . SetCellValue ( "mm" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 5 , 8 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . SetCellValue ( "管道焊接接头\r\nWelding Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 9 ) . SetCellValue ( "施焊焊工\r\nWelder" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 13 , 16 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 13 ) . SetCellValue ( "检测焊接接头\r\nExanined Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 17 , 19 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 17 ) . SetCellValue ( "实际检测比例" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 20 ) . SetCellValue ( "检测报告编号" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . SetCellValue ( "总数\r\nTotal" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 7 , 8 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 7 ) . SetCellValue ( "固定口数\r\nField Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 9 , 10 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 9 ) . SetCellValue ( "焊工代号\r\nWelder No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 11 , 12 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 11 ) . SetCellValue ( "施焊数量\r\nWelded Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 13 , 14 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 13 ) . SetCellValue ( "总数\r\nTotal Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 15 , 16 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 15 ) . SetCellValue ( "固定口数\r\nField Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 17 , 19 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 17 ) . SetCellValue ( "Actual exam. Rate" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 20 ) . SetCellValue ( "Examination Report No." ) ;
//这里创建行数据
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 7 , rowIndex + 16 , style , 0 , 20 , true ) ;
for ( int i = 7 ; i < 15 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 25 * 20 ;
}
//这里循环数据
ws . GetRow ( rowIndex + 15 ) . GetCell ( 0 ) . SetCellValue ( "小计\r\nTotal" ) ;
#endregion
#region 尾 部
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . SetCellValue ( "备注\r\nRemark" ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 1 ) . SetCellValue ( "焊口位置与检测焊口见管道单线图与无损检测报告。\r\nPlease refer to Pipeline Iso-drawing and NDE Report for joints position and examined joints." ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 1 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , true , false ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 1 , 20 ) ) ;
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , true , false ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 17 , rowIndex + 24 , style , 0 , 20 , true ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 20 ) . CellStyle = style1 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 0 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 4 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 10 , 16 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 0 ) . SetCellValue ( "建设/监理单位\r\nOwner/Supervision Contractor" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 4 ) . SetCellValue ( "总承包单位\r\nGeneral Contractor" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 10 ) . SetCellValue ( "检 测 单 位\r\nExamination Contractor" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 17 ) . SetCellValue ( "施 工 单 位\r\nConstruction Company" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 0 ) . CellStyle = ws . GetRow ( rowIndex + 17 ) . GetCell ( 4 ) . CellStyle = ws . GetRow ( rowIndex + 17 ) . GetCell ( 10 ) . CellStyle = ws . GetRow ( rowIndex + 17 ) . GetCell ( 17 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 17 ) . Height = 31 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 0 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . GetRow ( rowIndex + 18 ) . Height = 31 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 4 , 9 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 4 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 10 , 16 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 10 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 17 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 20 , rowIndex + 20 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 17 ) . SetCellValue ( "质量检查员:\r\nQuality Inspector:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 22 , rowIndex + 22 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 17 ) . SetCellValue ( "制表:\r\nPrepared:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 0 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 4 , 9 ) ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 4 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 10 , 16 ) ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 10 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 17 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . GetRow ( rowIndex + 19 ) . Height = ws . GetRow ( rowIndex + 21 ) . Height = ws . GetRow ( rowIndex + 22 ) . Height = ws . GetRow ( rowIndex + 23 ) . Height = 2 * 20 ;
RegionUtil . SetBorderTop ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 0 , 20 ) , ws ) ;
RegionUtil . SetBorderLeft ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 24 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 24 , 20 , 20 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 24 , rowIndex + 24 , 0 , 20 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 24 , 3 , 3 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 24 , 9 , 9 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 24 , 16 , 16 ) , ws ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//22-射线检测比例确认表SHT 3503-J412-2007
private void template22 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
#region 头 部
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10.5 , true , false , "宋体" ) ;
int rowIndex = 0 ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 4 , style , 0 , 20 , true ) ;
//设置列宽
ws . SetColumnWidth ( 0 , 13 * 256 ) ;
ws . SetColumnWidth ( 1 , 6 * 256 ) ;
ws . SetColumnWidth ( 2 , 10 * 256 ) ;
ws . SetColumnWidth ( 3 , 5 * 256 ) ;
ws . SetColumnWidth ( 4 , 5 * 256 ) ;
ws . SetColumnWidth ( 5 , 7 * 256 ) ;
ws . SetColumnWidth ( 6 , 7 * 256 ) ;
ws . SetColumnWidth ( 7 , 7 * 256 ) ;
ws . SetColumnWidth ( 8 , 7 * 256 ) ;
ws . SetColumnWidth ( 9 , 7 * 256 ) ;
ws . SetColumnWidth ( 10 , 7 * 256 ) ;
ws . SetColumnWidth ( 11 , 7 * 256 ) ;
ws . SetColumnWidth ( 12 , 7 * 256 ) ;
ws . SetColumnWidth ( 13 , 7 * 256 ) ;
ws . SetColumnWidth ( 14 , 7 * 256 ) ;
ws . SetColumnWidth ( 15 , 7 * 256 ) ;
ws . SetColumnWidth ( 16 , 7 * 256 ) ;
ws . SetColumnWidth ( 17 , 5 * 256 ) ;
ws . SetColumnWidth ( 18 , 7 * 256 ) ;
ws . SetColumnWidth ( 19 , 7 * 256 ) ;
ws . SetColumnWidth ( 20 , 25 * 256 ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex , rowIndex + 3 , 0 , 2 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 0 ) . SetCellValue ( "SH/T 3503-J412-1-2007" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex , rowIndex , 3 , 17 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 3 ) . SetCellValue ( "管道焊接接头射线检测比例确认表(一)" ) ;
ws . GetRow ( rowIndex ) . GetCell ( 3 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 16 , true , true ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 2 , 3 , 17 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . SetCellValue ( "Pipeline Welding Joints Radiographic Examination Rate Confirmation Form( I) " ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex , rowIndex , 18 , 20 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 18 ) . SetCellValue ( "工程名称:巴斯夫(广东)一体化项目专用化学品二区" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 18 , 20 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 18 ) . SetCellValue ( "Project Name: BASF (Guangdong) Integrated Project" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 18 , 20 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 18 ) . SetCellValue ( "单元名称: Citral" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 18 , 20 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 18 ) . SetCellValue ( "Unit Name:Citral" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 3 , 17 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 18 ) . CellStyle = ws . GetRow ( rowIndex + 1 ) . GetCell ( 18 ) . CellStyle = ws . GetRow ( rowIndex + 2 ) . GetCell ( 18 ) . CellStyle = ws . GetRow ( rowIndex + 3 ) . GetCell ( 18 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Left , 10.5 , true , false ) ;
RegionUtil . SetBorderBottom ( 0 , new CellRangeAddress ( rowIndex , rowIndex , 18 , 20 ) , ws ) ;
RegionUtil . SetBorderTop ( 0 , new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 18 , 20 ) , ws ) ;
RegionUtil . SetBorderBottom ( 0 , new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 18 , 20 ) , ws ) ;
RegionUtil . SetBorderTop ( 0 , new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 18 , 20 ) , ws ) ;
RegionUtil . SetBorderBottom ( 0 , new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 18 , 20 ) , ws ) ;
RegionUtil . SetBorderTop ( 0 , new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 18 , 20 ) , ws ) ;
2024-05-08 16:27:28 +08:00
ws . GetRow ( rowIndex + 3 ) . GetCell ( 3 ) . SetCellValue ( "共 1 页 第 1 页" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . SetCellValue ( "执行标准\r\nApplicable code" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 4 , 1 , 5 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 4 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 4 , 8 , 15 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 4 , 16 , 17 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( 4 , 4 , 18 , 20 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( "NB/T47013.2-2015" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 6 ) . SetCellValue ( "检测方法\r\nExam. Method" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 8 ) . SetCellValue ( "射线检测\r\nRT" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 16 ) . SetCellValue ( "检测比例\r\nExam. Rate" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 18 ) . SetCellValue ( "5%" ) ;
2024-06-05 08:24:19 +08:00
ws . GetRow ( rowIndex ) . Height = 27 * 20 ;
ws . GetRow ( rowIndex + 1 ) . Height = 27 * 20 ;
ws . GetRow ( rowIndex + 2 ) . Height = 15 * 20 ;
ws . GetRow ( rowIndex + 3 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 4 ) . Height = 40 * 20 ;
2024-05-08 16:27:28 +08:00
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 5 , rowIndex + 6 , style , 0 , 20 , true ) ;
2024-06-05 08:24:19 +08:00
ws . GetRow ( rowIndex + 5 ) . Height = 29 * 20 ;
ws . GetRow ( rowIndex + 6 ) . Height = 43 * 20 ;
2024-05-08 16:27:28 +08:00
//设置表头部分
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 6 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 0 ) . SetCellValue ( "管道编号\r\nPipeline No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 6 , 2 , 2 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 2 ) . SetCellValue ( "材质\r\nMaterial" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 3 , 4 ) ) ;
2024-06-05 08:24:19 +08:00
ws . GetRow ( rowIndex + 5 ) . GetCell ( 3 ) . SetCellValue ( "规 格/Size" ) ;
2024-05-08 16:27:28 +08:00
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 3 , 4 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 3 ) . SetCellValue ( "mm" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 5 , 8 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . SetCellValue ( "管道焊接接头\r\nWelding Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 9 ) . SetCellValue ( "施焊焊工\r\nWelder" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 13 , 16 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 13 ) . SetCellValue ( "检测焊接接头\r\nExanined Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 17 , 19 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 17 ) . SetCellValue ( "实际检测比例" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 20 ) . SetCellValue ( "检测报告编号" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . SetCellValue ( "总数\r\nTotal" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 7 , 8 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 7 ) . SetCellValue ( "固定口数\r\nField Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 9 , 10 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 9 ) . SetCellValue ( "焊工代号\r\nWelder No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 11 , 12 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 11 ) . SetCellValue ( "施焊数量\r\nWelded Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 13 , 14 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 13 ) . SetCellValue ( "总数\r\nTotal Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 15 , 16 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 15 ) . SetCellValue ( "固定口数\r\nField Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 17 , 19 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 17 ) . SetCellValue ( "Actual exam. Rate" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 20 ) . SetCellValue ( "Examination Report No." ) ;
2024-06-05 08:24:19 +08:00
RegionUtil . SetBorderBottom ( 0 , new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 17 , 20 ) , ws ) ;
RegionUtil . SetBorderTop ( 0 , new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 17 , 20 ) , ws ) ;
2024-05-08 16:27:28 +08:00
2024-06-05 08:24:19 +08:00
//这里创建行数据 17-16
2024-05-08 16:27:28 +08:00
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 7 , rowIndex + 16 , style , 0 , 20 , true ) ;
2024-06-05 08:24:19 +08:00
for ( int i = 7 ; i < 16 ; i + + )
2024-05-08 16:27:28 +08:00
{
2024-06-05 08:24:19 +08:00
ws . GetRow ( rowIndex + i ) . Height = 28 * 20 ;
if ( i = = 7 )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + 10 , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + 10 , 2 , 2 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + 10 , 3 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + 10 , 5 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + 10 , 7 , 8 ) ) ;
}
if ( i > 10 )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 5 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 7 , 8 ) ) ;
}
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 11 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 13 , 14 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 15 , 16 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 17 , 19 ) ) ;
2024-05-08 16:27:28 +08:00
}
//这里循环数据
ws . GetRow ( rowIndex + 15 ) . GetCell ( 0 ) . SetCellValue ( "小计\r\nTotal" ) ;
2024-06-05 08:24:19 +08:00
//模拟数据
ws . GetRow ( rowIndex + 7 ) . GetCell ( 0 ) . SetCellValue ( "1701-130-9062.058-0000" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 2 ) . SetCellValue ( "A53-B" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 3 ) . SetCellValue ( "114" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 5 ) . SetCellValue ( "18" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 7 ) . SetCellValue ( "1" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 9 ) . SetCellValue ( "W7004" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 9 ) . SetCellValue ( "W7010" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . SetCellValue ( "W7011" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 9 ) . SetCellValue ( "W7013" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 11 ) . SetCellValue ( "6" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 11 ) . SetCellValue ( "3" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 11 ) . SetCellValue ( "6" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 11 ) . SetCellValue ( "1" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 13 ) . SetCellValue ( "1" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 13 ) . SetCellValue ( "3" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 13 ) . SetCellValue ( "6" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 13 ) . SetCellValue ( "1" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 15 ) . SetCellValue ( "0" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 15 ) . SetCellValue ( "0" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 15 ) . SetCellValue ( "0" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 15 ) . SetCellValue ( "1" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 17 ) . SetCellValue ( "16.87%" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 17 ) . SetCellValue ( "100.00%" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 17 ) . SetCellValue ( "100.00%" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 17 ) . SetCellValue ( "50.00%" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 20 ) . SetCellValue ( "RT-0010" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 20 ) . SetCellValue ( "RT-009\r\nRT-0010" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 20 ) . SetCellValue ( "RT-0010" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 20 ) . SetCellValue ( "RT-037" ) ;
2024-05-08 16:27:28 +08:00
#endregion
#region 尾 部
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . SetCellValue ( "备注\r\nRemark" ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 1 ) . SetCellValue ( "焊口位置与检测焊口见管道单线图与无损检测报告。\r\nPlease refer to Pipeline Iso-drawing and NDE Report for joints position and examined joints." ) ;
2024-06-05 08:24:19 +08:00
ws . GetRow ( rowIndex + 16 ) . GetCell ( 1 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Left , 10.5 , true , false ) ;
2024-05-08 16:27:28 +08:00
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 1 , 20 ) ) ;
2024-06-05 08:24:19 +08:00
ws . GetRow ( rowIndex + 16 ) . Height = 29 * 20 ;
2024-05-08 16:27:28 +08:00
2024-06-05 08:24:19 +08:00
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Left , 10.5 , true , false ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10.5 , true , false ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Bottom , NPOI . SS . UserModel . HorizontalAlignment . Left , 10.5 , true , false ) ;
2024-05-08 16:27:28 +08:00
2024-06-05 08:24:19 +08:00
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 17 , rowIndex + 23 , style , 0 , 20 , true ) ;
2024-05-08 16:27:28 +08:00
ws . GetRow ( rowIndex + 17 ) . GetCell ( 20 ) . CellStyle = style1 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 0 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 4 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 10 , 16 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 0 ) . SetCellValue ( "建设/监理单位\r\nOwner/Supervision Contractor" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 4 ) . SetCellValue ( "总承包单位\r\nGeneral Contractor" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 10 ) . SetCellValue ( "检 测 单 位\r\nExamination Contractor" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 17 ) . SetCellValue ( "施 工 单 位\r\nConstruction Company" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 0 ) . CellStyle = ws . GetRow ( rowIndex + 17 ) . GetCell ( 4 ) . CellStyle = ws . GetRow ( rowIndex + 17 ) . GetCell ( 10 ) . CellStyle = ws . GetRow ( rowIndex + 17 ) . GetCell ( 17 ) . CellStyle = style1 ;
2024-06-05 08:24:19 +08:00
ws . GetRow ( rowIndex + 17 ) . Height = 33 * 20 ;
2024-05-08 16:27:28 +08:00
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 0 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . GetRow ( rowIndex + 18 ) . Height = 31 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 4 , 9 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 4 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 10 , 16 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 10 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 17 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 20 , rowIndex + 20 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 17 ) . SetCellValue ( "质量检查员:\r\nQuality Inspector:" ) ;
2024-06-05 08:24:19 +08:00
ws . GetRow ( rowIndex + 20 ) . Height = 31 * 20 ;
2024-05-08 16:27:28 +08:00
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 22 , rowIndex + 22 , 17 , 20 ) ) ;
2024-06-05 08:24:19 +08:00
ws . GetRow ( rowIndex + 22 ) . GetCell ( 17 ) . SetCellValue ( "制表:\r\nPrepared:" ) ;
ws . GetRow ( rowIndex + 22 ) . Height = 31 * 20 ;
2024-05-08 16:27:28 +08:00
2024-06-05 08:24:19 +08:00
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 23 ) . GetCell ( 0 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
2024-05-08 16:27:28 +08:00
2024-06-05 08:24:19 +08:00
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 4 , 9 ) ) ;
ws . GetRow ( rowIndex + 23 ) . GetCell ( 4 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
2024-05-08 16:27:28 +08:00
2024-06-05 08:24:19 +08:00
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 10 , 16 ) ) ;
ws . GetRow ( rowIndex + 23 ) . GetCell ( 10 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
2024-05-08 16:27:28 +08:00
2024-06-05 08:24:19 +08:00
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 23 ) . GetCell ( 17 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . GetRow ( rowIndex + 23 ) . Height = 29 * 20 ;
ws . GetRow ( rowIndex + 23 ) . GetCell ( 0 ) . CellStyle = ws . GetRow ( rowIndex + 23 ) . GetCell ( 4 ) . CellStyle = ws . GetRow ( rowIndex + 23 ) . GetCell ( 10 ) . CellStyle = ws . GetRow ( rowIndex + 23 ) . GetCell ( 17 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 19 ) . Height = ws . GetRow ( rowIndex + 21 ) . Height = 14 * 20 ;
2024-05-08 16:27:28 +08:00
RegionUtil . SetBorderTop ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 0 , 20 ) , ws ) ;
2024-06-05 08:24:19 +08:00
RegionUtil . SetBorderLeft ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 23 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 23 , 20 , 20 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 23 , 0 , 20 ) , ws ) ;
2024-05-08 16:27:28 +08:00
2024-06-05 08:24:19 +08:00
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 23 , 3 , 3 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 23 , 9 , 9 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 23 , 16 , 16 ) , ws ) ;
2024-05-08 16:27:28 +08:00
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//23-TP-09-超声&PAUT&TOFD检测比例确认表
private void template23 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
#region 头 部
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false , "宋体" ) ;
int rowIndex = 0 ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 5 , style , 0 , 20 , true ) ;
for ( int i = 0 ; i < 21 ; i + + )
{
ws . GetRow ( rowIndex ) . GetCell ( i ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 ) ;
}
//设置列宽
ws . SetColumnWidth ( 0 , 11 * 256 ) ;
ws . SetColumnWidth ( 1 , 6 * 256 ) ;
ws . SetColumnWidth ( 2 , 10 * 256 ) ;
ws . SetColumnWidth ( 3 , 6 * 256 ) ;
ws . SetColumnWidth ( 4 , 6 * 256 ) ;
ws . SetColumnWidth ( 5 , 7 * 256 ) ;
ws . SetColumnWidth ( 6 , 7 * 256 ) ;
ws . SetColumnWidth ( 7 , 7 * 256 ) ;
ws . SetColumnWidth ( 8 , 7 * 256 ) ;
ws . SetColumnWidth ( 9 , 7 * 256 ) ;
ws . SetColumnWidth ( 10 , 7 * 256 ) ;
ws . SetColumnWidth ( 11 , 7 * 256 ) ;
ws . SetColumnWidth ( 12 , 7 * 256 ) ;
ws . SetColumnWidth ( 13 , 7 * 256 ) ;
ws . SetColumnWidth ( 14 , 7 * 256 ) ;
ws . SetColumnWidth ( 15 , 7 * 256 ) ;
ws . SetColumnWidth ( 16 , 7 * 256 ) ;
ws . SetColumnWidth ( 17 , 7 * 256 ) ;
ws . SetColumnWidth ( 18 , 7 * 256 ) ;
ws . SetColumnWidth ( 19 , 7 * 256 ) ;
ws . SetColumnWidth ( 20 , 24 * 256 ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 4 , 0 , 2 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 1 ) . SetCellValue ( "SH/T 3503-J412-1-2007" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 3 , 17 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . SetCellValue ( "管道焊接接头超声/PAUT/TOFD检测比例确认表( 一) " ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 16 , true , true ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 3 , 3 , 17 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 3 ) . SetCellValue ( "Pipeline Welding Joints Ultrasonic Examination/PAUT/TOFD Rate Confirmation Form( I) " ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 3 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 16 , true , true ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 4 , 18 , 20 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 3 , 17 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 18 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , true , false ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 18 ) . SetCellValue ( "工程名称:巴斯夫(广东)一体化项目专用化学品二区\nProject Name: BASF (Guangdong) Integrated Project\n单元名称: Citral\nUnit Name:Citral" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 3 ) . SetCellValue ( "共 1 页 第 1 页" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 1 , 5 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 8 , 15 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 16 , 17 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 18 , 20 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 0 ) . SetCellValue ( "执行标准\r\nApplicable code" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 1 ) . SetCellValue ( "NB/T47013.3-2015" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 6 ) . SetCellValue ( "检测方法\r\nExam. Method" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 8 ) . SetCellValue ( "超声检测\r\nUT" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 16 ) . SetCellValue ( "检测比例\r\nExam. Rate" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 18 ) . SetCellValue ( "95%" ) ;
//表头部分设置行高
ws . GetRow ( rowIndex ) . Height = 13 * 20 ;
ws . GetRow ( rowIndex + 1 ) . Height = 27 * 20 ;
ws . GetRow ( rowIndex + 2 ) . Height = 27 * 20 ;
ws . GetRow ( rowIndex + 4 ) . Height = 19 * 20 ;
ws . GetRow ( rowIndex + 5 ) . Height = 39 * 20 ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 6 , rowIndex + 7 , style , 0 , 20 , true ) ;
ws . GetRow ( rowIndex + 6 ) . Height = 28 * 20 ;
ws . GetRow ( rowIndex + 7 ) . Height = 42 * 20 ;
//设置表头部分
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 7 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 0 ) . SetCellValue ( "管道编号\r\nPipeline No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 7 , 2 , 2 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 2 ) . SetCellValue ( "材质\r\nMaterial" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 3 , 4 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 3 ) . SetCellValue ( "规 格/Size" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 3 , 4 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 3 ) . SetCellValue ( "mm" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 5 , 8 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . SetCellValue ( "管道焊接接头\r\nWelding Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 9 ) . SetCellValue ( "施焊焊工\r\nWelder" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 13 , 16 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 13 ) . SetCellValue ( "检测焊接接头\r\nExanined Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 17 , 19 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 17 ) . SetCellValue ( "实际检测比例" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 20 ) . SetCellValue ( "检测报告编号" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 5 ) . SetCellValue ( "总数\r\nTotal" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 7 , 8 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 7 ) . SetCellValue ( "固定口数\r\nField Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 9 , 10 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 9 ) . SetCellValue ( "焊工代号\r\nWelder No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 11 , 12 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 11 ) . SetCellValue ( "施焊数量\r\nWelded Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 13 , 14 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 13 ) . SetCellValue ( "总数\r\nTotal Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 15 , 16 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 15 ) . SetCellValue ( "固定口数\r\nField Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 17 , 19 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 17 ) . SetCellValue ( "Actual exam. Rate" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 20 ) . SetCellValue ( "Examination Report No." ) ;
//这里创建行数据
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 8 , rowIndex + 18 , style , 0 , 20 , true ) ;
for ( int i = 8 ; i < 16 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 ;
}
//这里循环数据
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . SetCellValue ( "小计\r\nTotal" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 0 ) . SetCellValue ( "备注\r\nRemark" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 1 , 20 ) ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 1 ) . SetCellValue ( "焊口位置与检测焊口见管道单线图与无损检测报告。\r\nPlease refer to Pipeline Iso-drawing and NDE Report for joints position and examined joints." ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 1 ) . CellStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , true , false ) ;
#endregion
#region 尾 部
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , true , false ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 18 , rowIndex + 25 , style , 0 , 20 , true ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 0 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 4 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 10 , 16 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 0 ) . SetCellValue ( "建设/监理单位\r\nOwner/Supervision Contractor" ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 4 ) . SetCellValue ( "总承包单位\r\nGeneral Contractor" ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 10 ) . SetCellValue ( "检 测 单 位\r\nExamination Contractor" ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 17 ) . SetCellValue ( "施 工 单 位\r\nConstruction Company" ) ;
ws . GetRow ( rowIndex + 18 ) . Height = 32 * 20 ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 0 ) . CellStyle = ws . GetRow ( rowIndex + 18 ) . GetCell ( 4 ) . CellStyle = ws . GetRow ( rowIndex + 18 ) . GetCell ( 10 ) . CellStyle = ws . GetRow ( rowIndex + 18 ) . GetCell ( 17 ) . CellStyle = style1 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 19 , rowIndex + 19 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 0 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . GetRow ( rowIndex + 19 ) . Height = 32 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 19 , rowIndex + 19 , 4 , 9 ) ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 4 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 19 , rowIndex + 19 , 10 , 16 ) ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 10 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 19 , rowIndex + 19 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 17 ) . SetCellValue ( "专业工程师\r\nDiscipline Engineer:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 21 , rowIndex + 21 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 17 ) . SetCellValue ( "质量检查员:\r\nQuality Inspector:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 23 , rowIndex + 23 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 23 ) . GetCell ( 17 ) . SetCellValue ( "制表:\r\nPrepared:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 0 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 4 , 9 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 4 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 10 , 16 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 10 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 17 ) . SetCellValue ( "日期Date: 年 月 日" ) ;
RegionUtil . SetBorderTop ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 0 , 20 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 18 , 0 , 20 ) , ws ) ;
RegionUtil . SetBorderLeft ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 25 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 25 , 20 , 20 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 0 , 20 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 25 , 3 , 3 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 25 , 9 , 9 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 18 , rowIndex + 25 , 16 , 16 ) , ws ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//水平垂直居中
ws . HorizontallyCenter = true ;
ws . VerticallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//24-TP-10-渗透&MT检测比例确认表
private void template24 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Right , 10 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex , style1 , 0 , 20 , true ) ;
//设置行宽度
ws . SetColumnWidth ( 0 , 13 * 256 ) ;
ws . SetColumnWidth ( 1 , 3 * 256 ) ;
ws . SetColumnWidth ( 2 , 10 * 256 ) ;
for ( int i = 3 ; i < 20 ; i + + )
{
ws . SetColumnWidth ( 1 , 3 * 256 ) ;
}
ws . SetColumnWidth ( 20 , 23 * 256 ) ;
//设置行高度
ws . GetRow ( rowIndex ) . Height = 10 * 20 ;
ws . GetRow ( rowIndex ) . GetCell ( 20 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex ) . GetCell ( 20 ) . SetCellValue ( "Form No. TP-10" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 1 , rowIndex + 2 , style , 0 , 20 , true ) ;
//设置行高度
ws . GetRow ( rowIndex + 1 ) . Height = 10 * 20 * 9 ;
ws . GetRow ( rowIndex + 2 ) . Height = 10 * 20 * 3 ;
//合并单元格和填充文本
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 0 , 2 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 0 ) . SetCellValue ( "" ) ;
var style3 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 3 , 17 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . CellStyle = style3 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . SetCellValue ( "管道焊接接头渗透/磁粉检测比例确认表(一)\nPipeline Welding Joints Penetrant/Magnetic Examination Rate Confirmation Form( I) \n共 1 页 第 1 页" ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , true , false , "Arial Unicode MS" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 18 , 20 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 18 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 18 ) . SetCellValue ( "\n 工程名称:巴斯夫(广东)一体化项目\n Project Name: BASF (Guangdong) Integrated Project\n 单元名称: Citral\n Unit Name:Citral" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 0 ) . SetCellValue ( "执行标准\nApplicable code" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 1 , 5 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 1 ) . SetCellValue ( "NB/T47013.3-2015" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 6 , 7 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 6 ) . SetCellValue ( "检测方法\nExam. Method" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 8 , 15 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 8 ) . SetCellValue ( "渗透检测\nPT" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 16 , 17 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 16 ) . SetCellValue ( "检测比例\nExam. Rate" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 18 , 20 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 18 ) . SetCellValue ( "95%" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 3 , rowIndex + 13 , style , 0 , 20 , true ) ;
//设置高度和合并列填充文本
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 4 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 0 ) . SetCellValue ( "管道编号\nPipeline No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 4 , 2 , 2 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 2 ) . SetCellValue ( "材质\nMaterial" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 4 , 3 , 4 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 3 ) . SetCellValue ( "规 格/Size\n mm" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 5 , 8 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "管道焊接接头\nWelding Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 9 ) . SetCellValue ( "施焊焊工\nWelder" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 13 , 16 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 13 ) . SetCellValue ( "检测焊接接头\nExanined Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "总数\nTotal" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 7 , 8 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 7 ) . SetCellValue ( "固定口数\nField Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 9 , 10 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 9 ) . SetCellValue ( "焊工代号\nWelder No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 11 , 12 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 11 ) . SetCellValue ( "施焊数量\nWelded Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 13 , 14 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 13 ) . SetCellValue ( "总数\nTotal Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 15 , 16 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 15 ) . SetCellValue ( "固定口数\nField Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 4 , 17 , 19 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 17 ) . SetCellValue ( "实际检测比例\nActual exam. Rate" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 4 , 20 , 20 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 20 ) . SetCellValue ( "检测报告编号\nExamination Report No." ) ;
for ( int i = 3 ; i < 14 ; i + + )
{
if ( i = = 3 | | i = = 4 )
{
ws . GetRow ( rowIndex + i ) . Height = 30 * 20 ;
continue ;
}
if ( i = = 13 )
ws . GetRow ( rowIndex + i ) . Height = 30 * 20 ;
else
ws . GetRow ( rowIndex + i ) . Height = 19 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 5 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 7 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 11 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 13 , 14 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 15 , 16 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 17 , 19 ) ) ;
}
ws . GetRow ( rowIndex + 13 ) . GetCell ( 0 ) . SetCellValue ( "小计\nTotal" ) ;
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 14 , rowIndex + 16 , style , 0 , 20 , true ) ;
//设置行高
ws . GetRow ( rowIndex + 14 ) . Height = 20 * 20 * 2 ;
ws . GetRow ( rowIndex + 15 ) . Height = 20 * 20 * 2 ;
ws . GetRow ( rowIndex + 16 ) . Height = 20 * 20 * 7 ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 0 ) . SetCellValue ( "备注\nRemark" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 14 , rowIndex + 14 , 1 , 20 ) ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 1 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 1 ) . SetCellValue ( "焊口位置与检测焊口见管道单线图与无损检测报告。\nPlease refer to Pipeline Iso-drawing and NDE Report for joints position and examined joints." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 0 ) . SetCellValue ( "建 设 / 监 理 单 位\nOwner/JianLi Company" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 4 , 9 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 4 ) . SetCellValue ( "总 承 包 单 位\nGeneral Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 10 , 16 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 10 ) . SetCellValue ( "检 测 单 位\nExamination Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 17 ) . SetCellValue ( "施 工 单 位\nConstruction Company" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . SetCellValue ( "专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 4 , 9 ) ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 4 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 4 ) . SetCellValue ( "专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 10 , 16 ) ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 10 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 10 ) . SetCellValue ( "专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 17 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 17 ) . SetCellValue ( "专业工程师\n Discipline Engineer: \n\n 质量检查员:\n Quality Inspector:\n\n 制表:\n Prepared: \n\n 日期Date: 年 月 日" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//水平垂直居中
ws . HorizontallyCenter = true ;
ws . VerticallyCenter = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
2024-06-05 08:24:19 +08:00
//24-TP-10-渗透&MT检测比例确认表
private void template25_1 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Right , 10 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex , style1 , 0 , 20 , true ) ;
//设置行宽度
ws . SetColumnWidth ( 0 , 13 * 256 ) ;
ws . SetColumnWidth ( 1 , 3 * 256 ) ;
ws . SetColumnWidth ( 2 , 10 * 256 ) ;
for ( int i = 3 ; i < 20 ; i + + )
{
ws . SetColumnWidth ( 1 , 3 * 256 ) ;
}
ws . SetColumnWidth ( 20 , 23 * 256 ) ;
//设置行高度
ws . GetRow ( rowIndex ) . Height = 10 * 20 ;
ws . GetRow ( rowIndex ) . GetCell ( 20 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex ) . GetCell ( 20 ) . SetCellValue ( "Form No. TP-10" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 1 , rowIndex + 2 , style , 0 , 20 , true ) ;
//设置行高度
ws . GetRow ( rowIndex + 1 ) . Height = 10 * 20 * 9 ;
ws . GetRow ( rowIndex + 2 ) . Height = 10 * 20 * 3 ;
//合并单元格和填充文本
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 0 , 2 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 0 ) . SetCellValue ( "" ) ;
var style3 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 3 , 17 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . CellStyle = style3 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 3 ) . SetCellValue ( "管道焊接接头PMI检测比例确认表( 一) \nPipeline Welding Joints PMI Examination Rate Confirmation Form( I) \n共 1 页 第 1 页" ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , true , false , "Arial Unicode MS" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 18 , 20 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 18 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 18 ) . SetCellValue ( "\n 工程名称:巴斯夫(广东)一体化项目\n Project Name: BASF (Guangdong) Integrated Project\n 单元名称: Citral\n Unit Name:Citral" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 0 ) . SetCellValue ( "执行标准\nApplicable code" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 1 , 5 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 1 ) . SetCellValue ( "" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 6 , 7 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 6 ) . SetCellValue ( "检测方法\nExam. Method" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 8 , 15 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 8 ) . SetCellValue ( "PMI检测" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 16 , 17 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 16 ) . SetCellValue ( "检测比例\nExam. Rate" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 18 , 20 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 18 ) . SetCellValue ( "2%" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 3 , rowIndex + 13 , style , 0 , 20 , true ) ;
//设置高度和合并列填充文本
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 4 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 0 ) . SetCellValue ( "管道编号\nPipeline No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 4 , 2 , 2 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 2 ) . SetCellValue ( "材质\nMaterial" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 4 , 3 , 4 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 3 ) . SetCellValue ( "规 格/Size\n mm" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 5 , 8 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "管道焊接接头\nWelding Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 9 , 12 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 9 ) . SetCellValue ( "施焊焊工\nWelder" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 13 , 16 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 13 ) . SetCellValue ( "检测焊接接头\nExanined Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "总数\nTotal" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 7 , 8 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 7 ) . SetCellValue ( "固定口数\nField Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 9 , 10 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 9 ) . SetCellValue ( "焊工代号\nWelder No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 11 , 12 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 11 ) . SetCellValue ( "施焊数量\nWelded Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 13 , 14 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 13 ) . SetCellValue ( "总数\nTotal Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 15 , 16 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 15 ) . SetCellValue ( "固定口数\nField Joints" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 4 , 17 , 19 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 17 ) . SetCellValue ( "实际检测比例\nActual exam. Rate" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 4 , 20 , 20 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 20 ) . SetCellValue ( "检测报告编号\nExamination Report No." ) ;
for ( int i = 3 ; i < 14 ; i + + )
{
if ( i = = 3 | | i = = 4 )
{
ws . GetRow ( rowIndex + i ) . Height = 30 * 20 ;
continue ;
}
if ( i = = 13 )
ws . GetRow ( rowIndex + i ) . Height = 30 * 20 ;
else
ws . GetRow ( rowIndex + i ) . Height = 19 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 5 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 7 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 11 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 13 , 14 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 15 , 16 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 17 , 19 ) ) ;
}
ws . GetRow ( rowIndex + 13 ) . GetCell ( 0 ) . SetCellValue ( "小计\nTotal" ) ;
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 14 , rowIndex + 16 , style , 0 , 20 , true ) ;
//设置行高
ws . GetRow ( rowIndex + 14 ) . Height = 20 * 20 * 2 ;
ws . GetRow ( rowIndex + 15 ) . Height = 20 * 20 * 2 ;
ws . GetRow ( rowIndex + 16 ) . Height = 20 * 20 * 7 ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 0 ) . SetCellValue ( "备注\nRemark" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 14 , rowIndex + 14 , 1 , 20 ) ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 1 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 1 ) . SetCellValue ( "焊口位置与检测焊口见管道单线图与无损检测报告。\nPlease refer to Pipeline Iso-drawing and NDE Report for joints position and examined joints." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 0 ) . SetCellValue ( "建 设 / 监 理 单 位\nOwner/JianLi Company" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 4 , 9 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 4 ) . SetCellValue ( "总 承 包 单 位\nGeneral Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 10 , 16 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 10 ) . SetCellValue ( "检 测 单 位\nExamination Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 15 , rowIndex + 15 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 17 ) . SetCellValue ( "施 工 单 位\nConstruction Company" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 0 , 3 ) ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . SetCellValue ( "专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 4 , 9 ) ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 4 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 4 ) . SetCellValue ( "专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 10 , 16 ) ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 10 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 10 ) . SetCellValue ( "专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: 年 月 日" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 17 , 20 ) ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 17 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 17 ) . SetCellValue ( "专业工程师\n Discipline Engineer: \n\n 质量检查员:\n Quality Inspector:\n\n 制表:\n Prepared: \n\n 日期Date: 年 月 日" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//水平垂直居中
ws . HorizontallyCenter = true ;
ws . VerticallyCenter = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
2024-05-08 16:27:28 +08:00
//25-管道无损检测结果汇总表SHT 3503-J412-2017
private void template25 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 1 , rowIndex + 3 , style , 1 , 18 , true ) ;
ws . SetColumnWidth ( 0 , 2 * 256 ) ;
ws . SetColumnWidth ( 1 , 10 * 256 ) ;
ws . SetColumnWidth ( 2 , 8 * 256 ) ;
ws . SetColumnWidth ( 3 , 8 * 256 ) ;
ws . SetColumnWidth ( 4 , 8 * 256 ) ;
ws . SetColumnWidth ( 5 , 8 * 256 ) ;
ws . SetColumnWidth ( 6 , 10 * 256 ) ;
ws . SetColumnWidth ( 7 , 8 * 256 ) ;
ws . SetColumnWidth ( 8 , 8 * 256 ) ;
ws . SetColumnWidth ( 9 , 8 * 256 ) ;
ws . SetColumnWidth ( 10 , 8 * 256 ) ;
ws . SetColumnWidth ( 11 , 10 * 256 ) ;
ws . SetColumnWidth ( 12 , 8 * 256 ) ;
ws . SetColumnWidth ( 13 , 8 * 256 ) ;
ws . SetColumnWidth ( 14 , 8 * 256 ) ;
ws . SetColumnWidth ( 15 , 10 * 256 ) ;
ws . SetColumnWidth ( 16 , 8 * 256 ) ;
ws . SetColumnWidth ( 17 , 8 * 256 ) ;
ws . SetColumnWidth ( 18 , 8 * 256 ) ;
ws . GetRow ( 1 ) . Height = 20 * 20 * 5 ;
ws . GetRow ( 2 ) . Height = 20 * 20 * 2 ;
ws . GetRow ( 3 ) . Height = 20 * 20 * 2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 1 , 5 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 1 ) . SetCellValue ( "SH/T 3503-J412-1" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 6 , 13 ) ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
style1 . WrapText = true ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 6 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 6 ) . SetCellValue ( "管道无损检测结果汇总表\nSummary of Piping NDT Results\n第 页 共 页 Page of " ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 14 , 18 ) ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , false , false , "Arial Unicode MS" ) ;
style2 . WrapText = true ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 14 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 14 ) . SetCellValue ( "工程名称:\nProject Name:\n\n\n\n单位工程名称:\nUnit Name:" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 1 ) . SetCellValue ( "Supervision Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 2 , 5 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 6 ) . SetCellValue ( "Construction Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 7 , 10 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 11 ) . SetCellValue ( "Test Criteria" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 12 , 14 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 15 ) . SetCellValue ( "Piping Class" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 16 , 18 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 1 ) . SetCellValue ( "Area No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 2 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "Test Type No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 7 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 11 , 12 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 11 ) . SetCellValue ( "Piping No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 13 , 18 ) ) ;
#endregion
#region 表 格 部 分
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 4 , rowIndex + 16 , style , 1 , 18 , true ) ;
//第一部分表格部分
ws . GetRow ( rowIndex + 4 ) . Height = 18 * 20 * 2 ;
ws . GetRow ( rowIndex + 5 ) . Height = 18 * 20 * 2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 5 , 1 , 1 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( "Test Method" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 2 , 9 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 2 ) . SetCellValue ( "Test Quantity Statistics\n(RT Unit:Weld/Film;UT/MT/PT/ Unit:Weld/Meter)" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 10 , 18 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 10 ) . SetCellValue ( "Non-conformity Statistics\n(RT Unit:Weld/Film;UT/MT/PT/ Unit:Weld/Meter)" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 2 , 3 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 2 ) . SetCellValue ( "Butt-welded Joint" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 4 , 5 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 4 ) . SetCellValue ( "Fillet-welded Joint" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 6 , 7 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 6 ) . SetCellValue ( "Branch Connection" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 8 , 9 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 8 ) . SetCellValue ( "Groove & Others" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 10 , 11 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 10 ) . SetCellValue ( "Butt-welded Joint" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 12 , 13 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 12 ) . SetCellValue ( "Fillet-welded Joint" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 14 , 15 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 14 ) . SetCellValue ( "Branch Connection" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 16 , 18 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 16 ) . SetCellValue ( "Groove & Others" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 1 ) . SetCellValue ( "RT" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 1 ) . SetCellValue ( "UT" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 1 ) . SetCellValue ( "MT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 1 ) . SetCellValue ( "PT" ) ;
for ( int i = 6 ; i < 11 ; i + + )
{
ws . GetRow ( i ) . Height = 18 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 2 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 4 , 5 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 6 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 8 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 10 , 11 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 14 , 15 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 16 , 18 ) ) ;
if ( i = = 10 )
continue ;
if ( i = = 6 | | i = = 7 )
{
ws . GetRow ( rowIndex + i ) . GetCell ( 4 ) . SetCellValue ( "-" ) ;
ws . GetRow ( rowIndex + i ) . GetCell ( 12 ) . SetCellValue ( "-" ) ;
}
else
{
ws . GetRow ( rowIndex + i ) . GetCell ( 4 ) . SetCellValue ( "/" ) ;
ws . GetRow ( rowIndex + i ) . GetCell ( 12 ) . SetCellValue ( "/" ) ;
}
ws . GetRow ( rowIndex + i ) . GetCell ( 2 ) . SetCellValue ( "/" ) ;
ws . GetRow ( rowIndex + i ) . GetCell ( 6 ) . SetCellValue ( "/" ) ;
ws . GetRow ( rowIndex + i ) . GetCell ( 8 ) . SetCellValue ( "/" ) ;
ws . GetRow ( rowIndex + i ) . GetCell ( 10 ) . SetCellValue ( "/" ) ;
ws . GetRow ( rowIndex + i ) . GetCell ( 14 ) . SetCellValue ( "/" ) ;
ws . GetRow ( rowIndex + i ) . GetCell ( 16 ) . SetCellValue ( "/" ) ;
}
//第二部分表格部分
ws . GetRow ( rowIndex + 11 ) . Height = 20 * 20 * 3 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 11 , rowIndex + 11 , 1 , 2 ) ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 1 ) . SetCellValue ( "Line No." ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 3 ) . SetCellValue ( "weld No." ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 4 ) . SetCellValue ( "Welder's Stamp No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 11 , rowIndex + 11 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 5 ) . SetCellValue ( "Test Lot No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 11 , rowIndex + 11 , 7 , 8 ) ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 7 ) . SetCellValue ( "RT/UT Result" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 11 , rowIndex + 11 , 9 , 10 ) ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 9 ) . SetCellValue ( "Report No." ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 11 ) . SetCellValue ( "MT/PT Result" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 11 , rowIndex + 11 , 12 , 13 ) ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 12 ) . SetCellValue ( "Report No." ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 14 ) . SetCellValue ( "Result" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 11 , rowIndex + 11 , 15 , 16 ) ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 15 ) . SetCellValue ( "Report No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 11 , rowIndex + 11 , 17 , 18 ) ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 17 ) . SetCellValue ( "Remarks" ) ;
for ( int i = 12 ; i < 17 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 18 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 1 , 2 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 5 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 7 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 9 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 12 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 15 , 16 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 17 , 18 ) ) ;
}
#endregion
#region 尾 部
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 17 , rowIndex + 17 , style , 1 , 18 , true ) ;
ws . GetRow ( rowIndex + 17 ) . Height = 20 * 20 * 5 ;
var setStyle2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , false , false , "Arial Unicode MS" ) ;
setStyle2 . WrapText = true ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 1 ) . CellStyle = ws . GetRow ( rowIndex + 17 ) . GetCell ( 7 ) . CellStyle = ws . GetRow ( rowIndex + 17 ) . GetCell ( 13 ) . CellStyle = setStyle2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 1 , 6 ) ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 1 ) . SetCellValue ( " Responsible Inspector:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 7 , 12 ) ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 7 ) . SetCellValue ( " Technical Superintendent:\n\n\n\n\n Quality Superintendent:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 17 , rowIndex + 17 , 13 , 18 ) ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 13 ) . SetCellValue ( " Inspection Agency: (Seal)\n\n\n\n\n Date:" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//26-管道无损检测数量统计表SHT 3503-J413-2017
private void template26 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 1 , rowIndex + 6 , style , 1 , 23 , true ) ;
ws . SetColumnWidth ( 0 , 2 * 256 ) ;
ws . SetColumnWidth ( 1 , 9 * 256 ) ;
ws . SetColumnWidth ( 2 , 3 * 256 ) ;
ws . SetColumnWidth ( 3 , 11 * 256 ) ;
ws . SetColumnWidth ( 4 , 3 * 256 ) ;
ws . SetColumnWidth ( 5 , 9 * 256 ) ;
ws . SetColumnWidth ( 6 , 2 * 256 ) ;
ws . SetColumnWidth ( 7 , 5 * 256 ) ;
ws . SetColumnWidth ( 8 , 5 * 256 ) ;
ws . SetColumnWidth ( 9 , 5 * 256 ) ;
ws . SetColumnWidth ( 10 , 5 * 256 ) ;
ws . SetColumnWidth ( 11 , 5 * 256 ) ;
ws . SetColumnWidth ( 12 , 5 * 256 ) ;
ws . SetColumnWidth ( 13 , 5 * 256 ) ;
ws . SetColumnWidth ( 14 , 5 * 256 ) ;
ws . SetColumnWidth ( 15 , 5 * 256 ) ;
ws . SetColumnWidth ( 16 , 5 * 256 ) ;
ws . SetColumnWidth ( 17 , 5 * 256 ) ;
ws . SetColumnWidth ( 18 , 5 * 256 ) ;
ws . SetColumnWidth ( 19 , 5 * 256 ) ;
ws . SetColumnWidth ( 20 , 5 * 256 ) ;
ws . SetColumnWidth ( 21 , 5 * 256 ) ;
ws . SetColumnWidth ( 22 , 5 * 256 ) ;
ws . SetColumnWidth ( 23 , 9 * 256 ) ;
for ( int i = 1 ; i < 6 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 ;
}
ws . GetRow ( rowIndex + 6 ) . Height = 40 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 5 , 1 , 3 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 1 ) . SetCellValue ( "SH/T 3503-J413-1" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 5 , 4 , 16 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 4 ) . SetCellValue ( "管道无损检测数量统计表 ;\n Piping NDT Quantity Statistical From ;\n 第 页 共 页 Page of " ) ;
var setStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 4 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 5 , 17 , 23 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 17 ) . SetCellValue ( "工程名称: \n Projeck Name: \n \n \n 单位工程名称:\n Unit Name: " ) ;
var setStyle1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , false , false , "Arial Unicode MS" ) ;
setStyle1 . WrapText = true ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 17 ) . CellStyle = setStyle1 ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 1 ) . SetCellValue ( "Area No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 2 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 4 , 5 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 4 ) . SetCellValue ( "Test Type No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 6 , 11 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 12 , 14 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 12 ) . SetCellValue ( "Acceptance Criteria" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 15 , 18 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 19 , 20 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 19 ) . SetCellValue ( "Test Criteria" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 21 , 23 ) ) ;
#endregion
#region 表 格 部 分
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 7 , rowIndex + 18 , style , 1 , 23 , true ) ;
ws . GetRow ( rowIndex + 7 ) . Height = 30 * 20 ;
ws . GetRow ( rowIndex + 8 ) . Height = 40 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 9 , 1 , 2 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 1 ) . SetCellValue ( "Piping No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 9 , 3 , 4 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 3 ) . SetCellValue ( "Included Line No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 9 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 5 ) . SetCellValue ( "Test Percentage" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 7 , 22 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 7 ) . SetCellValue ( "Qualified Quantity" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 8 , 23 , 23 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 23 ) . SetCellValue ( "Remarks" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 8 , rowIndex + 8 , 7 , 11 ) ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 7 ) . SetCellValue ( "Butt-welded Joint" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 8 , rowIndex + 8 , 12 , 14 ) ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 12 ) . SetCellValue ( "Fillet-welded Joint" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 8 , rowIndex + 8 , 15 , 19 ) ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 15 ) . SetCellValue ( "Branch Connection" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 8 , rowIndex + 8 , 20 , 22 ) ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 20 ) . SetCellValue ( "Groove & Others" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 7 ) . SetCellValue ( "Total" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 8 ) . SetCellValue ( "RT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . SetCellValue ( "UT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 10 ) . SetCellValue ( "MT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 11 ) . SetCellValue ( "PT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 12 ) . SetCellValue ( "Total" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 13 ) . SetCellValue ( "MT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 14 ) . SetCellValue ( "PT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 15 ) . SetCellValue ( "Total" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 16 ) . SetCellValue ( "RT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 17 ) . SetCellValue ( "UT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 18 ) . SetCellValue ( "MT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 19 ) . SetCellValue ( "PT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 20 ) . SetCellValue ( "Total" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 21 ) . SetCellValue ( "MT" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 22 ) . SetCellValue ( "PT" ) ;
for ( int i = 10 ; i < 19 ; i + + )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 1 , 2 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 ;
}
#endregion
#region 尾 部
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 19 , rowIndex + 20 , style , 1 , 23 , true ) ;
ws . GetRow ( rowIndex + 19 ) . Height = 30 * 20 ;
ws . GetRow ( rowIndex + 20 ) . Height = 20 * 20 * 7 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 19 , rowIndex + 19 , 1 , 7 ) ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 1 ) . SetCellValue ( "Owner/Supervision Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 19 , rowIndex + 19 , 8 , 15 ) ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 8 ) . SetCellValue ( "General Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 19 , rowIndex + 19 , 16 , 23 ) ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 16 ) . SetCellValue ( "Construction Contractor" ) ;
var setStyle2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , false , false , "Arial Unicode MS" ) ;
setStyle2 . WrapText = true ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 1 ) . CellStyle = ws . GetRow ( rowIndex + 20 ) . GetCell ( 8 ) . CellStyle = ws . GetRow ( rowIndex + 20 ) . GetCell ( 16 ) . CellStyle = setStyle2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 20 , rowIndex + 20 , 1 , 7 ) ) ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 1 ) . SetCellValue ( " Discipline Engineer: \n \n \n \n \n \n \n \n Date:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 20 , rowIndex + 20 , 8 , 15 ) ) ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 8 ) . SetCellValue ( " Discipline Engineer: \n \n \n \n \n \n \n \n Date:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 20 , rowIndex + 20 , 16 , 23 ) ) ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 16 ) . SetCellValue ( " Quality Inspector: \n \n Discipline Engineer: \n \n From Prepared by: \n \n \n \n Date:" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//27-TP-11-尾项清单UG-FW-001
private void template27 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
//插入图片部分
var img1 = Server . MapPath ( "~/res/images/bsf/1.png" ) ;
var img2 = Server . MapPath ( "~/res/images/bsf/2.png" ) ;
var img3 = Server . MapPath ( "~/res/images/bsf/3.png" ) ;
var img4 = Server . MapPath ( "~/res/images/bsf/4.png" ) ;
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , false , "Arial Unicode MS" ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 12 , true , false , "Arial Unicode MS" ) ;
var style3 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 16 , true , true , "Arial Unicode MS" ) ;
var style4 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 24 , true , true , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 7 , style , 0 , 24 , true ) ;
//设置行高和列宽
for ( int i = 0 ; i < 23 ; i + + )
{
ws . SetColumnWidth ( i , 7 * 256 ) ;
}
ws . SetColumnWidth ( 23 , 6 * 256 ) ;
ws . SetColumnWidth ( 24 , 6 * 256 ) ;
ws . GetRow ( rowIndex ) . Height = 10 * 20 ;
ws . GetRow ( rowIndex + 1 ) . Height = 10 * 20 * 5 ;
ws . GetRow ( rowIndex + 2 ) . Height = 8 * 20 ;
ws . GetRow ( rowIndex + 3 ) . Height = 10 * 20 * 4 ;
ws . GetRow ( rowIndex + 4 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 5 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 6 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 7 ) . Height = 35 * 20 ;
//合并单元格和填充文本
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex , rowIndex , 22 , 24 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 22 ) . SetCellValue ( "Form No. TP-11" ) ;
ws . GetRow ( rowIndex ) . GetCell ( 22 ) . CellStyle = style1 ;
//画线
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex , rowIndex , 0 , 24 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 6 , 18 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 6 ) . SetCellValue ( "巴斯夫(广东)一体化项目\nBASF (Guangdong) Integrated Project" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 6 ) . CellStyle = style3 ;
//画线
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 0 , 24 ) , ws ) ;
//画线
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 0 , 24 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 6 , 3 , 15 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 3 ) . SetCellValue ( "PUNCH LIST\n尾项清单" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 3 ) . CellStyle = style4 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 16 , 18 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 16 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 16 ) . SetCellValue ( "项目/PROJECT" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 19 , 24 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 19 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 19 ) . SetCellValue ( "巴斯夫(广东)一体化项目\nBASF (Guangdong) Integrated Project" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 16 , 18 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 16 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 16 ) . SetCellValue ( "区域/AREA" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 19 , 24 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 19 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 19 ) . SetCellValue ( "C400/D400" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 6 , 16 , 18 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 16 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 16 ) . SetCellValue ( "试压包号/TEST PACKAGE No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 6 , 19 , 24 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 19 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 19 ) . SetCellValue ( "UG-130-FW-HT-001" ) ;
//画线
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 0 , 24 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 16 , 24 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 16 , 24 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 3 , rowIndex + 6 , 18 , 18 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 3 , rowIndex + 6 , 15 , 15 ) , ws ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 0 , 2 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 0 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 0 ) . SetCellValue ( "系统号\nSYSTEM No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 3 , 15 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 3 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 3 ) . SetCellValue ( "UG" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 16 , 18 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 16 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 16 ) . SetCellValue ( "子系统号\nSUB-SYSTEM No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 19 , 24 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 19 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 19 ) . SetCellValue ( "FW" ) ;
//画线
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 2 , 2 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 15 , 15 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 18 , 18 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 0 , 24 ) , ws ) ;
//插入图片
InsertImage ( hssfworkbook , ws , rowIndex + 1 , 1 , rowIndex + 1 , 2 , img1 , 1.8 , 1 ) ;
InsertImage ( hssfworkbook , ws , rowIndex + 1 , 4 , rowIndex + 1 , 5 , img2 , 1.8 , 1 , 0 , 1 ) ;
InsertImage ( hssfworkbook , ws , rowIndex + 1 , 19 , rowIndex + 1 , 20 , img3 , 1.8 , 0.7 , 0 , 10 ) ;
InsertImage ( hssfworkbook , ws , rowIndex + 1 , 21 , rowIndex + 1 , 23 , img4 , 1.2 , 0.9 , 0 , 5 ) ;
#endregion
#region 表 格 部 分
var style5 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 8 , rowIndex + 25 , style5 , 0 , 24 , true ) ;
//设置行高
ws . GetRow ( rowIndex + 8 ) . Height = 10 * 20 * 3 ;
ws . GetRow ( rowIndex + 9 ) . Height = 30 * 20 ;
ws . GetRow ( rowIndex + 10 ) . Height = 10 * 20 * 4 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 8 , rowIndex + 10 , 0 , 0 ) ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 0 ) . SetCellValue ( "序号\nS/N" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 8 , rowIndex + 10 , 1 , 5 ) ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 1 ) . SetCellValue ( "图纸号\nDrawing No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 8 , rowIndex + 10 , 6 , 6 ) ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 6 ) . SetCellValue ( "版本\nRev No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 8 , rowIndex + 10 , 7 , 15 ) ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 7 ) . SetCellValue ( "尾项描述\nPunch Description" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 8 , rowIndex + 10 , 16 , 16 ) ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 16 ) . SetCellValue ( "尾项类别\n* Punch Category" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 8 , rowIndex + 9 , 17 , 18 ) ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 17 ) . SetCellValue ( "提出人\nOriginator" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 17 ) . SetCellValue ( "姓名\nName" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 18 ) . SetCellValue ( "单位\nCompany" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 8 , rowIndex + 8 , 19 , 24 ) ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 19 ) . SetCellValue ( "尾项关闭\nRemedial Acceptance and Signature" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 9 , rowIndex + 9 , 19 , 20 ) ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 19 ) . SetCellValue ( "CC7" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 9 , rowIndex + 9 , 21 , 22 ) ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 21 ) . SetCellValue ( "Worley/BASF" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 19 ) . SetCellValue ( "签名\nSign" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 20 ) . SetCellValue ( "日期Date" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 21 ) . SetCellValue ( "签名\nSign" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 22 ) . SetCellValue ( "日期Date" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 9 , rowIndex + 10 , 23 , 24 ) ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 23 ) . SetCellValue ( "Remark" ) ;
for ( int i = 11 ; i < 26 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 1 , 5 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 7 , 15 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 23 , 24 ) ) ;
}
#endregion
#region 尾 部
var style6 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 8 , false , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 26 , rowIndex + 30 , style6 , 0 , 24 , true ) ;
ws . GetRow ( rowIndex + 26 ) . Height = 8 * 20 ;
for ( int i = 27 ; i < 31 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 10 * 20 ;
}
ws . GetRow ( rowIndex + 27 ) . GetCell ( 0 ) . SetCellValue ( "LEGEND" ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 1 ) . SetCellValue ( " N.A.: Not Applicable" ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 10 ) . SetCellValue ( "*PUNCH CATEGORY:" ) ;
ws . GetRow ( rowIndex + 28 ) . GetCell ( 11 ) . SetCellValue ( "A - PUNCH ITEM MUST BE COMPLETED BEFORE TESTING." ) ;
ws . GetRow ( rowIndex + 29 ) . GetCell ( 11 ) . SetCellValue ( "B - PUNCH ITEM TO BE COMPLETED AFTER TESTING BUT SHALL BE COMPLETED PRIOR TO SYSTEM TURN-OVER" ) ;
ws . GetRow ( rowIndex + 30 ) . GetCell ( 11 ) . SetCellValue ( "C - PUNCH ITEM TO BE COMPLETED AFTER SYSTEM TURNOVER." ) ;
//划线
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex , rowIndex + 25 , 24 , 24 ) , ws ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//横向打印
ws . PrintSetup . Landscape = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//28-TP-12-试压用水( 工具) 检查清单UG-FW-001
private void template28 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
//插入图片部分
var img1 = Server . MapPath ( "~/res/images/bsf/1.png" ) ;
var img2 = Server . MapPath ( "~/res/images/bsf/2.png" ) ;
var img3 = Server . MapPath ( "~/res/images/bsf/3.png" ) ;
var img4 = Server . MapPath ( "~/res/images/bsf/4.png" ) ;
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 14 , style , 0 , 17 , true ) ;
ws . GetRow ( rowIndex ) . GetCell ( 15 ) . SetCellValue ( "Form No." ) ;
ws . GetRow ( rowIndex ) . GetCell ( 16 ) . SetCellValue ( "TP-06" ) ;
//设置列宽度
ws . SetColumnWidth ( 0 , 2 * 256 ) ;
ws . SetColumnWidth ( 1 , 1 * 256 ) ;
ws . SetColumnWidth ( 2 , 8 * 256 ) ;
ws . SetColumnWidth ( 3 , 5 * 256 ) ;
ws . SetColumnWidth ( 4 , 5 * 256 ) ;
ws . SetColumnWidth ( 5 , 8 * 256 ) ;
ws . SetColumnWidth ( 6 , 8 * 256 ) ;
ws . SetColumnWidth ( 7 , 10 * 256 ) ;
ws . SetColumnWidth ( 8 , 10 * 256 ) ;
ws . SetColumnWidth ( 9 , 11 * 256 ) ;
ws . SetColumnWidth ( 10 , 9 * 256 ) ;
ws . SetColumnWidth ( 11 , 8 * 256 ) ;
ws . SetColumnWidth ( 12 , 1 * 256 ) ;
ws . SetColumnWidth ( 13 , 9 * 256 ) ;
ws . SetColumnWidth ( 14 , 9 * 256 ) ;
ws . SetColumnWidth ( 15 , 9 * 256 ) ;
ws . SetColumnWidth ( 16 , 8 * 256 ) ;
ws . SetColumnWidth ( 17 , 1 * 256 ) ;
//设置前3行高度
ws . GetRow ( 0 ) . Height = 15 * 20 ;
ws . GetRow ( 1 ) . Height = 15 * 20 ;
ws . GetRow ( 2 ) . Height = 14 * 20 ;
//设置3-15行的行高度
for ( int i = 3 ; i < 15 ; i + + )
{
ws . GetRow ( i ) . Height = 18 * 20 ;
}
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 0 , 0 , 1 , 1 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 1 , 1 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 16 , 16 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 1 , 1 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderTop ( 2 , new CellRangeAddress ( 2 , 2 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 1 , 14 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 1 , 1 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 16 , 16 ) , ws ) ;
RegionUtil . SetBorderRight ( 2 , new CellRangeAddress ( 2 , 14 , 17 , 17 ) , ws ) ;
RegionUtil . SetBorderLeft ( 2 , new CellRangeAddress ( 9 , 14 , 2 , 2 ) , ws ) ;
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 7 , 7 , 2 , 16 ) , ws ) ;
RegionUtil . SetBorderBottom ( 2 , new CellRangeAddress ( 8 , 8 , 2 , 16 ) , ws ) ;
//插入图片
InsertImage ( hssfworkbook , ws , 3 , 2 , 4 , 3 , img1 , 1.2 , 1.8 ) ;
InsertImage ( hssfworkbook , ws , 3 , 3 , 4 , 4 , img2 , 1.9 , 1.9 ) ;
InsertImage ( hssfworkbook , ws , 3 , 13 , 4 , 14 , img3 , 1.5 , 1.5 ) ;
InsertImage ( hssfworkbook , ws , 3 , 15 , 4 , 16 , img4 , 1.5 , 1.5 ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "巴斯夫(广东)一体化项目" ) ;
var setStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . SetCellValue ( "BASF (GUANGDONG) INTEGRATED PROJECT" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 5 , rowIndex + 5 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . SetCellValue ( "试压用水(工具)检查清单" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 6 , rowIndex + 6 , 5 , 13 ) ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . SetCellValue ( "WATER(MACHINE) CALIBREATION LIST" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 5 ) . CellStyle = setStyle ;
var cellStyle2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 11 , false , false , "Arial Unicode MS" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . SetCellValue ( "Test Package No" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 5 ) . SetCellValue ( "UG-130-FW-HT-001" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 5 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . SetCellValue ( "Area" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 13 ) . SetCellValue ( "C400" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 2 ) . SetCellValue ( "试压包号" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 9 ) . SetCellValue ( "区域" ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 2 ) . SetCellValue ( "System No" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 5 ) . SetCellValue ( "FIRE WATER" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 5 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 9 ) . SetCellValue ( "Test Pressure" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 13 ) . SetCellValue ( "2" ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 13 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . SetCellValue ( "系统号" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 2 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . SetCellValue ( "试验压力" ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 9 ) . SetCellValue ( "Test Type" ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 13 ) . SetCellValue ( "Hydro Test" ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 13 ) . CellStyle = cellStyle2 ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 9 ) . SetCellValue ( "试验方式" ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 9 ) . CellStyle = cellStyle2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 5 , 13 ) ) ;
#endregion
#region 表 格 部 分
style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 11 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , 15 , rowIndex + 49 , style , 0 , 17 , true ) ;
for ( int i = 15 ; i < 50 ; i + + )
{
ws . GetRow ( i ) . Height = 25 * 20 ;
ws . GetRow ( i ) . GetCell ( 0 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None ) ;
ws . GetRow ( i ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 3 , 5 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 6 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 9 , 12 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 13 , 14 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 15 , 16 ) ) ;
}
ws . GetRow ( 15 ) . Height = 30 * 20 ;
//数据表头部分
ws . GetRow ( rowIndex + 15 ) . GetCell ( 2 ) . SetCellValue ( "No\r\n序号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 3 ) . SetCellValue ( "Report Name\r\n报告名称" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 6 ) . SetCellValue ( "Report No.\r\n报告编号" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 9 ) . SetCellValue ( "Date of Issue report\r\n报告出具日期" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 13 ) . SetCellValue ( "Expiry Date\r\n有效期" ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 15 ) . SetCellValue ( "Remark\r\n备注" ) ;
#endregion
#region 尾 部
//此处的尾部行数需要根据 得到的动态数据量 来计算, 默认写死从50行开始。
ws = ExcelCreateRow ( ws , hssfworkbook , 49 , rowIndex + 55 , style , 0 , 17 , true ) ;
for ( int i = 49 ; i < = 55 ; i + + )
{
ws . GetRow ( i ) . Height = 18 * 20 ;
ws . GetRow ( i ) . GetCell ( 0 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . Medium ) ;
ws . GetRow ( i ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium ) ;
}
for ( int i = 2 ; i < 17 ; i + + )
{
ws . GetRow ( rowIndex + 55 ) . GetCell ( i ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None , BorderStyle . None ) ;
}
ws . GetRow ( rowIndex + 55 ) . GetCell ( 1 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None ) ;
ws . GetRow ( rowIndex + 55 ) . GetCell ( 16 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . Medium , BorderStyle . Medium , BorderStyle . None , BorderStyle . None ) ;
ws . GetRow ( rowIndex + 55 ) . GetCell ( 17 ) . CellStyle = SetStyle ( hssfworkbook , BorderStyle . None , BorderStyle . Medium , BorderStyle . None , BorderStyle . Medium ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 2 , 4 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 5 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 7 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 10 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 50 , rowIndex + 52 , 14 , 16 ) ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 2 , 4 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 2 ) . SetCellValue ( "PREPARED" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 53 , 5 , 6 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 5 ) . SetCellValue ( "REVIEW" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 7 , 9 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 7 ) . SetCellValue ( "JIANLI" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 10 , 13 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 10 ) . SetCellValue ( "Worley" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 53 , rowIndex + 54 , 14 , 16 ) ) ;
ws . GetRow ( rowIndex + 53 ) . GetCell ( 14 ) . SetCellValue ( "BASF" ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 54 , rowIndex + 54 , 2 , 6 ) ) ;
ws . GetRow ( rowIndex + 54 ) . GetCell ( 2 ) . SetCellValue ( "CC7" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//32-管道系统压力试验记录SHT 3503-J406-2
private void template32 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 2 , style , 0 , 8 , true ) ;
//设置行高度
ws . GetRow ( rowIndex ) . Height = 20 * 20 * 6 ;
ws . GetRow ( rowIndex + 1 ) . Height = 20 * 20 * 2 ;
ws . GetRow ( rowIndex + 2 ) . Height = 20 * 20 * 2 ;
//设置列宽度
ws . SetColumnWidth ( 0 , 24 * 256 ) ;
ws . SetColumnWidth ( 1 , 9 * 256 ) ;
ws . SetColumnWidth ( 2 , 9 * 256 ) ;
ws . SetColumnWidth ( 3 , 9 * 256 ) ;
ws . SetColumnWidth ( 4 , 9 * 256 ) ;
ws . SetColumnWidth ( 5 , 9 * 256 ) ;
ws . SetColumnWidth ( 6 , 9 * 256 ) ;
ws . SetColumnWidth ( 7 , 9 * 256 ) ;
ws . SetColumnWidth ( 8 , 9 * 256 ) ;
//合并单元格和填充文本
ws . GetRow ( rowIndex ) . GetCell ( 0 ) . SetCellValue ( "SH/T 3503—J406-2" ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
style1 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex , rowIndex , 1 , 5 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 1 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex ) . GetCell ( 1 ) . SetCellValue ( "管道系统压力试验记录\nPiping System Pressure Test Record" ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , true , false , "Arial Unicode MS" ) ;
style2 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex , rowIndex , 6 , 8 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 6 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex ) . GetCell ( 6 ) . SetCellValue ( " 项目名称:\n Project Name: \n\n\n\n 单位名称:\n Unit Name:" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 0 ) . SetCellValue ( "系统名称\nSystem Description" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 1 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 4 , 5 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 4 ) . SetCellValue ( "系统编号\nSystem No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 1 , 6 , 8 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 2 , rowIndex + 2 , 0 , 8 ) ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 0 ) . SetCellValue ( "试验记录\nTest Record" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 3 , rowIndex + 15 , style , 0 , 8 , true ) ;
//设置行高
ws . GetRow ( rowIndex + 3 ) . Height = 20 * 20 * 5 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 0 ) . SetCellValue ( "管道编号/单线号\nPiping No./ Line No." ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 2 ) . SetCellValue ( "设计压力\nDesign Pressure Mpa" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 3 ) . SetCellValue ( "设计温度\nDesign Temperature ℃" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 4 ) . SetCellValue ( "试验环境温度\nTest Ambient Temperature ℃" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "试验介质\nTest Medium" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 6 ) . SetCellValue ( "试验介质温度\nTest Medium Temperature ℃" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 7 ) . SetCellValue ( "试验压力\nTest Pressure Mpa" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 8 ) . SetCellValue ( "稳压时间\nHolding Time min" ) ;
for ( int i = 4 ; i < 16 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 38 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
}
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 16 , rowIndex + 18 , style , 0 , 8 , true ) ;
//设置行高
ws . GetRow ( rowIndex + 16 ) . Height = 50 * 20 ;
ws . GetRow ( rowIndex + 17 ) . Height = 50 * 20 ;
ws . GetRow ( rowIndex + 18 ) . Height = 150 * 20 ;
//合并单元格填充文本数据
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 16 , rowIndex + 16 , 0 , 8 ) ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . SetCellValue ( "试验结论:\nConclusion" ) ;
for ( int i = 17 ; i < 19 ; i + + )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 2 , 5 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 6 , 8 ) ) ;
}
ws . GetRow ( rowIndex + 17 ) . GetCell ( 0 ) . SetCellValue ( "建设/监理单位\nOwner/Construction Supervision Contractor" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 2 ) . SetCellValue ( "总承包单位\nGeneral Contractor" ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 6 ) . SetCellValue ( "施工单位\nConstruction Company" ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 0 ) . SetCellValue ( " 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: " ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 2 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 2 ) . SetCellValue ( " 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: " ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 6 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 6 ) . SetCellValue ( " 专业工程师\n Discipline Engineer: \n\n 质量检查员:\n Quality Inspector:\n\n 班(组)长:\n Leader:\n\n 日期Date: " ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//33-管道吹扫清洗记录SHT 3503-J408 UG-FW-001
private void template33 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 7 , style , 0 , 6 , true ) ;
//设置头部行高
ws . GetRow ( rowIndex ) . Height = 20 * 20 * 5 ;
ws . GetRow ( rowIndex + 1 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 2 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 3 ) . Height = 20 * 20 * 2 ;
ws . GetRow ( rowIndex + 4 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 5 ) . Height = 20 * 20 * 2 ;
ws . GetRow ( rowIndex + 6 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 7 ) . Height = 20 * 20 * 2 ;
//设置列宽
ws . SetColumnWidth ( 0 , 24 * 256 ) ;
ws . SetColumnWidth ( 1 , 9 * 256 ) ;
ws . SetColumnWidth ( 2 , 14 * 256 ) ;
ws . SetColumnWidth ( 3 , 19 * 256 ) ;
ws . SetColumnWidth ( 4 , 14 * 256 ) ;
ws . SetColumnWidth ( 5 , 5 * 256 ) ;
ws . SetColumnWidth ( 6 , 9 * 256 ) ;
//合并单元格和填充单元格值
for ( int i = 0 ; i < 3 ; i + + )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 2 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 4 , 6 ) ) ;
}
ws . GetRow ( rowIndex ) . GetCell ( 0 ) . SetCellValue ( "SH/T 3503-J408" ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
style1 . WrapText = true ;
ws . GetRow ( rowIndex ) . GetCell ( 2 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex ) . GetCell ( 2 ) . SetCellValue ( "管道吹扫/清洗检验记录(I)\nPipline Flushing and Blowing Inspection Record(I)" ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , true , false , "Arial Unicode MS" ) ;
style2 . WrapText = true ;
ws . GetRow ( rowIndex ) . GetCell ( 4 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex ) . GetCell ( 4 ) . SetCellValue ( " 项目名称:巴斯夫(广东)一体化项目\n Project Name: BASF (Guangdong) Integrated Project\n\n\n\n 单位名称: Citral\n Unit Name:Citral" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 0 ) . SetCellValue ( "子系统名称 Subsystem Name" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 2 ) . SetCellValue ( "子系统编号 Subsystem No." ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 4 ) . SetCellValue ( "试压包号 Test Package No." ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 0 ) . SetCellValue ( "Fire Water" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 2 ) . SetCellValue ( "UG-FW" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 4 ) . SetCellValue ( "UG-130-FW-HT-001" ) ;
for ( int i = 3 ; i < 8 ; i + + )
{
if ( i = = 3 | | i = = 5 | | i = = 7 )
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 * 2 ;
else
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 5 ) ) ;
}
ws . GetRow ( rowIndex + 3 ) . GetCell ( 0 ) . SetCellValue ( "检查项目及要求\nInspection items and requirements" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 6 ) . SetCellValue ( "检查结果\nResult" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . SetCellValue ( "管线压力试验检查合格。Pipeline pressure test is acceptable." ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 0 ) . SetCellValue ( "与吹扫及清洗无关的安全附件和仪表元件已经拆除或按要求隔离。Safety attachments and instruments not involved in purging and cleaning have been dismantled or isolated as per requirement." ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 0 ) . SetCellValue ( "管线系统内阀门已按要求开启。All piping system valves have been opened." ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 0 ) . SetCellValue ( "不锈钢管线系统清洗用水应符合规范要求。Test use water of stainless steel pipeline shall be in compliance with specification." ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 8 , rowIndex + 24 , style , 0 , 6 , true ) ;
//循环合并单元格和设置行高
for ( int i = 8 ; i < 25 ; i + + )
{
if ( i = = 8 )
ws . GetRow ( rowIndex + i ) . Height = 30 * 20 ;
else
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 5 , 6 ) ) ;
}
ws . GetRow ( rowIndex + 8 ) . GetCell ( 0 ) . SetCellValue ( "管道编号\nPipeline No." ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 2 ) . SetCellValue ( "管线材质\nMaterial" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 3 ) . SetCellValue ( "操作介质\nOperation Medium" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 4 ) . SetCellValue ( "吹扫介质\nBlowing Meadium" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 5 ) . SetCellValue ( "清洗介质\nFlushing Medium" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 0 ) . SetCellValue ( "1701-130-9062.058-0000" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . SetCellValue ( "A53-B" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 3 ) . SetCellValue ( "Fire Water" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 4 ) . SetCellValue ( "Air" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 5 ) . SetCellValue ( "Water" ) ;
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 25 , rowIndex + 27 , style , 0 , 6 , true ) ;
//设置行高度
ws . GetRow ( rowIndex + 25 ) . Height = 20 * 20 * 3 ;
ws . GetRow ( rowIndex + 26 ) . Height = 20 * 20 * 3 ;
ws . GetRow ( rowIndex + 27 ) . Height = 20 * 20 * 7 ;
//合并单元格合和填充值
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 0 , 6 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 0 ) . SetCellValue ( "检验方法及结果:\nInspection method and conclusion:" ) ;
for ( int i = 26 ; i < 28 ; i + + )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 2 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 4 , 6 ) ) ;
}
ws . GetRow ( rowIndex + 26 ) . GetCell ( 0 ) . SetCellValue ( "建设/监理单位\nOwner/Construction Supervision Contractor" ) ;
ws . GetRow ( rowIndex + 26 ) . GetCell ( 2 ) . SetCellValue ( "总承包单位\nGeneral Contractor" ) ;
ws . GetRow ( rowIndex + 26 ) . GetCell ( 4 ) . SetCellValue ( "施工单位\nConstruction Company" ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 0 ) . SetCellValue ( " 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: " ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 2 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 2 ) . SetCellValue ( " 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: " ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 4 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 4 ) . SetCellValue ( " 专业工程师\n Discipline Engineer: \n\n 质量检查员:\n Quality Inspector:\n\n 班(组)长:\n Leader:\n\n 日期Date: " ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//34-管道系统压力试验条件确认记录SHT 3503-J406-1
private void template34 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 5 , style , 0 , 8 , true ) ;
//循环设置表头高度
for ( int i = 0 ; i < 6 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 ;
}
//设置每列的宽度
ws . SetColumnWidth ( 0 , 19 * 256 ) ;
ws . SetColumnWidth ( 1 , 9 * 256 ) ;
ws . SetColumnWidth ( 2 , 9 * 256 ) ;
ws . SetColumnWidth ( 3 , 9 * 256 ) ;
ws . SetColumnWidth ( 4 , 9 * 256 ) ;
ws . SetColumnWidth ( 5 , 9 * 256 ) ;
ws . SetColumnWidth ( 6 , 9 * 256 ) ;
ws . SetColumnWidth ( 7 , 9 * 256 ) ;
ws . SetColumnWidth ( 8 , 9 * 256 ) ;
//合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex , rowIndex + 3 , 0 , 0 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 0 ) . SetCellValue ( "SH/T 3503—J406-1" ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 14 , true , true , "Arial Unicode MS" ) ;
style1 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex , rowIndex + 3 , 1 , 5 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 1 ) . CellStyle = style1 ;
ws . GetRow ( rowIndex ) . GetCell ( 1 ) . SetCellValue ( "管道系统压力试验条件确认记录\nPiping System Pressure Test Condition Confirmation Record" ) ;
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , true , false , "Arial Unicode MS" ) ;
style2 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex , rowIndex + 3 , 6 , 8 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 6 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex ) . GetCell ( 6 ) . SetCellValue ( " 工程名称:\n Project Name:\n\n 单位工程名称:\n Unit Name:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 5 , 0 , 0 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . SetCellValue ( "系统名称\nSystem Description" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 5 , 1 , 3 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( "" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 5 , 4 , 5 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 4 ) . SetCellValue ( "系统编号\nSystem No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 5 , 6 , 8 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 6 ) . SetCellValue ( "" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 6 , rowIndex + 19 , style , 0 , 8 , true ) ;
//循环设置高度和合并单元格
for ( int i = 6 ; i < 20 ; i + + )
{
if ( i = = 13 )
ws . GetRow ( rowIndex + i ) . Height = 43 * 20 ;
else
ws . GetRow ( rowIndex + i ) . Height = 42 * 20 ;
if ( i = = 6 )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 0 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 8 , 8 ) ) ;
continue ;
}
if ( i = = 7 )
continue ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 7 ) ) ;
}
ws . GetRow ( rowIndex + 6 ) . GetCell ( 0 ) . SetCellValue ( "检查项目与要求\nInspection Item and Requirement" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 8 ) . SetCellValue ( "检查结果\nInspection Result" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 0 ) . SetCellValue ( "管道安装符合最新设计文件和规范要求。Pipe installation must be in compliance with latest design documents and specification." ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 0 ) . SetCellValue ( "管道组成件复验合格。Pipline components have been re-inspected and are accepatble." ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 0 ) . SetCellValue ( "焊接工作记录齐全。Welders complete operation records are available." ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 0 ) . SetCellValue ( "无损检测符合设计文件和规范要求。NDE results must be in compliance with design document and specification." ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 0 ) . SetCellValue ( "热处理结果符合设计文件和规范要求。PWHT results must be in compliance with design document and specification." ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 0 ) . SetCellValue ( "支、吊架安装正确。Support and hangers must be correctly installed." ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 0 ) . SetCellValue ( "合金钢管道材质标记清楚。Identifications on material of alloy steel pipline are clear." ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 0 ) . SetCellValue ( "不参与管道系统试验的 安全附件、仪表已按规定拆除或隔离, 参与试压的系统内的阀门已开启。Safety attachments and instruments not involved in test have been dismatled or isolated as requirement, all system valves involved in test have been opened. " ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . SetCellValue ( "临时加固措施、盲板位置与标识符和施工方案要求。Temporary reinforcement measures, blind position and markings must be incompliance with Specification." ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 0 ) . SetCellValue ( "焊接接头及需要检验的部位未被覆盖。Welds and other positions to be tested have not yet been painted and heat-insulated." ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 0 ) . SetCellValue ( "试压用压力表量程、精度等级、检定状态符合规范要求。Scale, accuracy and calibration state of test use pressure gauge must be incompliance with specification. " ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 0 ) . SetCellValue ( "不锈钢管道试验用水符合规范要求。Test use water of stainless steel pipline must be incompliance with specification." ) ;
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 20 , rowIndex + 22 , style , 0 , 8 , true ) ;
ws . GetRow ( rowIndex + 20 ) . Height = 20 * 20 * 2 ;
ws . GetRow ( rowIndex + 21 ) . Height = 20 * 20 * 3 ;
ws . GetRow ( rowIndex + 22 ) . Height = 20 * 20 * 7 ;
//循环合并单元格
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 20 , rowIndex + 20 , 0 , 8 ) ) ;
for ( int i = 21 ; i < 23 ; i + + )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 2 , 5 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 6 , 8 ) ) ;
}
//填充文本
ws . GetRow ( rowIndex + 20 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 0 ) . SetCellValue ( "备注:\nRemark" ) ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 0 ) . SetCellValue ( "建设/监理单位\nOwner/Construction Supervision Contractor" ) ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 2 ) . SetCellValue ( "总承包单位\nGeneral Contractor" ) ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 6 ) . SetCellValue ( "施工单位\nConstruction Company" ) ;
ws . GetRow ( rowIndex + 22 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 22 ) . GetCell ( 0 ) . SetCellValue ( " 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: " ) ;
ws . GetRow ( rowIndex + 22 ) . GetCell ( 2 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 22 ) . GetCell ( 2 ) . SetCellValue ( " 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date: " ) ;
ws . GetRow ( rowIndex + 22 ) . GetCell ( 6 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 22 ) . GetCell ( 6 ) . SetCellValue ( " 专业工程师\n Discipline Engineer: \n\n 质量检查员:\n Quality Inspector:\n\n 班(组)长:\n Leader:\n\n 日期Date: " ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//35-TP-13-管道复位记录UG-FW-001 之 sheet1
private void template35_sheet1 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 7 , style , 0 , 6 , true ) ;
//设置单元格高宽
ws . GetRow ( rowIndex ) . Height = 100 * 20 ;
ws . GetRow ( rowIndex + 1 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 2 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 3 ) . Height = 40 * 20 ;
ws . GetRow ( rowIndex + 4 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 5 ) . Height = 40 * 20 ;
ws . GetRow ( rowIndex + 6 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 7 ) . Height = 40 * 20 ;
ws . SetColumnWidth ( 0 , 20 * 256 ) ;
ws . SetColumnWidth ( 1 , 8 * 256 ) ;
ws . SetColumnWidth ( 2 , 15 * 256 ) ;
ws . SetColumnWidth ( 3 , 15 * 256 ) ;
ws . SetColumnWidth ( 4 , 10 * 256 ) ;
ws . SetColumnWidth ( 5 , 8 * 256 ) ;
ws . SetColumnWidth ( 6 , 10 * 256 ) ;
//合并填充单元格
for ( int i = 0 ; i < 3 ; i + + )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 2 , 3 ) ) ;
if ( i = = 2 )
continue ;
if ( i = = 0 )
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 4 , 6 ) ) ;
else
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 4 , 6 ) ) ;
}
ws . GetRow ( rowIndex ) . GetCell ( 0 ) . SetCellValue ( "SH/T3503-J408" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 0 ) . SetCellValue ( "Subsystem Name子系统名称" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 0 ) . SetCellValue ( "Fire Water" ) ;
var setStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 12 , true , true , "Arial Unicode MS" ) ;
setStyle . WrapText = true ;
ws . GetRow ( rowIndex ) . GetCell ( 2 ) . CellStyle = setStyle ;
ws . GetRow ( rowIndex ) . GetCell ( 2 ) . SetCellValue ( "Pipline Flushing and Blowing \nInspection Record(I)\n管道吹扫/清洗检验记录(I)" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 2 ) . SetCellValue ( "Subsystem No.子系统编号" ) ;
ws . GetRow ( rowIndex + 2 ) . GetCell ( 2 ) . SetCellValue ( "UG-FW" ) ;
var setStyle2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , false , false , "Arial Unicode MS" ) ;
setStyle2 . WrapText = true ;
ws . GetRow ( rowIndex ) . GetCell ( 4 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex ) . GetCell ( 4 ) . SetCellValue ( " Project Name: BASF (Guangdong) Integrated Project\n 项目名称:巴斯夫(广东)一体化项目\n Unit Name:Citral\n 单位名称: Citral" ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 4 ) . SetCellValue ( " Test Package No.试压包号" ) ;
for ( int i = 3 ; i < 8 ; i + + )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 5 ) ) ;
}
ws . GetRow ( rowIndex + 3 ) . GetCell ( 0 ) . SetCellValue ( "Inspection items and requirements\n检查项目及要求" ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 6 ) . SetCellValue ( "Result\n检查结果" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . SetCellValue ( "Pipeline pressure test is acceptable.管线压力试验检查合格" ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 0 ) . SetCellValue ( "Safety attachments and instruments not involved in purging and cleaning have been dismantled or isolated as per requirement.与吹扫及清洗无关的安全附件和仪表元件已经拆除或按要求隔离" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 0 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 0 ) . SetCellValue ( "All piping system valves have been opened.管线系统内阀门已按要求开启" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 0 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 0 ) . SetCellValue ( "Test use water of stainless steel pipeline shall be in compliance with specification.不锈钢管线系统清洗用水应符合规范要求" ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 0 ) . CellStyle = setStyle2 ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 8 , rowIndex + 24 , style , 0 , 6 , true ) ;
//设置单元格高度和合并单元格
for ( int i = 8 ; i < 25 ; i + + )
{
if ( i = = 8 )
ws . GetRow ( rowIndex + i ) . Height = 40 * 20 ;
else
ws . GetRow ( rowIndex + i ) . Height = 20 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 5 , 6 ) ) ;
}
ws . GetRow ( rowIndex + 8 ) . GetCell ( 0 ) . SetCellValue ( "Pipeline No.\n管道编号" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 2 ) . SetCellValue ( "Material\n管线材质" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 3 ) . SetCellValue ( "Operation Medium\n操作介质" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 4 ) . SetCellValue ( "Blowing Meadium\n吹扫介质" ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 5 ) . SetCellValue ( "Flushing Medium\n清洗介质" ) ;
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 25 , rowIndex + 27 , style , 0 , 6 , true ) ;
ws . GetRow ( rowIndex + 25 ) . Height = 30 * 20 ;
ws . GetRow ( rowIndex + 26 ) . Height = 40 * 20 ;
ws . GetRow ( rowIndex + 27 ) . Height = 125 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 25 , rowIndex + 25 , 0 , 6 ) ) ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 0 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 25 ) . GetCell ( 0 ) . SetCellValue ( "Inspection method and conclusion:\n检验方法及结果: " ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 26 , rowIndex + 26 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 26 ) . GetCell ( 0 ) . SetCellValue ( "建设/监理单位\nOwner/Construction Supervision Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 26 , rowIndex + 26 , 2 , 3 ) ) ;
ws . GetRow ( rowIndex + 26 ) . GetCell ( 2 ) . SetCellValue ( "总承包单位\nGeneral Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 26 , rowIndex + 26 , 4 , 6 ) ) ;
ws . GetRow ( rowIndex + 26 ) . GetCell ( 4 ) . SetCellValue ( "施工单位\nConstruction Company" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 0 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 0 ) . SetCellValue ( " Discipline Engineer:\n 专业工程师\n\n\n\n\n Date\n 日期:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 2 , 3 ) ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 2 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 2 ) . SetCellValue ( " Discipline Engineer:\n 专业工程师\n\n\n\n\n Date\n 日期:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 27 , rowIndex + 27 , 4 , 6 ) ) ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 4 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 27 ) . GetCell ( 4 ) . SetCellValue ( " Discipline Engineer:\n 专业工程师:\n Quality Inspector:\n 质量检查员:\n Group Leader:\n 班(组)长∶\n Date\n 日期:" ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//35-TP-13-管道复位记录UG-FW-001 之 sheet2
private void template35_sheet2 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 1 , style1 , 0 , 8 , true ) ;
ws . GetRow ( rowIndex ) . Height = 15 * 20 ;
ws . SetColumnWidth ( 0 , 18 * 256 ) ;
ws . SetColumnWidth ( 1 , 4 * 256 ) ;
ws . SetColumnWidth ( 2 , 8 * 256 ) ;
ws . SetColumnWidth ( 3 , 8 * 256 ) ;
ws . SetColumnWidth ( 4 , 8 * 256 ) ;
ws . SetColumnWidth ( 5 , 8 * 256 ) ;
ws . SetColumnWidth ( 6 , 8 * 256 ) ;
ws . SetColumnWidth ( 7 , 9 * 256 ) ;
ws . SetColumnWidth ( 8 , 9 * 256 ) ;
ws . GetRow ( rowIndex ) . GetCell ( 7 ) . SetCellValue ( "Form No." ) ;
ws . GetRow ( rowIndex ) . GetCell ( 8 ) . SetCellValue ( "TP-13" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 1 , rowIndex + 4 , style , 0 , 8 , true ) ;
ws . GetRow ( rowIndex + 1 ) . Height = 30 * 20 ;
ws . GetRow ( rowIndex + 2 ) . Height = 60 * 20 ;
ws . GetRow ( rowIndex + 3 ) . Height = 30 * 20 ;
ws . GetRow ( rowIndex + 4 ) . Height = 20 * 20 ;
var setStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 12 , true , true , "Arial Unicode MS" ) ;
setStyle . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 2 , 0 , 0 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 2 , 1 , 5 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 1 ) . CellStyle = setStyle ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 1 ) . SetCellValue ( "复位检查\nRe-instatement Certificate" ) ;
var setStyle2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , false , false , "Arial Unicode MS" ) ;
setStyle2 . WrapText = true ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 2 , 6 , 8 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 6 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 6 ) . SetCellValue ( "项目名称:巴斯夫(广东)一体化项目\nProject Name: BASF (Guangdong) Integrated Project\n单位名称: Citral\nUnit Name:Citral" ) ;
//头部列表部分
ws . GetRow ( rowIndex + 3 ) . GetCell ( 0 ) . SetCellValue ( "子系统名称 Subsystem Name" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 1 , 5 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 1 ) . SetCellValue ( "子系统编号 Subsystem No." ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 3 , 6 , 8 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 6 ) . SetCellValue ( "试压包号 Test Package No." ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 0 ) . SetCellValue ( "Fire Water" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 1 , 5 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 1 ) . SetCellValue ( "UG-FW" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 4 , rowIndex + 4 , 6 , 8 ) ) ;
ws . GetRow ( rowIndex + 4 ) . GetCell ( 6 ) . SetCellValue ( "UG-130-FW-HT-001" ) ;
#endregion
#region 表 格 部 分
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 5 , rowIndex + 19 , style , 0 , 8 , true ) ;
for ( int i = 5 ; i < 20 ; i + + )
{
ws . GetRow ( rowIndex + i ) . Height = 40 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 6 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 7 , 8 ) ) ;
}
ws . GetRow ( rowIndex + 5 ) . GetCell ( 0 ) . SetCellValue ( "检查内容\nInspection Items and requirements" ) ;
ws . GetRow ( rowIndex + 5 ) . GetCell ( 7 ) . SetCellValue ( "Results\n检查结果" ) ;
ws . GetRow ( rowIndex + 6 ) . GetCell ( 0 ) . SetCellValue ( "吹扫试压完成后, 对管线的干燥情况进行检查。Flushing and hydrostatic testing have been satisfactorily completed and recorded ,Check drying of lines complete." ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 0 ) . SetCellValue ( "按照P&ID恢复因清洗和试压拆除如调节阀等事项。All items (control valves ,etc.)removed for cleaning and testing have been reinstated as per P&ID." ) ;
ws . GetRow ( rowIndex + 8 ) . GetCell ( 0 ) . SetCellValue ( "试压后机械之间连接的正式螺栓垫片, 根据要求记录螺栓的扭矩值。Correct bolts,gasket used to reinstate all mechanical joints disturbed post test,torque record available as required. " ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 0 ) . SetCellValue ( "所有临时放空及排放已拆除并按图恢复。All temporary vents and drains have been removed,and reinstated in accrodance with drawings." ) ;
ws . GetRow ( rowIndex + 10 ) . GetCell ( 0 ) . SetCellValue ( "根据P&ID指示按照正确方向安装管道的原件。Directional sensitive piping elements are all correctly installed as indicated on P&ID." ) ;
ws . GetRow ( rowIndex + 11 ) . GetCell ( 0 ) . SetCellValue ( "根据P&ID和图纸正确安装永久插板和盲板。Permanent spectacle and process blinds are in the correct position as indicated on P&ID and drawings. " ) ;
ws . GetRow ( rowIndex + 12 ) . GetCell ( 0 ) . SetCellValue ( "正确安装指定阀门的延长手柄和链条。Extended spindles and chain wheels for specified valves have been correctly installed." ) ;
ws . GetRow ( rowIndex + 13 ) . GetCell ( 0 ) . SetCellValue ( "All locking devices and interlocks for specified valves have been correctly installed.正确安装指定阀门的锁定装置和联动装置。" ) ;
ws . GetRow ( rowIndex + 14 ) . GetCell ( 0 ) . SetCellValue ( "按照PID& 图纸要求恢复临时拆除的管道、仪表和机械设备。All temporary removed piping,instrumentation,mechanical equipment are re-intated in accordance with the P&ID's and drawings." ) ;
ws . GetRow ( rowIndex + 15 ) . GetCell ( 0 ) . SetCellValue ( "所有的阀门涂油脂和试压已经完成。All valves have been greased and stroked." ) ;
ws . GetRow ( rowIndex + 16 ) . GetCell ( 0 ) . SetCellValue ( "螺纹连接根据规范要求进行。Compound on screwed connections in accordance with specification." ) ;
ws . GetRow ( rowIndex + 17 ) . GetCell ( 0 ) . SetCellValue ( "安装所有的制动装置和联动装置。All locking device/interlocks installed." ) ;
ws . GetRow ( rowIndex + 18 ) . GetCell ( 0 ) . SetCellValue ( "检查和确定弹簧支架、滑动支架装置。Spring Support,Gags removed&support settings confirmed/Checked." ) ;
ws . GetRow ( rowIndex + 19 ) . GetCell ( 0 ) . SetCellValue ( "如果需要, 释放给化学清洗、油洗。System released for chemical cleaning /hot oil flushing ,if required." ) ;
#endregion
#region 尾 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 20 , rowIndex + 26 , style , 0 , 8 , true ) ;
ws . GetRow ( rowIndex + 20 ) . Height = 40 * 20 ;
ws . GetRow ( rowIndex + 21 ) . Height = 15 * 20 ;
ws . GetRow ( rowIndex + 22 ) . Height = 15 * 20 ;
ws . GetRow ( rowIndex + 23 ) . Height = 15 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 20 , rowIndex + 20 , 0 , 8 ) ) ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 0 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 20 ) . GetCell ( 0 ) . SetCellValue ( " Conclusion:\n 检查结果:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 21 , rowIndex + 23 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 0 ) . SetCellValue ( "建设/监理单位\nOwner/Construction Supervision\nContractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 21 , rowIndex + 23 , 2 , 5 ) ) ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 2 ) . SetCellValue ( "总承包单位\nGeneral Contractor" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 21 , rowIndex + 23 , 6 , 8 ) ) ;
ws . GetRow ( rowIndex + 21 ) . GetCell ( 6 ) . SetCellValue ( "施工单位\nConstruction Company" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 26 , 0 , 1 ) ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 0 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 0 ) . SetCellValue ( " 专业工程师\n Discipline Engineer:\n\n\n\n\n\n 日期Date: " ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 26 , 2 , 5 ) ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 2 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 2 ) . SetCellValue ( " 专业工程师\n Discipline Engineer:\n\n\n\n\n\n 日期Date: " ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 24 , rowIndex + 26 , 6 , 8 ) ) ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 6 ) . CellStyle = setStyle2 ;
ws . GetRow ( rowIndex + 24 ) . GetCell ( 6 ) . SetCellValue ( " 专业工程师\n Discipline Engineer:\n 质量检查员:\n Quality Inspector:\n 班(组)长:\n Leader:\n\n 日期Date: " ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
ws . FitToPage = true ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
}
//36-TP-14-法兰螺栓扭矩记录表
private void template36 ( XSSFWorkbook hssfworkbook , XSSFSheet ws )
{
//插入图片部分
var img1 = Server . MapPath ( "~/res/images/bsf/1.png" ) ;
var img2 = Server . MapPath ( "~/res/images/bsf/2.png" ) ;
var img3 = Server . MapPath ( "~/res/images/bsf/3.png" ) ;
var img4 = Server . MapPath ( "~/res/images/bsf/4.png" ) ;
int rowIndex = 0 ;
var style = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
#region 头 部
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex , rowIndex + 8 , style , 0 , 26 , true ) ;
for ( int i = 0 ; i < 27 ; i + + )
{
ws . SetColumnWidth ( i , 4 * 256 ) ;
}
ws . GetRow ( rowIndex ) . Height = 15 * 20 ;
ws . GetRow ( rowIndex + 1 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 2 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 3 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 4 ) . Height = 20 * 20 ;
ws . GetRow ( rowIndex + 5 ) . Height = 10 * 20 ;
ws . GetRow ( rowIndex + 6 ) . Height = 10 * 20 ;
ws . GetRow ( rowIndex + 8 ) . Height = 15 * 20 ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( 0 , 0 , 0 , 26 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( 6 , 6 , 0 , 26 ) , ws ) ;
RegionUtil . SetBorderTop ( 1 , new CellRangeAddress ( 6 , 6 , 0 , 26 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( 7 , 7 , 0 , 26 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( 7 , 7 , 6 , 6 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( 7 , 7 , 13 , 13 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( 7 , 7 , 19 , 19 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( 0 , 20 , 26 , 26 ) , ws ) ;
RegionUtil . SetBorderBottom ( 1 , new CellRangeAddress ( 8 , 8 , 0 , 26 ) , ws ) ;
InsertImage ( hssfworkbook , ws , 1 , 1 , 2 , 2 , img1 , 2 , 1.8 ) ;
InsertImage ( hssfworkbook , ws , 1 , 3 , 2 , 4 , img2 , 2 , 1.8 , 0 , 3 ) ;
InsertImage ( hssfworkbook , ws , 1 , 20 , 2 , 23 , img3 , 1.2 , 2 , 0 , 10 ) ;
InsertImage ( hssfworkbook , ws , 1 , 24 , 2 , 26 , img4 , 1.2 , 2 , 0 , 10 ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex , rowIndex , 23 , 24 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex , rowIndex , 25 , 26 ) ) ;
ws . GetRow ( rowIndex ) . GetCell ( 23 ) . SetCellValue ( "Form No." ) ;
ws . GetRow ( rowIndex ) . GetCell ( 25 ) . SetCellValue ( "TP-06" ) ;
var setStyle = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . None , BorderStyle . None , BorderStyle . None , BorderStyle . None , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 12 , true , true , "Arial Unicode MS" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 2 , 5 , 22 ) ) ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . GetRow ( rowIndex + 1 ) . GetCell ( 5 ) . SetCellValue ( "巴斯夫(广东)一体化项目\nBASF (GUANGDONG) INTEGRATED PROJECT" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 1 , rowIndex + 5 , 23 , 26 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 3 , rowIndex + 4 , 5 , 22 ) ) ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . CellStyle = setStyle ;
ws . GetRow ( rowIndex + 3 ) . GetCell ( 5 ) . SetCellValue ( "螺栓扭矩报告\nBOLT TORQUE / TIGHTENING REPORT" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 0 , 6 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 0 ) . SetCellValue ( "试压包号\nTEST PACKAGE NO.:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 7 , 13 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 7 ) . SetCellValue ( "UG-130-FW-HT-001" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 14 , 19 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 14 ) . SetCellValue ( "系统号\nSYSTEM NO.:" ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 7 , rowIndex + 7 , 20 , 26 ) ) ;
ws . GetRow ( rowIndex + 7 ) . GetCell ( 20 ) . SetCellValue ( "UG" ) ;
#endregion
#region 表 格 部 分
var style1 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Center , NPOI . SS . UserModel . HorizontalAlignment . Center , 10 , true , false , "Arial Unicode MS" ) ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 9 , rowIndex + 33 , style1 , 0 , 26 , true ) ;
for ( int i = 9 ; i < 34 ; i + + )
{
if ( i = = 10 )
continue ;
//列表头部两行合并
if ( i = = 9 )
{
ws . GetRow ( rowIndex + i ) . Height = 25 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 2 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 8 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 11 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 14 , 16 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 17 , 19 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 20 , 22 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 23 , 24 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i + 1 , 25 , 26 ) ) ;
}
else
{
ws . GetRow ( rowIndex + i ) . Height = 18 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 1 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 2 , 7 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 8 , 10 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 11 , 13 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 14 , 16 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 17 , 19 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 20 , 22 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 23 , 24 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 25 , 26 ) ) ;
}
}
ws . GetRow ( rowIndex + 9 ) . GetCell ( 0 ) . SetCellValue ( "序号\nNo." ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 2 ) . SetCellValue ( "单线图号\nIsometric Line No." ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 8 ) . SetCellValue ( "法兰编号\nFlange No." ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 11 ) . SetCellValue ( "螺栓尺寸\nBolt Size" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 14 ) . SetCellValue ( "螺栓等级\nBolt Class" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 17 ) . SetCellValue ( "要求扭矩值\nRequired Torque" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 20 ) . SetCellValue ( "实际扭矩值\nActual Torque" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 23 ) . SetCellValue ( "接受\nACC" ) ;
ws . GetRow ( rowIndex + 9 ) . GetCell ( 25 ) . SetCellValue ( "拒绝\nReject" ) ;
#endregion
#region 尾 部
//文本左对齐置顶方式加换行
var style2 = CommonPrint . SetExcelStyle ( hssfworkbook , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , BorderStyle . Thin , VerticalAlignment . Top , NPOI . SS . UserModel . HorizontalAlignment . Left , 10 , false , false , "Arial Unicode MS" ) ;
style2 . WrapText = true ;
ws = ExcelCreateRow ( ws , hssfworkbook , rowIndex + 34 , rowIndex + 45 , style1 , 0 , 26 , true ) ;
ws . GetRow ( rowIndex + 34 ) . Height = 40 * 20 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 34 , rowIndex + 34 , 0 , 10 ) ) ;
ws . GetRow ( rowIndex + 34 ) . GetCell ( 0 ) . SetCellValue ( "总计检查螺栓\nTotal Bolts Checked" ) ;
ws . GetRow ( rowIndex + 34 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 34 , rowIndex + 34 , 11 , 26 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 35 , rowIndex + 35 , 0 , 26 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 36 , rowIndex + 39 , 0 , 26 ) ) ;
ws . GetRow ( rowIndex + 36 ) . GetCell ( 0 ) . SetCellValue ( "备注/意见:\nRemarks/Comments" ) ;
ws . GetRow ( rowIndex + 36 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 40 , rowIndex + 40 , 0 , 26 ) ) ;
ws . GetRow ( rowIndex + 40 ) . GetCell ( 0 ) . SetCellValue ( "说明: 按照BASF要求对螺栓进行扭矩工作。\nNotes: According to the BASF standard value to tighten the bolts." ) ;
ws . GetRow ( rowIndex + 40 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + 41 , rowIndex + 41 , 0 , 26 ) ) ;
ws . GetRow ( rowIndex + 41 ) . GetCell ( 0 ) . SetCellValue ( "批准:\nAccepted by:" ) ;
ws . GetRow ( rowIndex + 41 ) . GetCell ( 0 ) . CellStyle = style2 ;
//循环合并单元格
for ( int i = 42 ; i < 46 ; i + + )
{
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 0 , 3 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 4 , 9 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 10 , 15 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 16 , 21 ) ) ;
ws . AddMergedRegion ( new CellRangeAddress ( rowIndex + i , rowIndex + i , 22 , 26 ) ) ;
}
ws . GetRow ( rowIndex + 42 ) . GetCell ( 4 ) . SetCellValue ( "CC7" ) ;
ws . GetRow ( rowIndex + 42 ) . GetCell ( 10 ) . SetCellValue ( "JIANLI" ) ;
ws . GetRow ( rowIndex + 42 ) . GetCell ( 16 ) . SetCellValue ( "Worley" ) ;
ws . GetRow ( rowIndex + 42 ) . GetCell ( 22 ) . SetCellValue ( "BASF" ) ;
ws . GetRow ( rowIndex + 43 ) . GetCell ( 0 ) . SetCellValue ( "姓名Name" ) ;
ws . GetRow ( rowIndex + 43 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 44 ) . GetCell ( 0 ) . SetCellValue ( "签名Signature" ) ;
ws . GetRow ( rowIndex + 44 ) . GetCell ( 0 ) . CellStyle = style2 ;
ws . GetRow ( rowIndex + 45 ) . GetCell ( 0 ) . SetCellValue ( "日期Date" ) ;
ws . GetRow ( rowIndex + 45 ) . GetCell ( 0 ) . CellStyle = style2 ;
//划线
RegionUtil . SetBorderLeft ( 1 , new CellRangeAddress ( rowIndex , rowIndex + 45 , 0 , 0 ) , ws ) ;
RegionUtil . SetBorderRight ( 1 , new CellRangeAddress ( rowIndex , rowIndex + 45 , 26 , 26 ) , ws ) ;
#endregion
ws . PrintSetup . FitWidth = 1 ;
ws . PrintSetup . FitHeight = 0 ;
ws . PrintSetup . PaperSize = ( int ) PaperSize . A4_Small ;
//垂直水平居中
ws . VerticallyCenter = true ;
ws . HorizontallyCenter = true ;
//打印边距设置 厘米/3
ws . SetMargin ( MarginType . RightMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . LeftMargin , ( double ) 2.9 / 3 ) ;
ws . SetMargin ( MarginType . TopMargin , ( double ) 2.4 / 3 ) ;
ws . SetMargin ( MarginType . BottomMargin , ( double ) 2.4 / 3 ) ;
//页眉页脚间距
ws . SetMargin ( MarginType . HeaderMargin , 0 ) ;
ws . SetMargin ( MarginType . FooterMargin , 0 ) ;
ws . FitToPage = true ;
}
#endregion
private void CreateDataExcel ( string [ ] templateFileIds )
{
var result = Funs . DB . Template_Files ;
if ( result = = null )
return ;
string rootPath = Server . MapPath ( "~/" ) + Const . ExcelUrl ;
//导出文件
string filePath = rootPath + "\\" ;
if ( ! Directory . Exists ( filePath ) )
{
Directory . CreateDirectory ( filePath ) ;
}
string fileName = "模版报表-" + DateTime . Now . ToString ( "yyyyMMddHHmmss" ) + ".xlsx" ;
string ReportFileName = filePath + fileName ;
//XSSFWorkbook hssfworkbook = new XSSFWorkbook();
string sourceFile = Server . MapPath ( "~/File/Excel/目录模版.xlsx" ) ;
// 打开源工作簿
XSSFWorkbook hssfworkbook ;
using ( FileStream file = new FileStream ( sourceFile , FileMode . Open , FileAccess . Read ) )
{
hssfworkbook = ( XSSFWorkbook ) WorkbookFactory . Create ( file ) ;
}
//操作目录模版sheet是否存在,不存在就把对应的sheet删除掉( 特殊处理)
int index = 0 ;
//'2-TP-02-试压包封面UG-FW-001
if ( ! templateFileIds . Contains ( "D4B4DD64-8361-4A75-AA3E-E484934B9B06" ) )
{
hssfworkbook . RemoveAt ( 0 ) ;
index + + ;
}
//3-TP-03-试压包目录UG-FW-001
if ( ! templateFileIds . Contains ( "6CD2710C-2AD6-4E7D-BED7-C8BEDAD300DE" ) )
{
hssfworkbook . RemoveAt ( 1 - index ) ;
index + + ;
}
//4-TP-04-试压标识
if ( ! templateFileIds . Contains ( "87A66CAA-CA30-4A1E-8382-E8503059A0D0" ) )
{
hssfworkbook . RemoveAt ( 2 - index ) ;
index + + ;
}
//对应正常sheet处理
foreach ( var templateFileId in templateFileIds )
{
var oneTemp = result . FirstOrDefault ( s = > s . Id = = templateFileId ) ;
if ( oneTemp = = null )
continue ;
switch ( templateFileId )
{
//1-TP-01-试压包路径表UG-FW-001
case "2BEFB0F4-A466-4C59-963F-9092BACF2E52" :
XSSFSheet sheet1 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template1 ( hssfworkbook , sheet1 ) ;
break ;
//6-TP-05-P&ID清单UG-FW-001 模版
case "811EF650-7686-447F-BEE8-776D50041CD0" :
XSSFSheet sheet6 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template6 ( hssfworkbook , sheet6 ) ;
break ;
//8-TP-06-单线图清单UG-FW-001 模版
case "A1E35220-A321-482A-B745-5F6456ADFE43" :
XSSFSheet sheet8 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template8 ( hssfworkbook , sheet8 ) ;
break ;
//11-TP-07-盲板清单UG-FW-001
case "F20D530C-29BB-405F-AB0E-342496134375" :
XSSFSheet sheet11 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template11 ( hssfworkbook , sheet11 ) ;
break ;
//13-弹簧支吊架安装检验记录SHT 3503-J403
case "0F1A38BB-C98E-4C21-B9EC-8B03CCB22BF2" :
XSSFSheet sheet13 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template13 ( hssfworkbook , sheet13 ) ;
break ;
//14-滑动固定管托安装检验记录SHT 3503-J404
case "9C6CB4B3-446D-4C24-ADD8-DAC5F5DEF302" :
XSSFSheet sheet14 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template14 ( hssfworkbook , sheet14 ) ;
break ;
//15-管道补偿器安装检验记录SHT 3503-J405
case "854BF339-C7FA-4935-9CBD-C844904F62FB" :
XSSFSheet sheet15 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template15 ( hssfworkbook , sheet15 ) ;
break ;
//16-TP-08-静电接地清单UG-FW-001
case "FEF7F71B-E630-49CE-AB3D-6BFADA074DB6" :
XSSFSheet sheet16 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template16 ( hssfworkbook , sheet16 ) ;
break ;
//17-管道焊接接头热处理报告SHT 3503-J411
case "1E3D0EA0-CE64-44EA-964F-5B289F5A588B" :
XSSFSheet sheet17 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template17 ( hssfworkbook , sheet17 ) ;
break ;
//18-金属材料化学成分检验报告SHT 3503-J129
case "0DAD1096-EA35-446E-B628-2F20C449C641" :
XSSFSheet sheet18 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template18 ( hssfworkbook , sheet18 ) ;
break ;
//19-硬度检查报告SHT 3503-J130
case "4B60CC6A-4431-49DF-A754-8B2C595C8C27" :
XSSFSheet sheet19 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template19 ( hssfworkbook , sheet19 ) ;
break ;
//21-管道焊接工作记录SHT 3503-J415
case "1BDF3627-8632-48A3-B8CB-1D388D8A112A" :
XSSFSheet sheet21 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template21 ( hssfworkbook , sheet21 ) ;
break ;
//22-射线检测比例确认表SHT 3503-J412-2007
case "857BDF12-E4E1-4FF1-A8D5-FC96CF09E70D" :
XSSFSheet sheet22 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template22 ( hssfworkbook , sheet22 ) ;
break ;
//23-TP-09-超声&PAUT&TOFD检测比例确认表
case "0400055B-388A-40B0-BB7E-283B94864893" :
XSSFSheet sheet23 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template23 ( hssfworkbook , sheet23 ) ;
break ;
//24-TP-10-渗透&MT检测比例确认表
case "B33E6C98-F999-4DC6-B0A4-633AE85B349C" :
XSSFSheet sheet24 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template24 ( hssfworkbook , sheet24 ) ;
break ;
2024-06-05 08:24:19 +08:00
//25-1-管道无损检测结果汇总表SHT 3503-J412-2017
case "95125974-3DD4-4E16-B4F0-A9D9C9A1406D" :
XSSFSheet sheet25_1 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template25_1 ( hssfworkbook , sheet25_1 ) ;
break ;
2024-05-08 16:27:28 +08:00
//25-管道无损检测结果汇总表SHT 3503-J412-2017
case "4C45ABAB-89E9-4874-8F55-5050CDE98DFC" :
XSSFSheet sheet25 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template25 ( hssfworkbook , sheet25 ) ;
break ;
//26-管道无损检测数量统计表SHT 3503-J413-2017
case "6947FAA5-0475-4BEA-BE3A-C88BA503A0A5" :
XSSFSheet sheet26 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template26 ( hssfworkbook , sheet26 ) ;
break ;
//27-TP-11-尾项清单UG-FW-001
case "012F03CB-85D7-4F57-8A4D-38AC209886BF" :
XSSFSheet sheet27 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template27 ( hssfworkbook , sheet27 ) ;
break ;
//28-TP-12-试压用水( 工具) 检查清单UG-FW-001
case "DD6E665D-F784-41BA-88EF-E836AB1EC02F" :
XSSFSheet sheet28 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template28 ( hssfworkbook , sheet28 ) ;
break ;
//32-管道系统压力试验记录SHT 3503-J406-2
case "A5F52E0C-90D2-4228-96ED-5FC4125159C5" :
XSSFSheet sheet32 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template32 ( hssfworkbook , sheet32 ) ;
break ;
//33-管道吹扫清洗记录SHT 3503-J408 UG-FW-001
case "B1AE758D-3850-4397-A036-7FA54EFD0A69" :
XSSFSheet sheet33 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template33 ( hssfworkbook , sheet33 ) ;
break ;
//34-管道系统压力试验条件确认记录SHT 3503-J406-1
case "AFC08566-A8D0-4118-B240-AADA04305E1B" :
XSSFSheet sheet34 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template34 ( hssfworkbook , sheet34 ) ;
break ;
//35-TP-13-管道复位记录UG-FW-001
case "114E0846-93CB-4F12-A8BA-CE5B80C26A9C" :
XSSFSheet sheet35_sheet1 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title + "-sheet1" ) ;
template35_sheet1 ( hssfworkbook , sheet35_sheet1 ) ;
XSSFSheet sheet35_sheet2 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title + "-sheet2" ) ;
template35_sheet2 ( hssfworkbook , sheet35_sheet2 ) ;
break ;
//36-TP-14-法兰螺栓扭矩记录表
case "1C555FBB-DC81-4D2E-8EA7-8F6F0D4A4142" :
XSSFSheet sheet36 = ( XSSFSheet ) hssfworkbook . CreateSheet ( oneTemp . Title ) ;
template36 ( hssfworkbook , sheet36 ) ;
break ;
}
}
//生成第{N}个模版
using ( FileStream filess = System . IO . File . OpenWrite ( ReportFileName ) )
{
hssfworkbook . Write ( filess ) ;
}
try
{
FileInfo filet = new FileInfo ( ReportFileName ) ;
Response . Clear ( ) ;
Response . ContentType = "application/x-zip-compressed" ;
Response . AddHeader ( "Content-Disposition" , "attachment;filename=" + System . Web . HttpUtility . UrlEncode ( fileName , System . Text . Encoding . UTF8 ) ) ;
Response . AddHeader ( "Content-Length" , filet . Length . ToString ( ) ) ;
Response . TransmitFile ( ReportFileName , 0 , filet . Length ) ;
Response . Flush ( ) ;
Response . Close ( ) ;
System . IO . File . Delete ( ReportFileName ) ;
}
catch ( Exception ex )
{
BLL . ErrLogInfo . WriteLog ( ex . Message ) ;
}
}
#region 私 有 方 法
/// <summary>
/// 获取某一列的所有值
/// </summary>
/// <typeparam name="T">列数据类型</typeparam>
/// <param name="dtSource">数据表</param>
/// <param name="filedName">列名</param>
/// <returns></returns>
public static List < T > GetColumnValues < T > ( DataTable dtSource , string filedName )
{
return ( from r in dtSource . AsEnumerable ( ) select r . Field < T > ( filedName ) ) . ToList < T > ( ) ;
}
/// <summary>
/// 行和列
/// </summary>
/// <returns></returns>
private XSSFSheet ExcelCreateRow ( XSSFSheet ws , XSSFWorkbook hssfworkbook , int sRows , int eRows , ICellStyle style , int cStart , int cEnd , bool istitle = false )
{
for ( int i = sRows ; i < = eRows ; i + + )
{
ws . CreateRow ( i ) ;
if ( istitle )
{
ws . GetRow ( i ) . HeightInPoints =
i = = sRows ? 49.75f :
i = = ( sRows + 1 ) ? 13.75f :
38f ;
}
else
{
ws . GetRow ( i ) . HeightInPoints = 38f ;
}
for ( int j = cStart ; j < = cEnd ; j + + )
{
ws . GetRow ( i ) . CreateCell ( j ) ;
ws . GetRow ( i ) . GetCell ( j ) . CellStyle = style ;
}
}
return ws ;
}
private ICellStyle SetStyle ( XSSFWorkbook ws , BorderStyle top , BorderStyle bottom , BorderStyle left , BorderStyle right )
{
ICellStyle style = ws . CreateCellStyle ( ) ;
style . BorderLeft = left ;
style . BorderRight = right ;
style . BorderTop = top ;
style . BorderBottom = bottom ;
return style ;
}
private void InsertImage ( XSSFWorkbook hssfworkbook , XSSFSheet ws , int row1 , int col1 , int row2 , int col2 , string img , double w , double h , int dx1 = 0 , int dy1 = 0 , int dx2 = 0 , int dy2 = 0 )
{
int pictureIdx = hssfworkbook . AddPicture ( System . IO . File . ReadAllBytes ( img ) , PictureType . PNG ) ;
IDrawing drawing = ws . CreateDrawingPatriarch ( ) ;
IClientAnchor anchor = new XSSFClientAnchor ( dx1 * XSSFShape . EMU_PER_PIXEL , dy1 * XSSFShape . EMU_PER_POINT , dx2 * XSSFShape . EMU_PER_PIXEL , dy2 * XSSFShape . EMU_PER_POINT , col1 , row1 , col2 , row2 ) ;
IDrawing patriarch = ws . CreateDrawingPatriarch ( ) ;
IPicture pict = ( XSSFPicture ) patriarch . CreatePicture ( anchor , pictureIdx ) ;
pict . Resize ( w , h ) ;
}
#endregion
}
#endregion
}