- private void toolStripMenuItem6_Click(object sender, EventArgs e)
- {
- int nrows = 1;
- nrows = nrows + 2;
- int iresult = 1600;
- if (_textControl.Tables.Add(nrows, 2, iresult))
- {
- Table t = _textControl.Tables.GetItem(iresult);
- FormatTableRow(t.Rows.GetItem(1), 1, 1, 1, 1, true, true);
- for (int i = 2; i < nrows; i++)
- {
- FormatTableRow(t.Rows.GetItem(i), 1, 1, 1, 1, false, true);
- }
- FormatTableRow(t.Rows.GetItem(nrows), 1, 1, 1, 1, false, true);
- int w = t.Columns.GetItem(1).Width + t.Columns.GetItem(2).Width;
- t.Columns.GetItem(1).Width = Convert.ToInt32(w * 0.3);
- t.Columns.GetItem(2).Width = Convert.ToInt32(w * 0.7);
- MergeCells(t, t.Cells.GetItem(1, 1), t.Cells.GetItem(1, 2));
- MergeCells(t, t.Cells.GetItem(nrows, 1), t.Cells.GetItem(nrows, 2));
- SetCell(t, t.Cells.GetItem(1, 1), "资质要求", "宋体", 8 * 24, true, VerticalAlignment.Center, TXTextControl.HorizontalAlignment.Center);
- SetCell(t, t.Cells.GetItem(nrows, 1), "以上资质要求,投标人只要符合任何一条,但同一条中的多项资质要求需同时满足。", "宋体", 8 * 24, true, VerticalAlignment.Center, TXTextControl.HorizontalAlignment.Center);
- }
- }
- private void FormatTableRow(TableRow tr, int left, int right, int bottom, int top, bool ishead, bool pagebreak)
- {
- tr.CellFormat.LeftBorderColor = System.Drawing.Color.Black;
- tr.CellFormat.RightBorderColor = System.Drawing.Color.Black;
- tr.CellFormat.BottomBorderColor = System.Drawing.Color.Black;
- tr.CellFormat.TopBorderColor = System.Drawing.Color.Black;
- tr.CellFormat.LeftTextDistance = 0;
- tr.CellFormat.RightTextDistance = 0;
- tr.CellFormat.TopTextDistance = 0;
- tr.CellFormat.BottomTextDistance = 0;
- tr.CellFormat.LeftBorderWidth = left;
- tr.CellFormat.RightBorderWidth = right;
- tr.CellFormat.TopBorderWidth = top;
- tr.CellFormat.BottomBorderWidth = bottom;
- tr.IsHeader = ishead;
- tr.AllowPageBreak = pagebreak;
- }
- private void MergeCells(Table t, TableCell begincell, TableCell endcell)
- {
- _textControl.Selection.Start = begincell.Start - 1;
- _textControl.Selection.Length = (endcell.Start + endcell.Length) - (begincell.Start - 1);
- t.MergeCells();
- }
- private void SetCell(Table t, TableCell cell, string value, string fontname, int fontsize, bool bold, VerticalAlignment va, TXTextControl.HorizontalAlignment ha)
- {
- cell.Text = value;
- cell.CellFormat.VerticalAlignment = va;
- cell.Select();
- _textControl.Selection.FontName = fontname;
- _textControl.Selection.FontSize = fontsize;
- _textControl.Selection.ParagraphFormat.Alignment = ha;
- _textControl.Selection.Bold = bold;
- }
复制代码 |