首页 > 学院 > 开发设计 > 正文

C#对特定列的特殊格式设置

2019-11-17 04:19:19
字体:
来源:转载
供稿:网友

基本环境如上一篇

    Excel.Cells.Font.Size = 12;     //字体大小
    excel.Cells.Font.Bold = false;        //是否是粗体

以上是对所有列都有效的,要对特定列的要用以下的方法
     //  Excel.Range m_objRange = m_objRange.get_Range(1, 3);
     wSheet.get_Range(excel.Cells[1, 3], excel.Cells[1, 3]).Font.Size = 24;
     wSheet.get_Range(excel.Cells[1, 3], excel.Cells[1, 3]).Font.Bold = true;
     wSheet.get_Range(excel.Cells[3, 1], excel.Cells[3, 1]).Font.ColorIndex = 3;//此处设为红色,不能  用 Font.Color来设置颜色


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表