C#导出Excel时,想给其中某个单元格赋值一个计算公式,应该怎么写呀,在线等,解决问题就给分

解决方案 »

  1.   

    Excel.cell[1,1] = "=SUM(A1,B1)"
      

  2.   


      //求和公式
                            string strFormula = "";
                            for(int nPageTmp = 1; nPageTmp < nPage; ++nPageTmp)
                                strFormula += string.Format("土方表{0}!{1}{2},", nPageTmp, sColName, 49);
                            strFormula += string.Format("土方表{0}!{1}{2}", nPage, sColName, 49);
                            strFormula = string.Format("=SUM({0})", strFormula);
                            orangSum.Formula = strFormula;
                            orangSum.Calculate();
      

  3.   

    可以看看这个。c#导出excel操作Excel公式