解决方案 »

  1.   

    用什么开发,Excel对象模型吗。参考我写的一个共通
    http://blog.csdn.net/beckhans/archive/2008/08/22/2814570.aspx
      

  2.   

     public void CellsBackColor(int startRow, int startColumn, int endRow, int endColumn, ExcelStyle.ColorIndex color)
            {
                Range range = MyExcel.get_Range(MyExcel.Cells[startRow, startColumn], MyExcel.Cells[endRow, endColumn]);
                range.Interior.ColorIndex = color;
                range.Interior.Pattern = ExcelStyle.Pattern.Solid;
            }
            public  void CellsBackColor(int startRow,int startColumn,int endRow,int endColumn,ExcelStyle.ColorIndex color,ExcelStyle.Pattern pattern){
                Range range = MyExcel.get_Range(MyExcel.Cells[startRow, startColumn], MyExcel.Cells[endRow, endColumn]);
                range.Interior.ColorIndex = color;
                range.Interior.Pattern = pattern;
            }range = (Range)worksheet.get_Range("A1", "D1"); range.Cells.Interior.Color=System.Drawing.Color.FromArgb(255,204,153).ToArgb(); 
      

  3.   

    Excel.Range rng3=xSheet.get_Range("C6",Missing.Value);
    rng3.Value2="Hello";
    rng3.Interior.ColorIndex=6; //设置Range的背景色
      

  4.   

    (1).我的代码中,
    range.Interior.ColorIndex = color; 
    这种写法是错误的。
    提示使用
    range.Interior.set_ColorIndex()
    or 
    range.Interior.get_ColorIndex()
    (2).
    range.Cells.Interior.Color
    这种写法也报错,提示没有.Color属性。
    (3).
    range.Interior.Pattern
    其中.Pattern属性也没有。兄弟们,网上能找的,我都已经找过了,
    有机会的话,我去公司的时候把代码放进来,大家再帮忙看一下。还是谢谢大家!