MFC API 设置Excel单元格格式

 

常见的单元格数据格式:
Range("a1").NumberFormat = "0.00" '将数字设置为两位小数;
Range("a1").NumberFormat = "0.00%" '将数字设置为两位小数的百分数;
Range("a1").NumberFormat = "000000" '将数字设置为6位整数(邮编);
Range("a1").NumberFormat = "@" '将数字设置为文本;
RRange("a1").NumberFormat = "[DBNum2]" '将数字设置为中文大写;
RRange("a1").NumberFormatLocal = "(¥#,##0.00_); [红色] (¥#,##0.00)" '将数字设置为人民币;
Range("a1").NumberFormat = "yyyy年m月d日" '设置为日期;
Range("a1").NumberFormat = "yyyy年m月d日aaaa" '设置为日期星期几;
Range("a1").NumberFormat = "yyyy-m-d dddd" '设置为日期星期几;
Range("a1").NumberFormat = "mmmm" ' 设置英文全称;
Range("a1").NumberFormat = "mmm" '设置英文简称;
Range("a1").NumberFormat = "aaaa" '设置汉语星期;
Range("a1").NumberFormat = "dddd" '设置英语星期;
Range("a1").NumberFormat = ";;" '隐藏单元格数字;
Range("a1").NumberFormat = ";;;" '将隐藏单元格数字和文本
Range("a1").NumberFormat = "0;-0;;@" '隐藏单元格零值

你可能感兴趣的:(VC++,MFC,编程小技巧,MFC,EXCEL,设置单元格格式)