合并部分代码如下:第一页显示正常,但是第二页的表头合并出错了,只合并了 .TableCell(tcColSpan, 1, 4) = 3这句,其他的都按照列左右合并的,没有按照上下合并。
with vsprinter1
bt1 = Array("", "校 名", "校 址", "人数", "人数", "人数", "参加军训学生")
bt2 = Array("", "校 名", "校 址", "合计", "教职工", "学生", "参加军训学生")
bt_w = Array(2060, 3675, 3300, 800, 800, 800, 800)
y = .CurrentY
x = .CurrentX .StartTable
.TableCell(tcCols) = 7
.TableCell(tcRows) = 2.TableCell(tcAlign) = taCenterMiddle
.TableCell(tcRowHeight) = 887
For i = 1 To 7
.TableCell(tcColWidth, 1, i) = bt_w(i - 1)
.TableCell(tcText, 1, i) = bt1(i - 1)
.TableCell(tcColWidth, 2, i) = bt_w(i - 1)
.TableCell(tcText, 2, i) = bt2(i - 1)
Next
x1 = x + .TableCell(tcColWidth, 1, 1) / 2
y1 = y
x2 = x + .TableCell(tcColWidth, 1, 1)
y2 = y + .TableCell(tcRowHeight, 1, 1) * 2
x3 = x
y3 = y + .TableCell(tcRowHeight, 1, 1)
.TableCell(tcRowSpan, 1, 1) = 2
.TableCell(tcRowSpan, 1, 2) = 2
.TableCell(tcRowSpan, 1, 3) = 2
.TableCell(tcColSpan, 1, 4) = 3
.TableCell(tcRowSpan, 1, 7) = 2
.TableCell(tcAlign, 1, 1) = taCenterTop
.TableCell(tcText, 1, 1) = " 项目" & vbCrLf & "数量 " & vbCrLf & vbCrLf & "单位 "
.DrawLine x1, y1, x2, y2
.DrawLine x3, y3, x2, y2
.EndTable
end with
后面两句是为了在第一个单元格力面画上两条斜线,然后把“项目”,“数量”,“单位“显示在三栏里面。
如果用VSFlexGrid来合并单元格,那么这个斜线的问题又很难解决,现在第一页是正常的显示,第二页,所有的上下合并都变成了左右合并。那位高手来帮忙啊!!~~~~
with vsprinter1
bt1 = Array("", "校 名", "校 址", "人数", "人数", "人数", "参加军训学生")
bt2 = Array("", "校 名", "校 址", "合计", "教职工", "学生", "参加军训学生")
bt_w = Array(2060, 3675, 3300, 800, 800, 800, 800)
y = .CurrentY
x = .CurrentX .StartTable
.TableCell(tcCols) = 7
.TableCell(tcRows) = 2.TableCell(tcAlign) = taCenterMiddle
.TableCell(tcRowHeight) = 887
For i = 1 To 7
.TableCell(tcColWidth, 1, i) = bt_w(i - 1)
.TableCell(tcText, 1, i) = bt1(i - 1)
.TableCell(tcColWidth, 2, i) = bt_w(i - 1)
.TableCell(tcText, 2, i) = bt2(i - 1)
Next
x1 = x + .TableCell(tcColWidth, 1, 1) / 2
y1 = y
x2 = x + .TableCell(tcColWidth, 1, 1)
y2 = y + .TableCell(tcRowHeight, 1, 1) * 2
x3 = x
y3 = y + .TableCell(tcRowHeight, 1, 1)
.TableCell(tcRowSpan, 1, 1) = 2
.TableCell(tcRowSpan, 1, 2) = 2
.TableCell(tcRowSpan, 1, 3) = 2
.TableCell(tcColSpan, 1, 4) = 3
.TableCell(tcRowSpan, 1, 7) = 2
.TableCell(tcAlign, 1, 1) = taCenterTop
.TableCell(tcText, 1, 1) = " 项目" & vbCrLf & "数量 " & vbCrLf & vbCrLf & "单位 "
.DrawLine x1, y1, x2, y2
.DrawLine x3, y3, x2, y2
.EndTable
end with
后面两句是为了在第一个单元格力面画上两条斜线,然后把“项目”,“数量”,“单位“显示在三栏里面。
如果用VSFlexGrid来合并单元格,那么这个斜线的问题又很难解决,现在第一页是正常的显示,第二页,所有的上下合并都变成了左右合并。那位高手来帮忙啊!!~~~~
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货