vba:
http://www.foxtable.com/webhelp/scr/2121.htm
NumberFormat
单元格格式是通过NumberFormat或NumberFormatLocal属性来完成的。例如:
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\Report.xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Ws.Range("A1").NumberFormat = "G/通用格式" '通用格式
Ws.Range("B1").NumberFormat = "0_ " '数值
Ws.Range("C1").NumberFormat = "#,##0.00_);[红色](#,##0.00)" '货币
Ws.Range("D1").NumberFormat = "_ * #,##0.00_;_ * -#,##0.00_ ;_ * ""-""??_ ;_ @_ " '会计专用
Ws.Range("E1").NumberFormat = "yyyy-m-d" '日期
Ws.Range("F1").NumberFormat = "h:mm:ss" '时间
Ws.Range("G1").NumberFormat = "0.00%" '百分比
Ws.Range("H1").NumberFormat = "# ?/?" '分数
Ws.Range("I1").NumberFormat = "0.00E+00" '科学记数
Ws.Range("J1").NumberFormat = "@" '文本
App.Visible = True