帮我看看吧 最后一页为何不画线了
Dim i, j As Long
Dim Rows As Long '总行数
Dim Trows, Tcols As Long '自定义表格的行数与列数
Dim Pages As Integer '页面总页数 (共几页)
Dim iPage As Integer '页面所显示当前页(第几页)
Dim iRow As Long '当前行的位置
Dim Sr, Sc As Integer
Dim Idx As Integer '打印的行数起始位置
Dim iCurrent As Integer
'*************************************制作表格*************************************
With VSPrinter1
.PaperSize = pprA4 '设置纸张类型
'.Orientation = orLandscape '设置横向打印
.Orientation = orPortrait '纵向打印
.TableBorder = tbAll '返回或设置表的边框类型
.TablePen = 10 '返回或设置单元格间边框的厚度
'.PenColor = vbRed
.PenStyle = psSolid
.PenWidth = 25
.Preview = True '是否可以预览
.Zoom = 200 '显示比例为100%
.MarginTop = 915 '设置页面四边的边距
.MarginBottom = 360
.MarginLeft = 660
.MarginRight = 735
.StartDoc '-------------------------------------------------------------------------开始文档
For iPage = 1 To 3 '设定为3页
.StartTable '-------------------------------------------------------------------------开始制表
iRows = 49 '页面表格行数
iCols = 44 '页面表格列数
.TableCell(tcRows) = iRows
.TableCell(tcCols) = iCols
'开始画表,确定行高列宽,第几列边框为粗线条与线条颜色,自定义表单元格的背景色,及第一行标题内容对齐方式
.TableCell(tcRowHeight) = 315 '设置行高
For i = 1 To iCols '设置列宽
.TableCell(tcColWidth, , i) = 280 '列宽
Next
.TableCell(tcColWidth, , 5) = 60 '列宽
.TableCell(tcColWidth, , 10) = 60 '列宽
.TableCell(tcColWidth, , 15) = 60 '列宽
.TableCell(tcColWidth, , 20) = 60 '列宽
.TableCell(tcColWidth, , 25) = 60 '列宽
.TableCell(tcColWidth, , 30) = 60 '列宽
.TableCell(tcColWidth, , 35) = 60 '列宽
.TableCell(tcColWidth, , 40) = 60 '列宽
.TableCell(tcRowHeight, 10, 1, 10, 44) = 215 '设置单独行高
.TableCell(tcRowHeight, 20, 1, 20, 44) = 215 '设置单独行高
.TableCell(tcRowHeight, 30, 1, 30, 44) = 215 '设置单独行高
.TableCell(tcRowHeight, 40, 1, 40, 44) = 215 '设置单独行高
'-------------------------------------------------------------------------------------------------
.TableCell(tcRowBorderAbove, 4, 0) = 45 '自定义 行边线 为粗线(第三行与第四行,第六行与第七行之间为粗线条)tcRowBorderColor
.TableCell(tcRowBorderColor, 4, 0) = vbRed '自定义 行边线 为粗线(第三行与第四行,第六行与第七行之间为粗线条)
.TableCell(tcRowBorderAbove, 7, 0) = 45
.TableCell(tcRowBorderAbove, 14, 0) = 45
.TableCell(tcRowBorderAbove, 17, 0) = 45
.TableCell(tcRowBorderAbove, 24, 0) = 45
.TableCell(tcRowBorderAbove, 27, 0) = 45
.TableCell(tcRowBorderAbove, 34, 0) = 45
.TableCell(tcRowBorderAbove, 37, 0) = 45
.TableCell(tcRowBorderAbove, 44, 0) = 45
.TableCell(tcRowBorderAbove, 47, 0) = 45
'-------------------------------------------------------------------------------------------------
.TableCell(tcColSpan, 10, 1) = 49 '第10行整行合并,第10行从第1列开始行合并
.TableCell(tcColSpan, 20, 1) = 49 '第20行合并
.TableCell(tcColSpan, 30, 1) = 49 '第30行合并
.TableCell(tcColSpan, 40, 1) = 49 '第40行合并
'-------------------------------------------------------------------------------------------------
.TableCell(tcRowSpan, 1, 5) = 9 '列合并,从第1行第5列第1行到第9行合并为一列!!
.TableCell(tcRowSpan, 1, 10) = 9 '列合并,从第1行第10列第1行到第9行合并为一列!!
.TableCell(tcRowSpan, 1, 15) = 9 '列合并,从第1行第15列第1行到第9行合并为一列!!
.TableCell(tcRowSpan, 1, 20) = 9
.TableCell(tcRowSpan, 1, 25) = 9
.TableCell(tcRowSpan, 1, 30) = 9
.TableCell(tcRowSpan, 1, 35) = 9
.TableCell(tcRowSpan, 1, 40) = 9
.TableCell(tcRowSpan, 11, 5) = 9
.TableCell(tcRowSpan, 11, 10) = 9 '列合并,从第11行第10列第1行到第9行合并为一列!!
.TableCell(tcRowSpan, 11, 15) = 9
.TableCell(tcRowSpan, 11, 20) = 9 '列合并,从第11行第20列第1行到第9行合并为一列!!
.TableCell(tcRowSpan, 11, 25) = 9
.TableCell(tcRowSpan, 11, 30) = 9
.TableCell(tcRowSpan, 11, 35) = 9
.TableCell(tcRowSpan, 11, 40) = 9
.TableCell(tcRowSpan, 21, 5) = 9
.TableCell(tcRowSpan, 21, 10) = 9
.TableCell(tcRowSpan, 21, 15) = 9
.TableCell(tcRowSpan, 21, 20) = 9
.TableCell(tcRowSpan, 21, 25) = 9
.TableCell(tcRowSpan, 21, 30) = 9
.TableCell(tcRowSpan, 21, 35) = 9
.TableCell(tcRowSpan, 21, 40) = 9
.TableCell(tcRowSpan, 31, 5) = 9
.TableCell(tcRowSpan, 31, 10) = 9
.TableCell(tcRowSpan, 31, 15) = 9
.TableCell(tcRowSpan, 31, 20) = 9
.TableCell(tcRowSpan, 31, 25) = 9
.TableCell(tcRowSpan, 31, 30) = 9
.TableCell(tcRowSpan, 31, 35) = 9
.TableCell(tcRowSpan, 31, 40) = 9
.TableCell(tcRowSpan, 41, 5) = 9
.TableCell(tcRowSpan, 41, 10) = 9
.TableCell(tcRowSpan, 41, 15) = 9
.TableCell(tcRowSpan, 41, 20) = 9
.TableCell(tcRowSpan, 41, 25) = 9
.TableCell(tcRowSpan, 41, 30) = 9
.TableCell(tcRowSpan, 41, 35) = 9
.TableCell(tcRowSpan, 41, 40) = 9
.TableCell(tcBackColor, 1, 5, iRows, 5) = RGB(180, 180, 180) '单元格背景色
.TableCell(tcBackColor, 1, 10, iRows, 10) = RGB(180, 180, 180)
.TableCell(tcBackColor, 1, 15, iRows, 15) = RGB(180, 180, 180)
.TableCell(tcBackColor, 1, 20, iRows, 20) = RGB(180, 180, 180)
.TableCell(tcBackColor, 1, 25, iRows, 25) = RGB(180, 180, 180)
.TableCell(tcBackColor, 1, 30, iRows, 30) = RGB(180, 180, 180)
.TableCell(tcBackColor, 1, 35, iRows, 35) = RGB(180, 180, 180)
.TableCell(tcBackColor, 1, 40, iRows, 40) = RGB(180, 180, 180)
.TableCell(tcBackColor, 10, 1, 10, iCols) = &HFFFF00 '单元格背景色
.TableCell(tcBackColor, 20, 1, 20, iCols) = &HFFFF00
.TableCell(tcBackColor, 30, 1, 30, iCols) = &HFFFF00
.TableCell(tcBackColor, 40, 1, 40, iCols) = &HFFFF00
.TableCell(tcFontName, 1, 1, iRows, iCols) = "Arial" '(标题行)的字体与字体大小
.TableCell(tcFontSize, 1, 1, iRows, iCols) = 6
.TableCell(tcFontBold, 1, 1, iRows, iCols) = True
.TableCell(tcAlign, 1, 1, iRows, iCols) = taCenterMiddle '单元格内文本对齐方式
'加入标题文本**************************************************************************************************
'**************************************************************************表格中斜上部分界线**************************************************************************
.Polyline = "660,1545,1780,2805": .Polyline = "660,3120,1780,1860"
.Polyline = "1840,1545,2960,2805": .Polyline = "1840,3120,2960,1860"
.Polyline = "3020,1545,4140,2805": .Polyline = "3020,3120,4140,1860"
.Polyline = "4200,1545,5320,2805": .Polyline = "4200,3120,5320,1860"
.Polyline = "5380,1545,6500,2805": .Polyline = "5380,3120,6500,1860"
.Polyline = "6560,1545,7680,2805": .Polyline = "6560,3120,7680,1860"
.Polyline = "7740,1545,8860,2805": .Polyline = "7740,3120,8860,1860"
.Polyline = "8920,1545,10040,2805": .Polyline = "8920,3120,10040,1860"
.Polyline = "10100,1545,11220,2805": .Polyline = "10100,3120,11220,1860"
'--------------------------------------------------------------------------------------2 左右间距1180 上下间距3050
.Polyline = "660,4595,1780,5855": .Polyline = "660,6170,1780,4910"
.Polyline = "1840,4595,2960,5855": .Polyline = "1840,6170,2960,4910"
.Polyline = "3020,4595,4140,5855": .Polyline = "3020,6170,4140,4910"
.Polyline = "4200,4595,5320,5855": .Polyline = "4200,6170,5320,4910"
.Polyline = "5380,4595,6500,5855": .Polyline = "5380,6170,6500,4910"
.Polyline = "6560,4595,7680,5855": .Polyline = "6560,6170,7680,4910"
.Polyline = "7740,4595,8860,5855": .Polyline = "7740,6170,8860,4910"
.Polyline = "8920,4595,10040,5855": .Polyline = "8920,6170,10040,4910"
.Polyline = "10100,4595,11220,5855": .Polyline = "10100,6170,11220,4910"
'--------------------------------------------------------------------------------------3 左右间距1180 上下间距3050
.Polyline = "660,7645,1780,8905": .Polyline = "660,9220,1780,7960"
.Polyline = "1840,7645,2960,8905": .Polyline = "1840,9220,2960,7960"
.Polyline = "3020,7645,4140,8905": .Polyline = "3020,9220,4140,7960"
.Polyline = "4200,7645,5320,8905": .Polyline = "4200,9220,5320,7960"
.Polyline = "5380,7645,6500,8905": .Polyline = "5380,9220,6500,7960"
.Polyline = "6560,7645,7680,8905": .Polyline = "6560,9220,7680,7960"
.Polyline = "7740,7645,8860,8905": .Polyline = "7740,9220,8860,7960"
.Polyline = "8920,7645,10040,8905": .Polyline = "8920,9220,10040,7960"
.Polyline = "10100,7645,11220,8905": .Polyline = "10100,9220,11220,7960"
'--------------------------------------------------------------------------------------4 左右间距1180 上下间距3050
.Polyline = "660,10695,1780,11955": .Polyline = "660,12270,1780,11010"
.Polyline = "1840,10695,2960,11955": .Polyline = "1840,12270,2960,11010"
.Polyline = "3020,10695,4140,11955": .Polyline = "3020,12270,4140,11010"
.Polyline = "4200,10695,5320,11955": .Polyline = "4200,12270,5320,11010"
.Polyline = "5380,10695,6500,11955": .Polyline = "5380,12270,6500,11010"
.Polyline = "6560,10695,7680,11955": .Polyline = "6560,12270,7680,11010"
.Polyline = "7740,10695,8860,11955": .Polyline = "7740,12270,8860,11010"
.Polyline = "8920,10695,10040,11955": .Polyline = "8920,12270,10040,11010"
.Polyline = "10100,10695,11220,11955": .Polyline = "10100,12270,11220,11010"
'--------------------------------------------------------------------------------------5 左右间距1180 上下间距3050
.Polyline = "660,13745,1780,15005": .Polyline = "660,15320,1780,14060"
.Polyline = "1840,13745,2960,15005": .Polyline = "1840,15320,2960,14060"
.Polyline = "3020,13745,4140,15005": .Polyline = "3020,15320,4140,14060"
.Polyline = "4200,13745,5320,15005": .Polyline = "4200,15320,5320,14060"
.Polyline = "5380,13745,6500,15005": .Polyline = "5380,15320,6500,14060"
.Polyline = "6560,13745,7680,15005": .Polyline = "6560,15320,7680,14060"
.Polyline = "7740,13745,8860,15005": .Polyline = "7740,15320,8860,14060"
.Polyline = "8920,13745,10040,15005": .Polyline = "8920,15320,10040,14060"
.Polyline = "10100,13745,11220,15005": .Polyline = "10100,15320,11220,14060"
.EndTable '-------------------------------------------------------------------------制表结束
Next iPage
.EndDoc '-------------------------------------------------------------------------结束文档
End With
|