找回密码
 立即注册

QQ登录

只需一步,快速开始

hptj

高级会员

72

主题

240

帖子

1170

积分

高级会员

积分
1170

活字格认证微信认证勋章元老葡萄

hptj
高级会员   /  发表于:2013-11-28 16:26  /   查看:4727  /  回复:3
Demo.rar (330.33 KB, 下载次数: 3)

3 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2013-11-28 18:25:00
沙发
回复 1楼hptj的帖子

需要设置 Border 的宽度才能导出,代码如下:

  1. private void PrehandleHeader()
  2.         {
  3.             HeaderFooter header = _currentSection.HeadersAndFooters.GetItem(TXTextControl.HeaderFooterType.Header);
  4.             if (header != null)
  5.             {
  6.                 header.Activate();
  7.                 header.Selection = new Selection(0, -1);
  8.                 header.Selection.FontName = _fontName;
  9.                 foreach (Table table in tc.Tables)
  10.                 {
  11.                     foreach (TableCell cell in table.Cells)
  12.                     {
  13.                         tc.Selection.Start = cell.Start;
  14.                         tc.Selection.Length = cell.Length;
  15.                         tc.Selection.FontName = _fontName;
  16.                         tc.Selection.Length = 0;

  17.                         cell.CellFormat.BottomBorderWidth = 1;
  18.                         cell.CellFormat.LeftBorderWidth = 1;
  19.                         cell.CellFormat.RightBorderWidth = 1;
  20.                         cell.CellFormat.TopBorderWidth = 1;
  21.                     }
  22.                 }
  23.                 header.Deactivate();

  24.             }
  25.         }
  26. private void PrehandleTable()
  27.         {
  28.             foreach (Table table in tc.Tables)
  29.             {
  30.                 foreach (TableCell cell in table.Cells)
  31.                 {
  32.                     tc.Selection.Start = cell.Start;
  33.                     tc.Selection.Length = cell.Length;
  34.                     tc.Selection.FontName = _fontName;
  35.                     tc.Selection.Length = 0;

  36.                     cell.CellFormat.BottomBorderWidth = 1;
  37.                     cell.CellFormat.LeftBorderWidth = 1;
  38.                     cell.CellFormat.RightBorderWidth = 1;
  39.                     cell.CellFormat.TopBorderWidth = 1;
  40.                 }
  41.             }
  42.         }

复制代码
回复 使用道具 举报
hptj
高级会员   /  发表于:2013-11-29 09:13:00
板凳
Nice work,Thanks.
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2013-11-29 10:07:00
地板
回复 3楼hptj的帖子

不客气,有问题欢迎开新帖提问。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部