20260911 1

This commit is contained in:
2026-09-11 16:18:29 +08:00
parent a5b1a3c15a
commit 7d07065a00
4 changed files with 45 additions and 44 deletions
@@ -2,7 +2,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
@@ -1,6 +1,7 @@
using Aspose.Words;
using Aspose.Words.Tables;
using BLL;
using FastReport.Table;
using Model;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions;
@@ -734,6 +735,11 @@ CASE WHEN ISNUMERIC(DesignPressure)=1 THEN FORMAT(CAST(DesignPressure AS DECIMAL
table.Rows[1].RowFormat.HeadingFormat = true;
table.Rows[2].RowFormat.HeadingFormat = true;
// ====固定表格布局=====
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
table.AllowAutoFit = false;
table.Alignment = TableAlignment.Center;
// 先记录页尾行,并从表格中移除
//Row footerRow = table.Rows[table.Rows.Count - 1];
//table.Rows.RemoveAt(table.Rows.Count - 1);
@@ -746,12 +752,12 @@ CASE WHEN ISNUMERIC(DesignPressure)=1 THEN FORMAT(CAST(DesignPressure AS DECIMAL
row.Cells.Add(CreateCell(tb.Rows[i]["PipelineCode"].ToString(), doc, 65.49, "", ""));//单线号
row.Cells.Add(CreateCell(tb.Rows[i]["PipelineLevel"].ToString(), doc, 37.14, "", ""));//管道级别
row.Cells.Add(CreateCell(tb.Rows[i]["DesignPressure"].ToString(), doc, 27.78, "", ""));//设计压力
row.Cells.Add(CreateCell(tb.Rows[i]["DesignTemperature"].ToString(), doc, 28.07, "", ""));//设计温度
row.Cells.Add(CreateCell(tb.Rows[i]["DesignTemperature"].ToString(), doc, 28.06, "", ""));//设计温度
row.Cells.Add(CreateCell(tb.Rows[i]["OperatingTemperature"].ToString(), doc, 28, "", ""));//操作温度
row.Cells.Add(CreateCell(tb.Rows[i]["Medium"].ToString(), doc, 34.86, "", ""));//输送介质
row.Cells.Add(CreateCell(tb.Rows[i]["Medium"].ToString(), doc, 34.87, "", ""));//输送介质
row.Cells.Add(CreateCell(tb.Rows[i]["Material"].ToString(), doc, 43.66, "", ""));//管道材质牌号及标准
row.Cells.Add(CreateCell(tb.Rows[i]["Specifications"].ToString(), doc, 59.82, "", ""));//管道规格(外径×壁厚mm
row.Cells.Add(CreateCell(tb.Rows[i]["Length"].ToString(), doc, 34.587, "", ""));//管道长度(m)
row.Cells.Add(CreateCell(tb.Rows[i]["Length"].ToString(), doc, 34.58, "", ""));//管道长度(m)
row.Cells.Add(CreateCell(tb.Rows[i]["LayingMethod"].ToString(), doc, 33.74, "", ""));//铺设方式
row.Cells.Add(CreateCell(tb.Rows[i]["WeldsNum"].ToString(), doc, 27, "", ""));//焊口数量
row.Cells.Add(CreateCell(tb.Rows[i]["LosslessRatio"].ToString(), doc, 45.93, "", ""));//检测方法/比例(%)
@@ -763,7 +769,7 @@ CASE WHEN ISNUMERIC(DesignPressure)=1 THEN FORMAT(CAST(DesignPressure AS DECIMAL
row.Cells.Add(CreateCell(string.Format("{0:yyyy.MM.dd}", tb.Rows[i]["LeakageTestDate"]), doc, 48.76, "", ""));//泄漏性试验-日期
row.Cells.Add(CreateCell(tb.Rows[i]["CleaningMethod"].ToString(), doc, 26.08, "", ""));//吹洗方法
row.Cells.Add(CreateCell(tb.Rows[i]["CorrosionControlMethod"].ToString(), doc, 56.7, "", ""));//防腐方式
row.Cells.Add(CreateCell(tb.Rows[i]["InsulationMethod"].ToString(), doc, 22, "", ""));//保温(绝热)方式
row.Cells.Add(CreateCell(tb.Rows[i]["InsulationMethod"].ToString(), doc, 22.11, "", ""));//保温(绝热)方式
table.Rows.Insert(i + 3, row);
}
@@ -774,44 +780,39 @@ CASE WHEN ISNUMERIC(DesignPressure)=1 THEN FORMAT(CAST(DesignPressure AS DECIMAL
int remainder = totalDataRows % rowsPerPage;
int needBlankRows = remainder == 0 ? 0 : rowsPerPage - remainder;
//// 插入空白行(和数据行格式保持一致,仅内容为空)
//for (int i = 0; i < needBlankRows - 1; i++)
//{
// Aspose.Words.Tables.Row blankRow = new Aspose.Words.Tables.Row(doc);
// // 空白行的单元格宽度和数据行保持一致
// blankRow.Cells.Add(CreateCell("", doc, 22.68, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 65.49, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 37.14, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 27.78, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 28.07, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 28.06, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 34.86, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 43.66, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 59.82, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 34.587, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 33.74, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 27.78, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 45.93, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 37.14, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 30.62, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 48.76, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 25.23, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 28.92, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 48.76, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 26.08, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 56.7, "", ""));
// blankRow.Cells.Add(CreateCell("", doc, 22, "", ""));
// // 插入到表格最后一行
// table.Rows.Add(blankRow);
//}
// 插入空白行(和数据行格式保持一致,仅内容为空)
for (int i = 0; i < needBlankRows - 1; i++)
{
Aspose.Words.Tables.Row blankRow = new Aspose.Words.Tables.Row(doc);
// 空白行的单元格宽度和数据行保持一致
blankRow.Cells.Add(CreateCell("", doc, 22.68, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 65.49, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 37.14, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 27.78, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 28.06, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 28, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 34.87, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 43.66, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 59.82, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 34.58, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 33.74, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 27, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 45.93, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 37.14, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 30.62, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 48.76, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 25.23, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 28.92, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 48.76, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 26.08, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 56.7, "", ""));
blankRow.Cells.Add(CreateCell("", doc, 22.11, "", ""));
// 插入到表格最后一行
table.Rows.Add(blankRow);
}
//把页尾行重新加回表格最后
//table.Rows.Add(footerRow);
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
table.Alignment = TableAlignment.Center;
doc.Save(newUrl);
string fileName = Path.GetFileName(newUrl);
+2 -2
View File
@@ -11,7 +11,7 @@
<FineUIPro DebugMode="false" Theme="Cupertino"/>
<appSettings>
<!--连接字符串-->
<add key="ConnectionString" value="Server=.\MSSQLSERVER01;Database=HJGLDB_DS;Integrated Security=False;User ID=sa;Password=1111;MultipleActiveResultSets=true;Max Pool Size = 1000;Connect Timeout=1200"/>
<add key="ConnectionString" value="Server=.\SQL2022;Database=HJGLDB_DS;Integrated Security=False;User ID=sa;Password=1111;MultipleActiveResultSets=true;Max Pool Size = 1000;Connect Timeout=1200"/>
<!--系统名称-->
<add key="SystemName" value="诺必达焊接管理系统"/>
<add key="ChartImageHandler" value="storage=file;timeout=20;url=~/Images/;"/>
@@ -67,7 +67,7 @@
<add path="ChartImg.axd" verb="GET,POST,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport"/>
</httpHandlers>
<compilation debug="true" targetFramework="4.6.1">
<compilation debug="false" targetFramework="4.6.1">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />