找回密码
 立即注册

QQ登录

只需一步,快速开始

ninja_aya

中级会员

54

主题

197

帖子

561

积分

中级会员

积分
561

活字格认证

ninja_aya
中级会员   /  发表于:2015-7-8 15:27  /   查看:4790  /  回复:8
TX Text Control Words - 副本.zip (3.01 MB, 下载次数: 104)

8 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2015-7-8 17:22:00
沙发
回复 1楼ninja_aya的帖子

抱歉,这个demo我跑不起来,能否把插入资质表这段代码提取出来发布到论坛上我测试?
回复 使用道具 举报
ninja_aya
中级会员   /  发表于:2015-7-9 13:55:00
板凳
  1. private void toolStripMenuItem6_Click(object sender, EventArgs e)
  2.         {
  3.             int nrows = 1;            
  4.             nrows = nrows + 2;
  5.             int iresult = 1600;
  6.             if (_textControl.Tables.Add(nrows, 2, iresult))
  7.             {
  8.                 Table t = _textControl.Tables.GetItem(iresult);
  9.                 FormatTableRow(t.Rows.GetItem(1), 1, 1, 1, 1, true, true);
  10.                 for (int i = 2; i < nrows; i++)
  11.                 {
  12.                     FormatTableRow(t.Rows.GetItem(i), 1, 1, 1, 1, false, true);
  13.                 }
  14.                 FormatTableRow(t.Rows.GetItem(nrows), 1, 1, 1, 1, false, true);
  15.                 int w = t.Columns.GetItem(1).Width + t.Columns.GetItem(2).Width;
  16.                 t.Columns.GetItem(1).Width = Convert.ToInt32(w * 0.3);
  17.                 t.Columns.GetItem(2).Width = Convert.ToInt32(w * 0.7);
  18.                 MergeCells(t, t.Cells.GetItem(1, 1), t.Cells.GetItem(1, 2));
  19.                 MergeCells(t, t.Cells.GetItem(nrows, 1), t.Cells.GetItem(nrows, 2));
  20.                 SetCell(t, t.Cells.GetItem(1, 1), "资质要求", "宋体", 8 * 24, true, VerticalAlignment.Center, TXTextControl.HorizontalAlignment.Center);
  21.                 SetCell(t, t.Cells.GetItem(nrows, 1), "以上资质要求,投标人只要符合任何一条,但同一条中的多项资质要求需同时满足。", "宋体", 8 * 24, true, VerticalAlignment.Center, TXTextControl.HorizontalAlignment.Center);

  22.             }
  23.         }

  24.         private void FormatTableRow(TableRow tr, int left, int right, int bottom, int top, bool ishead, bool pagebreak)
  25.         {
  26.             tr.CellFormat.LeftBorderColor = System.Drawing.Color.Black;
  27.             tr.CellFormat.RightBorderColor = System.Drawing.Color.Black;
  28.             tr.CellFormat.BottomBorderColor = System.Drawing.Color.Black;
  29.             tr.CellFormat.TopBorderColor = System.Drawing.Color.Black;
  30.             tr.CellFormat.LeftTextDistance = 0;
  31.             tr.CellFormat.RightTextDistance = 0;
  32.             tr.CellFormat.TopTextDistance = 0;
  33.             tr.CellFormat.BottomTextDistance = 0;
  34.             tr.CellFormat.LeftBorderWidth = left;
  35.             tr.CellFormat.RightBorderWidth = right;
  36.             tr.CellFormat.TopBorderWidth = top;
  37.             tr.CellFormat.BottomBorderWidth = bottom;
  38.             tr.IsHeader = ishead;
  39.             tr.AllowPageBreak = pagebreak;
  40.         }
  41.         private void MergeCells(Table t, TableCell begincell, TableCell endcell)
  42.         {
  43.             _textControl.Selection.Start = begincell.Start - 1;
  44.             _textControl.Selection.Length = (endcell.Start + endcell.Length) - (begincell.Start - 1);
  45.             t.MergeCells();
  46.         }
  47.         private void SetCell(Table t, TableCell cell, string value, string fontname, int fontsize, bool bold, VerticalAlignment va, TXTextControl.HorizontalAlignment ha)
  48.         {
  49.             cell.Text = value;
  50.             cell.CellFormat.VerticalAlignment = va;
  51.             cell.Select();
  52.             _textControl.Selection.FontName = fontname;
  53.             _textControl.Selection.FontSize = fontsize;
  54.             _textControl.Selection.ParagraphFormat.Alignment = ha;
  55.             _textControl.Selection.Bold = bold;
  56.         }
复制代码
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-7-9 15:33:00
地板
回复 3楼ninja_aya的帖子

问题我已经重现了,已经反馈给厂商进行处理,有进一步结果会反馈给你。谢谢
回复 使用道具 举报
ninja_aya
中级会员   /  发表于:2015-7-10 09:41:00
5#
好,请尽快吧。
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-7-10 10:05:00
6#
回复 5楼ninja_aya的帖子

好的,已经在和厂商进行沟通。
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-7-13 15:20:00
7#
回复 3楼ninja_aya的帖子

请修改合并方法为以下代码:

  1.         private void MergeCells(Table t, TableCell begincell, TableCell endcell)
  2.         {
  3.             t.Select(begincell.Row, begincell.Column, endcell.Row, endcell.Column);
  4.             t.MergeCells();
  5.         }
复制代码
回复 使用道具 举报
ninja_aya
中级会员   /  发表于:2015-7-17 10:09:00
8#
可以了,谢谢。
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-7-17 10:35:00
9#
回复 8楼ninja_aya的帖子

好的,不客气

为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢   

评分

参与人数 1满意度 +5 收起 理由
ninja_aya + 5 谢谢,问题解决

查看全部评分

回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部