diff --git a/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj.user b/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj.user index 6e29203..e3436b8 100644 --- a/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj.user +++ b/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj.user @@ -2,7 +2,7 @@ true - Debug|Any CPU + Release|Any CPU diff --git a/HJGL_DS/FineUIPro.Web/JGZL/IndustrialPipelineInstallationSummary2020.aspx.cs b/HJGL_DS/FineUIPro.Web/JGZL/IndustrialPipelineInstallationSummary2020.aspx.cs index cbd3e68..6421a5f 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/IndustrialPipelineInstallationSummary2020.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/IndustrialPipelineInstallationSummary2020.aspx.cs @@ -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,43 +780,38 @@ 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; + //table.Rows.Add(footerRow); doc.Save(newUrl); diff --git a/HJGL_DS/FineUIPro.Web/Web.config b/HJGL_DS/FineUIPro.Web/Web.config index 1b40665..3c98f31 100644 --- a/HJGL_DS/FineUIPro.Web/Web.config +++ b/HJGL_DS/FineUIPro.Web/Web.config @@ -11,7 +11,7 @@ - + @@ -67,7 +67,7 @@ - + diff --git a/HJGL_DS/WebAPI/WebAPI.csproj.user b/HJGL_DS/WebAPI/WebAPI.csproj.user index ef14066..8cd7f1f 100644 --- a/HJGL_DS/WebAPI/WebAPI.csproj.user +++ b/HJGL_DS/WebAPI/WebAPI.csproj.user @@ -1,7 +1,7 @@ - Debug|Any CPU + Release|Any CPU FolderProfile true