How to store data in Excel from a DataSet without going through the cells?

Duplicate : Easiest way to import System.Data.DataSet into Excel?

Using C # under VS2008, we can create an excel application, a workbook, and then a worksheet by doing the following:

Application excelApp = new Application();
Workbook excelWb = excelApp.Workbooks.Add(template);
Worksheet excelWs = (Worksheet)this.Application.ActiveSheet;

Then we can access each cell using "excelWs.Cells [i, j]" and write / save without problems. However, with a large number of rows / columns, we expect a decrease in efficiency.

Is there a way to bind data to a DataSet in a worksheet without using the cell-by-cell method? Most of the methods that we saw at some point return to a phased approach. Thanks for any suggestions.

0
source share
4 answers

Why not use ADO.NET with the OLEDB provider?

See: Tips for reading Excel spreadsheets using ADO.NET

0
source

This is a recurring question.

See: The easiest way to import a DataSet in Excel

(Answer: use OleDbConnection and read the dataset from Excel).

0
source

, , 2- excel.

object[][] values = ...
ws.Range("A1:F2000").Value = values;

OleDb , .

0

You can also display the GridView in a row and save the results for the client as HTML or XLS. If you use the .xls file extension to link data with Excel, you will see an error message when opening the file in Excel. It won't hurt anything, and your HTML data will open and look great in Excel ...

0
source

All Articles