.Cells(4, 7), xlsheet.Cells(5, 7)).MergeCells = True
xlsheet.Cells(4, 7).Value = "人工费"
xlsheet.Range(xlsheet.Cells(4, 8), xlsheet.Cells(5, 8)).MergeCells = True
xlsheet.Cells(4, 8).Value = "燃料费"
xlsheet.Range(xlsheet.Cells(4, 9), xlsheet.Cells(5, 9)).MergeCells = True
xlsheet.Cells(4, 9).Value = "其他费"
xlsheet.Range(xlsheet.Cells(1, 1), xlsheet.Cells(5, 9)).HorizontalAlignment = xlHAlignCenter
xls.ActiveSheet.PageSetup.PrintTitleRows = "$1:$5" ''固定表头
''****************************************写入内容*************************************
Dim i As Integer
i = 6
Do While Not rst_tsf.EOF
xlsheet.Cells(i, 1).Value = rst_tsf.Fields("nn")
xlsheet.Cells(i, 2).Value = rst_tsf.Fields("name")
xlsheet.Cells(i, 3).Value = rst_tsf.Fields("price")
xlsheet.Cells(i, 4).Value = rst_tsf.Fields("zhejiu")
xlsheet.Cells(i, 5).Value = rst_tsf.Fields("xiuli")
xlsheet.Cells(i, 6).Value = rst_tsf.Fields("anchai")
xlsheet.Cells(i, 7).Value = rst_tsf.Fields("rengong")
xlsheet.Cells(i, 8).Value = rst_tsf.Fields("dongli")
xlsheet.Cells(i, 9).Value = rst_tsf.Fields("qita")
If i > 22 Then
xls.ActiveWindow.SmallScroll Down:=1 ''活动窗口内容向下滚动1行
End If
i = i + 1
rst_tsf.MoveNext
Loop
xlsheet.Range(xlsheet.Cells(6, 3), xlsheet.Cells(i - 1, 9)).NumberFormatLocal = "0.00_ " ''保留两位小数
''*********************************添加边框**********************************
xlsheet.Range(xlsheet.Cells(3, 1), xlsheet.Cells(i - 1, 9)).Borders.LineStyle = xlContinuous
''******************************************************************************
xls.ActiveSheet.PageSetup.BottomMargin = Application.InchesToPoints(2.2) ''设置下侧面边距
xls.ActiveSheet.PageSetup.FooterMargin = Application.InchesToPoints(1) ''设置页脚高
xls.ActiveSheet.PageSetup.CenterFooter = "&10" & rst_qm.Fields(0) & Chr(10) & Chr(10) & rst_qm.Fields(1) & Chr(10) & Chr(10) & rst_qm.Fields(2) ''加页脚
xls.ActiveWindow.View = xlPageBreakP