i'm trying save results of computations concerning analysis of text file excel file. each parsed file want create excel file word on first line of text each cell (i have data) , lines below values calculated program.
i read previous posts various methods interact excel c # did not understand characteristics of each.
thanks , regards
alessandro
there various ways work excel files in c#.
- oledb - api designed accessing data variety of sources in uniform (sql like) manner
- com - using excel object model, com interface excel application. ms excel must installed on target machine
- write data file format, excel can read
first 2 options described on csharp.net-informations.com site
if don't need perform fancy excel operations code recommand using third approach - write data csv file. can open in excel , easy create csv file.
you can use like:
using(textwriter tw = new streamwriter("sample.csv") { // header tw.writeline("x,y"); foreach(var item in data) { tw.writeline(item.x.tostring(invariantculture) + "," + item.y.tostring(invariantculture)); } }
Comments
Post a Comment