views:

293

answers:

2

I want to read and write excel file . it can do with oledb , there is a limitation

  1. maximunm characters < 255
  2. solution is mono data type , now create table become second sheet (when open excel it is shown as hidden.)

please give proper answer

+1  A: 

There's twothree (Thanks Behrooz) ways of doing this, the first is using FileHelpers to create a ordinary CSV file which can be read by Excel. The other way is to use a common BIFF file format, see here on CodeProject on how to accomplish this. The third way is to use an ODBC connection to the Excel spreadsheet as shown here on Codeproject also. The fastest way of doing it IMHO is to work with the BIFF format. Also here on CodeProject is a fast Excel reader, similar to the DataReader class but for Excel only.

OpenOffice.org has extensive documentation on the binary format for the excel spreadsheets here, this is a PDF document which outlines the BIFF layout and structure.

Edit: Amended this as Behrooz pointed out a small grammer-typo....

Hope this helps, Best regards, TOm.

tommieb75
two ways or three ways?i can't understand.
Behrooz
@Behrooz: Oops! Sorry my bad....will edit this...thanks for the heads up.... :(
tommieb75
A: 

SpreadsheetGear for .NET will do it.

You can see live ASP.NET samples with C# and VB source here and download a free trial here if you want to try it yourself. The trial is fully functional for 30 days.

Disclaimer: I own SpreadsheetGear LLC

Joe Erickson