Is if possible to use c# to access excel files? -


this question has answer here:

hi simple question want go folder excel files. go each excel file , change red font coloring black using c#. possible?

namespace excel_font_color_change {     public partial class form1 : form     {         public form1()         {              initializecomponent();         }            private void button1_click(object sender, eventargs e)         {             list<string> htmlpathlist = new list<string>();             string foldertosearch;              folderbrowserdialog fbd = new folderbrowserdialog();             fbd.shownewfolderbutton = true;//allow user create new folders through dialog             fbd.rootfolder = environment.specialfolder.mydocuments;//defaults computer             system.windows.forms.dialogresult dr = fbd.showdialog();//make sure user clicks ok             if (dr == dialogresult.ok)             {                 foldertosearch = fbd.selectedpath;//gets folder path                 try                 {                     var allfiles = files in directory.enumeratefiles(foldertosearch, "*.xls*", searchoption.alldirectories)                                    select path.getfullpath(files);//gets files htm & htm + extensions                     foreach (string filepath in allfiles)                     {                         htmlpathlist.add(filepath);//adds each filepath found list                     }                 }                 catch (unauthorizedaccessexception uaex) { console.writeline(uaex.message); }//error handling                 catch (pathtoolongexception pathex) { console.writeline(pathex.message); }//error handling                 console.writeline("1");             }         }          private void button2_click(object sender, eventargs e)         {          }     } 

this have far, want second button take file path in htmlpathlist , edit font colour black if red. looking thru how read data of excel file using c#? right now.

check out library. works xlsx though.

http://www.microsoft.com/en-us/download/details.aspx?id=5124

if want read old xls files can use interop assemblies.

http://www.microsoft.com/en-us/download/details.aspx?id=3508


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -