|
@@ -3,7 +3,9 @@ using Aspose.Words;
|
|
|
using Aspose.Words.Drawing;
|
|
|
using Aspose.Words.Tables;
|
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
+using MySqlX.XDevAPI.Relational;
|
|
|
using NPOI.HSSF.UserModel;
|
|
|
+using NPOI.SS.Format;
|
|
|
using NPOI.SS.UserModel;
|
|
|
using NPOI.SS.Util;
|
|
|
using NPOI.XSSF.UserModel;
|
|
@@ -10901,6 +10903,7 @@ ORDER by gctggrc.id DESC
|
|
|
builder.ParagraphFormat.Style.Font.Bold = true;
|
|
|
builder.Writeln(@$"VOUCHER No:{item.CheckNumber} DATE: {item.CreateTime.ToString("yyyy-MM-dd")}");
|
|
|
|
|
|
+
|
|
|
builder.StartTable();
|
|
|
|
|
|
// 设置边框颜色
|
|
@@ -10913,11 +10916,13 @@ ORDER by gctggrc.id DESC
|
|
|
builder.InsertCell();
|
|
|
builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(20);//列宽 - 百分比
|
|
|
builder.CellFormat.HorizontalMerge = CellMerge.None;
|
|
|
+ //builder.CellFormat.AllowAutoFit = false;
|
|
|
builder.ParagraphFormat.Style.Font.Name = "微软雅黑";
|
|
|
builder.ParagraphFormat.Style.Font.Size = 7.5;
|
|
|
- builder.ParagraphFormat.Style.Font.Bold = false;
|
|
|
builder.CellFormat.FitText = true;//单元格内文字设为多行(默认为单行,会影响单元格宽)
|
|
|
- builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;//对齐
|
|
|
+ builder.CellFormat.WrapText = true; //自动换行
|
|
|
+ builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;//对齐
|
|
|
+ builder.RowFormat.AllowBreakAcrossPages = false; //文字自适应大小
|
|
|
builder.ParagraphFormat.SpaceBefore = 0; //设置段前间距 0
|
|
|
builder.ParagraphFormat.SpaceAfter = 0; //设置段后间距 0
|
|
|
builder.ParagraphFormat.LineSpacingRule = LineSpacingRule.Exactly; //设置行距 固定值
|
|
@@ -11342,6 +11347,24 @@ ORDER by gctggrc.id DESC
|
|
|
builder.Writeln("");
|
|
|
}
|
|
|
|
|
|
+ #region 获取文档中的所有表格 设置文字自适应
|
|
|
+
|
|
|
+ // 获取文档中的所有表格。
|
|
|
+ foreach (Table table in doc.GetChildNodes(NodeType.Table, true))
|
|
|
+ {
|
|
|
+ // 遍历表格中的所有行。
|
|
|
+ foreach (Aspose.Words.Tables.Row row in table.Rows)
|
|
|
+ {
|
|
|
+ foreach (Cell cell in row.Cells)
|
|
|
+ {
|
|
|
+ Aspose.Words.Tables.CellFormat cellFormat = cell.CellFormat;
|
|
|
+ cellFormat.Width = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
|
|
|
|
|
|
#region 设置页眉
|