Find and replace text in Excel using C# -


i find , replace group of text in excel using c#, want replace happen text in first row only.

i have used google , found few paid resource aspose api,spire.xls,etc, looking open source resource or other efficient way achieve this. please suggest.

try this:

public static void replacetextinexcelfile(string filename, string replace, string replacement) {     object m = type.missing;      // open excel.     application app = new applicationclass();      // open workbook.      workbook wb = app.workbooks.open(         filename,         m, false, m, m, m, m, m, m, m, m, m, m, m, m);      // active worksheet. (replace if need to.)      worksheet ws = (worksheet)wb.activesheet;      // used range.      range r = (range)ws.usedrange;      // call replace method replace instances.      bool success = (bool)r.replace(         replace,         replacement,         xllookat.xlwhole,         xlsearchorder.xlbyrows,         true, m, m, m);      // save , close.      wb.save();     app.quit();     app = null; } 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -