mistic, adCmdTable ''打开签名表
rst_qm.MoveFirst
''****************************工作表初使化***********************************
Dim xlsheet As excel.Worksheet
Set xlsheet = xlbook.Sheets.Add ''添加一张工作表
xlsheet.Name = "工程量汇总"
xls.ActiveSheet.PageSetup.Orientation = xlLandscape ''纸张设置为横向
xlsheet.Columns("a:j").Font.Size = 10
xlsheet.Columns("a:j").VerticalAlignment = xlVAlignCenter ''垂直居中
xlsheet.Columns(1).HorizontalAlignment = xlHAlignCenter ''1列水平居中对齐
xlsheet.Columns(1).ColumnWidth = 8
xlsheet.Columns(2).HorizontalAlignment = xlHAlignLeft
xlsheet.Columns(2).ColumnWidth = 26
xlsheet.Columns("c:j").HorizontalAlignment = xlHAlignRight
xlsheet.Columns("c:j").ColumnWidth = 10
xlsheet.Columns("c:j").NumberFormatLocal = "0.00_ " ''3到10列保留两位小数
''***************************写入标头*************************************
xlsheet.Rows(1).RowHeight = 40
xlsheet.Range(xlsheet.Cells(1, 1), xlsheet.Cells(1, 10)).MergeCells = True
xlsheet.Cells(1, 1).Value = "工程量汇总"
xlsheet.Cells(1, 1).Font.Size = 14
xlsheet.Cells(1, 1).Font.Bold = True
xlsheet.Rows(2).RowHeight = 18
xlsheet.Rows(2).HorizontalAlignment = xlHAlignCenter
xlsheet.Cells(2, 1).Value = "序号"
xlsheet.Cells(2, 2).Value = "工程项目及名称"
xlsheet.Cells(2, 3).Value = "土方开挖(m3)"
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