Generate Excel Spreadsheet from CSV (ASP.NET C#) -


possible duplicate:
create excel (.xls , .xlsx) file c#

i have code generates zip file contains multiple csv files , streams user (no file saved on server). however, want create excel workbook instead (can traditional xls or office open xml xlsx format) each csv 'file' being spreadsheet.

how can this, without resorting office automation on server or commercial 3rd party component?

you can use oledb generate simple tables in excel files.

note need generate temp file on server.

example.

note example incorrect , needs use oledbconnectionstringbuilder, this:

oledbconnectionstringbuilder builder = new oledbconnectionstringbuilder();  if (isopenxml)     builder.provider = "microsoft.ace.oledb.12.0"; else     builder.provider = "microsoft.jet.oledb.4.0";  builder.datasource = filename; builder["extended properties"] = "extended properties=\"excel 8.0;hdr=yes;\""  using (var con = new oledbconnection(builder.tostring())) {     ... } 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -