#region 对Word中所有的表格格式进行修改
private static Table EditCell(Table table, Document doc, int row, int cell, string value)
{
Aspose.Words.Tables.Cell c = table.Rows[row].Cells[cell];
Paragraph p = new Paragraph(doc);
p.AppendChild(new Run(doc, value));
p.ParagraphFormat.Style.Font.Size = 8; //设置字体大小
p.ParagraphFormat.Style.Font.Name = "宋体"; //设置字体格式
c.FirstParagraph.Remove();
c.AppendChild(p);
table.Rows[row].Cells[cell].Remove();
table.Rows[row].Cells.Insert(cell, c);
return table;
}
#endregion
#region 对Word中某一个表格格式进行修改
private static Table EditCell(Table table, Document doc, int row, int cell, string value)
{
Aspose.Words.Tables.Cell c = table.Rows[row].Cells[cell];
Paragraph p = new Paragraph(doc);
Run r = new Run(doc, value);
r.Font.Name = "字体";
r.Font.Size = 11;//字号
r.Font.Bold = true; //加粗
p.ParagraphFormat.Alignment = ParagraphAlignment.Center; //水平居中
p.AppendChild(r);
table.Rows[row].Cells[cell].Remove();
table.Rows[row].Cells.Insert(cell, p);
return table;
}
#endregion