|
- Dim xl As New Excel.Application
- Dim xlBook As Excel.Workbook = xl.Workbooks.Open(strSaveExcelFile)
- Dim xlSheet As Excel.Worksheet = xlBook.Sheets(1)
- Dim col As Integer
- Dim row As Integer
-
- xlSheet.Range(xlSheet.Cells(1, 1), xlSheet.Cells(80, 80)).NumberFormat = "@" '文本格式
-
- For i = 0 To Rlevel.GetUpperBound(0) '標(biāo)題
- row = 1 + i * 7 + 1
- xlSheet.Cells(1, row) = Rlevel(i) & "分鐘累積"
- xlSheet.Cells(1, row + 1) = "結(jié)束時間"
- '............
- Next
-
- '............
-
- xlSheet.Cells.Font.Size = 9
- xlSheet.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter '所有單元水平居中
- xlSheet.Cells.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter '所有單元垂直居中
-
- xlSheet.Cells.EntireColumn.AutoFit() '所有列自適合單元寬度
- xlSheet.Range("B2").Activate()
- xl.Application.ActiveWindow.FreezePanes = True '凍結(jié)窗口B2單元
-
- xlBook.Save()
- xlBook.Close()
- xl.Quit()
|