现在的位置: 首页 > 综合 > 正文

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

2013年06月04日 ⁄ 综合 ⁄ 共 466字 ⁄ 字号 评论关闭

      基本环境如上一篇

           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来设置颜色

抱歉!评论已关闭.