首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET Framework >

使用EPPlus怎么在代码中替换Excel里面的公式,并且保存。

2013-01-19 
使用EPPlus如何在代码中替换Excel里面的公式,并且保存。。string str worksheet.Cells[E22].Formulastr

使用EPPlus如何在代码中替换Excel里面的公式,并且保存。。


                        string str = worksheet.Cells["E22"].Formula;
                        str = str.Replace("AAA()", "1");
                        str = str.Replace("BBB()", "2");
                        str = str.Replace("ccc()", "3");
                        //str.Substring(
                        worksheet.Cells["E22"].Formula = str;
                        //ep.Workbook.Properties.SetCustomPropertyValue
                        ep.Save();
                        //ep.SaveAs(new FileInfo(fileName));
                        //worksheet.Cells["E22"].Formula = "1";
                        //worksheet.Cells["E22"].Formula.Insert(1, str);
                        Console.WriteLine(worksheet.Cells["E22"].Formula);


用这段代码我可以把公式替换了,但是我不知道怎么保存了~ 请会玩EPPlus的指导下,我是刚用这个,对于EPPlus以前也根本不了解~ 但是客户要求用这个做,没办法~~愁啊..
[解决办法]
没怎么用过,仔细瞅瞅源代码吧,里面应该有介绍

热点排行