插入带格式表格(性能低:
代码片段
"private void cmdOK_Click(object sender, System.EventArgs e)
{
DateTime dtStart = DateTime.Now;
int newTableID = 10 + tx.Tables.Count;
int rows = (int)updownRows.Value;
int columns = (int)updownColumns.Value;
this.tx.Tables.Add(rows, columns, newTableID);
this.SetTableDefaultFormat(newTableID); // 设置表格的默认格式
this.DialogResult = DialogResult.OK;
this.Close();
}
private void SetTableBorderWidthTextDistance(Table table)
{
tx.SuspendLayout();
foreach (TableCell cell in table.Cells)
{
cell.CellFormat.TopBorderWidth =15; //0.75pt
cell.CellFormat.BottomBorderWidth =15; //0.75pt
cell.CellFormat.LeftBorderWidth =15; //0.75pt
cell.CellFormat.RightBorderWidth =15; //0.75pt
cell.CellFormat.TopTextDistance = cell.CellFormat.BottomTextDistance =
cell.CellFormat.LeftTextDistance = cell.CellFormat.RightTextDistance = 30;
cell.CellFormat.TopBorderColor = cell.CellFormat.BottomBorderColor =
cell.CellFormat.LeftBorderColor = cell.CellFormat.RightBorderColor = Color.Black;
}
tx.ResumeLayout();
}" |
-
|