Connecting Tech Pros Worldwide Forums | Help | Site Map

Export to excel

Cdude
Guest
 
Posts: n/a
#1: Jun 27 '08
I need to export into excel but not into a new worksheet each time.I
want to add the exported dataset onto an existing spreadsheet that
already has rows on it. I may have not written this to well. Please
any suggestions. Thanks

Marcin Hoppe
Guest
 
Posts: n/a
#2: Jun 27 '08

re: Export to excel


Cdude pisze:
Quote:
I need to export into excel but not into a new worksheet each time.I
want to add the exported dataset onto an existing spreadsheet that
already has rows on it. I may have not written this to well. Please
any suggestions. Thanks
The general idea is to use OLE DB provider with Microsoft Jet engine
which is capable of performing some SQL statements on Excel workbooks.
To make a long story short: first you must create a "table" in Excel
with CREATE TABLE statement (it will create a worksheet) and then you
can use regular INSERT statements to add new rows to the table, which
effectively will add rows to existing worksheet.

This article should help:

http://support.microsoft.com/kb/316934

--
Marcin Hoppe
Email: marcin.hoppe@gmail.com
Blog: http://devlicio.us/blogs/marcin_hoppe
Mark Rae [MVP]
Guest
 
Posts: n/a
#3: Jun 27 '08

re: Export to excel


"Cdude" <cameljs18@yahoo.comwrote in message
news:f0e07e1d-c43c-49d1-a077-2f679012fa03@a23g2000hsc.googlegroups.com...
Quote:
I need to export into excel but not into a new worksheet each time.I
want to add the exported dataset onto an existing spreadsheet that
already has rows on it. I may have not written this to well. Please
any suggestions. Thanks
Marcin's reply will work well if you need to add only basic data to the
existing Excel spreadsheet. However, if you need anything more than this
(e.g. formatting, formulas etc), then you could use Office Automation via
COM / Interop. However, this would require a copy of Excel installed on the
same machine as your C# app.

Alternatively, this will do what you require without a copy of Excel:
http://www.aspose.com/categories/fil...a/default.aspx


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

mario.ivic2@gmail.com
Guest
 
Posts: n/a
#4: Jun 27 '08

re: Export to excel


On May 5, 8:55 am, Cdude <camelj...@yahoo.comwrote:
Quote:
I need to export into excel but not into a new worksheet each time.I
want to add the exported dataset onto an existing spreadsheet that
already has rows on it. I may have not written this to well. Please
any suggestions. Thanks
Probably the best way to do it is to use some of the third party
component. I can recommend you GemBox.Spreadsheet .NET component. You
can find an example of exporting to dataset at: http://www.gemboxsoftware.com/LDataSet.htm.

--
Mario
GemBox.Spreadsheet for .NET - Easily read and write Excel (XLS, XLSX
or CSV) files or export to HTML files from your .NET apps. See
http://www.gemboxsoftware.com/GBSpreadsheet.htm
Closed Thread