This commit is contained in:
parent
84d50caf65
commit
d1b936b7ca
|
@ -2294,356 +2294,497 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
|||
private void template13(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||||
{
|
||||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||||
|
||||
//模拟数据
|
||||
string sql = @"select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||||
var tbNum = dt.Rows.Count;
|
||||
var pageNum = tbNum < 8 ? 1 : Math.Ceiling((float)(tbNum - 8) / 8) + 1;
|
||||
|
||||
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++)
|
||||
for (int num = 1; num <= pageNum; num++)
|
||||
{
|
||||
ws.SetColumnWidth(i, 16 * 256);
|
||||
}
|
||||
ws.GetRow(rowIndex + 1).Height = 20 * 20 * 6;
|
||||
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");
|
||||
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 1, 2));
|
||||
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("SH/T 3503—J403");
|
||||
#region 头部
|
||||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex, style, 1, 7, true);
|
||||
|
||||
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");
|
||||
//设置列宽度
|
||||
ws.SetColumnWidth(0, 2 * 256);
|
||||
ws.SetColumnWidth(1, 16 * 256);
|
||||
ws.SetColumnWidth(2, 16 * 256);
|
||||
ws.SetColumnWidth(3, 16 * 256);
|
||||
ws.SetColumnWidth(4, 16 * 256);
|
||||
ws.SetColumnWidth(5, 16 * 256);
|
||||
ws.SetColumnWidth(6, 19 * 256);
|
||||
ws.SetColumnWidth(7, 19 * 256);
|
||||
|
||||
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($"工程名称:{info?.projectName}\n\nProject Name:{info?.enProjectName}\n\n单位工程名称:{info?.workAreaName}\nUnit Name:{info?.enWorkAreaName}");
|
||||
ws.GetRow(rowIndex).Height = 20 * 20 * 6;
|
||||
|
||||
#endregion
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 1, 2));
|
||||
ws.GetRow(rowIndex).GetCell(1).SetCellValue("SH/T 3503—J403");
|
||||
|
||||
#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;
|
||||
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, 5));
|
||||
ws.GetRow(rowIndex).GetCell(3).CellStyle = style1;
|
||||
ws.GetRow(rowIndex).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, rowIndex, 6, 7));
|
||||
ws.GetRow(rowIndex).GetCell(6).CellStyle = style2;
|
||||
ws.GetRow(rowIndex).GetCell(6).SetCellValue($"工程名称:{info?.projectName}\n\nProject Name:{info?.enProjectName}\n\n单位工程名称:{info?.workAreaName}\nUnit Name:{info?.enWorkAreaName}");
|
||||
|
||||
#endregion
|
||||
|
||||
#region 表格部分
|
||||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 9, style, 1, 7, true);
|
||||
var dStart = 0;
|
||||
var dEnd = 0;
|
||||
if (num == 1)
|
||||
{
|
||||
dStart = 0;
|
||||
dEnd = 8;
|
||||
}
|
||||
else
|
||||
ws.GetRow(rowIndex + i).Height = 20 * 20 * 2;
|
||||
{
|
||||
dStart = num == 2 ? 8 : ((num - 2) * 8) + 8;
|
||||
dEnd = ((num - 1) * 8) + 8;
|
||||
}
|
||||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||||
int j = 0;
|
||||
for (int i = 1; i <= 9; i++)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
ws.GetRow(rowIndex + i).Height = 20 * 20 * 3;
|
||||
ws.GetRow(rowIndex + i).GetCell(1).SetCellValue("管道编号/单线号\nPiping No./Line No.");
|
||||
ws.GetRow(rowIndex + i).GetCell(2).SetCellValue("支/吊架位号\nSupport/Hanger Item No.");
|
||||
ws.GetRow(rowIndex + i).GetCell(3).SetCellValue("结构型式\nType");
|
||||
ws.GetRow(rowIndex + i).GetCell(4).SetCellValue("位移方向\nDisplacement Direction");
|
||||
ws.GetRow(rowIndex + i).GetCell(5).SetCellValue("设计冷态负荷值\nDesign Cold Load");
|
||||
ws.GetRow(rowIndex + i).GetCell(6).SetCellValue("安装冷态负荷值\nInstallation Cold Load");
|
||||
ws.GetRow(rowIndex + i).GetCell(7).SetCellValue("检查结果\nInspection Result");
|
||||
}
|
||||
else
|
||||
{
|
||||
ws.GetRow(rowIndex + i).Height = 20 * 20;
|
||||
if (pageTb.Rows.Count > j)
|
||||
{
|
||||
var dr = pageTb.Rows[j];
|
||||
ws.GetRow(rowIndex + i).GetCell(1).SetCellValue("模拟数据");
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 尾部
|
||||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 10, rowIndex + 12, style, 1, 7, true);
|
||||
|
||||
ws.GetRow(rowIndex + 10).Height = 20 * 20 * 2;
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 10, rowIndex + 10, 1, 7));
|
||||
ws.GetRow(rowIndex + 10).GetCell(1).CellStyle = style2;
|
||||
ws.GetRow(rowIndex + 10).GetCell(1).SetCellValue(" 备注:\n Remarks:");
|
||||
|
||||
ws.GetRow(rowIndex + 11).Height = 20 * 20 * 2;
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 1, 2));
|
||||
ws.GetRow(rowIndex + 11).GetCell(1).SetCellValue("建设/监理单位\nOwner/JianLi Contractor");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 3, 5));
|
||||
ws.GetRow(rowIndex + 11).GetCell(3).SetCellValue("总 承 包 单 位\nGeneral Contractor");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 6, 7));
|
||||
ws.GetRow(rowIndex + 11).GetCell(6).SetCellValue("施 工 单 位\nConstruction Contractor");
|
||||
|
||||
ws.GetRow(rowIndex + 12).Height = 20 * 20 * 6;
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 1, 2));
|
||||
ws.GetRow(rowIndex + 12).GetCell(1).CellStyle = style2;
|
||||
ws.GetRow(rowIndex + 12).GetCell(1).SetCellValue(" 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 3, 5));
|
||||
ws.GetRow(rowIndex + 12).GetCell(3).CellStyle = style2;
|
||||
ws.GetRow(rowIndex + 12).GetCell(3).SetCellValue(" 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 6, 7));
|
||||
ws.GetRow(rowIndex + 12).GetCell(6).CellStyle = style2;
|
||||
ws.GetRow(rowIndex + 12).GetCell(6).SetCellValue(" 施工班组长:\n Foreman:\n 质量检查员:\n Quality Inspector:\n 专业工程师:\n Discipline Engineer: \n 日期(DATE): 年 月 日");
|
||||
|
||||
#endregion
|
||||
|
||||
rowIndex += 13;
|
||||
|
||||
|
||||
}
|
||||
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.Landscape = true;
|
||||
ws.ForceFormulaRecalculation = true;
|
||||
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);
|
||||
//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)
|
||||
{
|
||||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||||
|
||||
//模拟数据
|
||||
string sql = @"select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||||
var tbNum = dt.Rows.Count;
|
||||
var pageNum = tbNum < 8 ? 1 : Math.Ceiling((float)(tbNum - 8) / 8) + 1;
|
||||
|
||||
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++)
|
||||
for (int num = 1; num <= pageNum; num++)
|
||||
{
|
||||
ws.SetColumnWidth(i, 16 * 256);
|
||||
}
|
||||
ws.GetRow(rowIndex + 1).Height = 20 * 20 * 5;
|
||||
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");
|
||||
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 1, 2));
|
||||
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("SH/T 3503—J404");
|
||||
#region 头部
|
||||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 1, style, 1, 7, true);
|
||||
|
||||
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");
|
||||
//设置列宽度
|
||||
ws.SetColumnWidth(0, 2 * 256);
|
||||
ws.SetColumnWidth(1, 16 * 256);
|
||||
ws.SetColumnWidth(2, 16 * 256);
|
||||
ws.SetColumnWidth(3, 16 * 256);
|
||||
ws.SetColumnWidth(4, 16 * 256);
|
||||
ws.SetColumnWidth(5, 16 * 256);
|
||||
ws.SetColumnWidth(6, 19 * 256);
|
||||
ws.SetColumnWidth(7, 19 * 256);
|
||||
ws.GetRow(rowIndex).Height = 20 * 20 * 5;
|
||||
|
||||
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($"工程名称:{info?.projectName}\nProject Name:{info?.enProjectName}\n\n单位工程名称:{info?.workAreaName}\n Unit Name:{info?.enWorkAreaName}");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 1, 2));
|
||||
ws.GetRow(rowIndex).GetCell(1).SetCellValue("SH/T 3503—J404");
|
||||
|
||||
#endregion
|
||||
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, 5));
|
||||
ws.GetRow(rowIndex).GetCell(3).CellStyle = style1;
|
||||
ws.GetRow(rowIndex).GetCell(3).SetCellValue("滑动/固定管托安装检验记录\nSliding/Fixed Pipe Shoe Installation Inspection Record");
|
||||
|
||||
#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;
|
||||
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, rowIndex, 6, 7));
|
||||
ws.GetRow(rowIndex).GetCell(6).CellStyle = style2;
|
||||
ws.GetRow(rowIndex).GetCell(6).SetCellValue($"工程名称:{info?.projectName}\nProject Name:{info?.enProjectName}\n\n单位工程名称:{info?.workAreaName}\n Unit Name:{info?.enWorkAreaName}");
|
||||
|
||||
#endregion
|
||||
|
||||
#region 表格部分
|
||||
|
||||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 9, style, 1, 7, true);
|
||||
|
||||
var dStart = 0;
|
||||
var dEnd = 0;
|
||||
if (num == 1)
|
||||
{
|
||||
dStart = 0;
|
||||
dEnd = 8;
|
||||
}
|
||||
else
|
||||
ws.GetRow(rowIndex + i).Height = 20 * 20 * 2;
|
||||
{
|
||||
dStart = num == 2 ? 8 : ((num - 2) * 8) + 8;
|
||||
dEnd = ((num - 1) * 8) + 8;
|
||||
}
|
||||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||||
int j = 0;
|
||||
for (int i = 1; i <= 9; i++)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
ws.GetRow(rowIndex + i).Height = 20 * 20 * 2;
|
||||
ws.GetRow(rowIndex + i).GetCell(1).SetCellValue("管道编号/单线号\nPiping No./ Line");
|
||||
ws.GetRow(rowIndex + i).GetCell(2).SetCellValue("管托编号\nPipe Shoe No.");
|
||||
ws.GetRow(rowIndex + i).GetCell(3).SetCellValue("型 式\nType");
|
||||
ws.GetRow(rowIndex + i).GetCell(4).SetCellValue("位移方向\nDisplacement Direction");
|
||||
ws.GetRow(rowIndex + i).GetCell(5).SetCellValue("设计位移量\nDesign Displacement");
|
||||
ws.GetRow(rowIndex + i).GetCell(6).SetCellValue("安装位移量\nInstallation Displacement");
|
||||
ws.GetRow(rowIndex + i).GetCell(7).SetCellValue("检验结果\nInspection Result");
|
||||
}
|
||||
else
|
||||
{
|
||||
ws.GetRow(rowIndex + i).Height = 20 * 20;
|
||||
if (pageTb.Rows.Count > j)
|
||||
{
|
||||
var dr = pageTb.Rows[j];
|
||||
ws.GetRow(rowIndex + i).GetCell(1).SetCellValue("模拟数据");
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 尾部
|
||||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 10, rowIndex + 13, style, 1, 7, true);
|
||||
ws.GetRow(rowIndex + 10).Height = 20 * 20 * 2;
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 10, rowIndex + 10, 1, 7));
|
||||
ws.GetRow(rowIndex + 10).GetCell(1).CellStyle = style2;
|
||||
ws.GetRow(rowIndex + 10).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 + 11).Height = 20 * 20 * 2;
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 1, 7));
|
||||
ws.GetRow(rowIndex + 11).GetCell(1).CellStyle = style2;
|
||||
ws.GetRow(rowIndex + 11).GetCell(1).SetCellValue(" 备注:\n Remarks:");
|
||||
|
||||
ws.GetRow(rowIndex + 12).Height = 20 * 20 * 2;
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 1, 2));
|
||||
ws.GetRow(rowIndex + 12).GetCell(1).SetCellValue("建设/监理单位\nOwner/JianLi Contractor");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 3, 5));
|
||||
ws.GetRow(rowIndex + 12).GetCell(3).SetCellValue("总 承 包 单 位\nGeneral Contractor");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 6, 7));
|
||||
ws.GetRow(rowIndex + 12).GetCell(6).SetCellValue("施 工 单 位\nConstruction Contractor");
|
||||
|
||||
ws.GetRow(rowIndex + 13).Height = 20 * 20 * 6;
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 13, rowIndex + 13, 1, 2));
|
||||
ws.GetRow(rowIndex + 13).GetCell(1).CellStyle = style2;
|
||||
ws.GetRow(rowIndex + 13).GetCell(1).SetCellValue(" 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 13, rowIndex + 13, 3, 5));
|
||||
ws.GetRow(rowIndex + 13).GetCell(3).CellStyle = style2;
|
||||
ws.GetRow(rowIndex + 13).GetCell(3).SetCellValue(" 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 13, rowIndex + 13, 6, 7));
|
||||
ws.GetRow(rowIndex + 13).GetCell(6).CellStyle = style2;
|
||||
ws.GetRow(rowIndex + 13).GetCell(6).SetCellValue(" 施工班组长:\n Foreman:\n 质量检查员:\n Quality Inspector:\n 专业工程师:\n Discipline Engineer: \n 日期(DATE): 年 月 日");
|
||||
|
||||
#endregion
|
||||
|
||||
rowIndex += 14;
|
||||
}
|
||||
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.Landscape = true;
|
||||
ws.ForceFormulaRecalculation = true;
|
||||
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);
|
||||
//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)
|
||||
{
|
||||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||||
#region 头部
|
||||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, true, false, "宋体");
|
||||
|
||||
//模拟数据
|
||||
string sql = @"select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||||
var tbNum = dt.Rows.Count;
|
||||
var pageNum = tbNum < 16 ? 1 : Math.Ceiling((float)(tbNum - 16) / 16) + 1;
|
||||
|
||||
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($"工程名称:{info?.projectName}");
|
||||
ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue($"Project Name:{info?.enProjectName}");
|
||||
ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue($"单位工程名称:{info?.workAreaName}");
|
||||
ws.GetRow(rowIndex + 3).GetCell(10).SetCellValue($"Unit Name:{info?.enWorkAreaName}");
|
||||
|
||||
|
||||
|
||||
#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++)
|
||||
for (int num = 1; num <= pageNum; num++)
|
||||
{
|
||||
ws.GetRow(rowIndex + i).Height = 20 * 20;
|
||||
#region 头部
|
||||
var style = 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, 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(rowIndex + 0, rowIndex + 3, 0, 1));
|
||||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3503-J405");
|
||||
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 0, rowIndex + 3, 2, 9));
|
||||
ws.GetRow(rowIndex).GetCell(2).SetCellValue("管道补偿器安装检验记录\r\nPipe Compensator Installation Inspection Record");
|
||||
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 0, rowIndex + 0, 10, 12));
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 10, 12));
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 12));
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 10, 12));
|
||||
|
||||
ws.GetRow(rowIndex).GetCell(10).SetCellValue($"工程名称:{info?.projectName}");
|
||||
ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue($"Project Name:{info?.enProjectName}");
|
||||
ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue($"单位工程名称:{info?.workAreaName}");
|
||||
ws.GetRow(rowIndex + 3).GetCell(10).SetCellValue($"Unit Name:{info?.enWorkAreaName}");
|
||||
|
||||
ws.GetRow(rowIndex).HeightInPoints = 19.8f;
|
||||
ws.GetRow(rowIndex + 1).HeightInPoints = 13.8f;
|
||||
ws.GetRow(rowIndex + 2).HeightInPoints = 28f;
|
||||
ws.GetRow(rowIndex + 3).HeightInPoints = 28f;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 表格部分
|
||||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 4, rowIndex + 5, style, 0, 12, true);
|
||||
|
||||
ws.GetRow(rowIndex + 4).HeightInPoints = 30f;
|
||||
ws.GetRow(rowIndex + 5).HeightInPoints = 30f;
|
||||
//设置表头部分
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 0, 0));
|
||||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("管道编号/单线号\r\nPiping No./Line No");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 1, 2));
|
||||
ws.GetRow(rowIndex + 4).GetCell(1).SetCellValue("补偿器编号\r\nCompensator No.");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 3, 3));
|
||||
ws.GetRow(rowIndex + 4).GetCell(3).SetCellValue("型式\r\nType");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 4, 4));
|
||||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue("规格\r\nSpecification");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 5, 5));
|
||||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("材质\r\nMaterial");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 6, 6));
|
||||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue("固定支架间距\r\nFixed Support SoacingM");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 7, 7));
|
||||
ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("设计压力\r\nDesign Pressure");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 8, 8));
|
||||
ws.GetRow(rowIndex + 4).GetCell(8).SetCellValue("设计温度\r\nDesign Temperature\r\n℃");
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 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(rowIndex + 4, rowIndex + 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);
|
||||
var dStart = 0;
|
||||
var dEnd = 0;
|
||||
if (num == 1)
|
||||
{
|
||||
dStart = 0;
|
||||
dEnd = 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
dStart = num == 2 ? 16 : ((num - 2) * 16) + 16;
|
||||
dEnd = ((num - 1) * 16) + 16;
|
||||
}
|
||||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||||
int j = 0;
|
||||
for (int i = 6; i <= 23; i++)
|
||||
{
|
||||
ws.GetRow(rowIndex + i).HeightInPoints = 20f;
|
||||
if (pageTb.Rows.Count > j)
|
||||
{
|
||||
var dr = pageTb.Rows[j];
|
||||
ws.GetRow(rowIndex + i).GetCell(0).SetCellValue("模拟数据");
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
#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.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 + 25).Height = 31 * 20;
|
||||
ws.GetRow(rowIndex + 26).Height = 7 * 20;
|
||||
ws.GetRow(rowIndex + 28).Height = 7 * 20;
|
||||
ws.GetRow(rowIndex + 29).Height = 7 * 20;
|
||||
|
||||
#endregion
|
||||
|
||||
rowIndex += 31;
|
||||
}
|
||||
|
||||
#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.ForceFormulaRecalculation = true;
|
||||
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.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);
|
||||
//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
|
||||
|
|
Loading…
Reference in New Issue