|
VB中使用EXCEL输出(5) xlsheet.Cells(2, 4).Value = "石方开挖(m3)" xlsheet.Cells(2, 5).Value = "土方回填(m3)" xlsheet.Cells(2, 6).Value = "洞挖石方(m3)" xlsheet.Cells(2, 7).Value = "砼浇筑(m3)" xlsheet.Cells(2, 8).Value = "钢筋制安(t)" xlsheet.Cells(2, 9).Value = "砌石工程(m3)" xlsheet.Cells(2, 10).Value = "灌浆工程(m)" xls.ActiveSheet.PageSetup.PrintTitleRows = "$1:$2" '固定表头 '***************************写入内容************************* Dim i As Integer i = 3 'i控制行 Dim j As Integer 'j控制列 Dim countpage As Integer countpage = 0 '控制页 Do While Not rst_gcl.EOF xlsheet.Rows(i).RowHeight = 18 '控制行高 For j = 1 To 10 xlsheet.Cells(i, j) = rst_gcl.Fields(j) '将工程理库中的一条记录的第一个字段写入工作表中 Next '每18行为一页,如果数据超出一页时进行特殊处理 If i > 18 Then xls.ActiveWindow.SmallScroll Down:=1 '活动窗口内容向下滚动1行 End If If i Mod 18 = 0 Then If countpage = 0 Then xlsheet.Range(xlsheet.Cells(2, 1), xlsheet.Cells(i, 10)).Borders.LineStyle = xlContinuous '首页加边框 Else xlsheet.Range(xlsheet.Cells(23 + (countpage - 1) * 18, 1), xlsheet.Cells(i, 10)).Borders.LineStyle = xlContinuous '中间页加边框
|