Solved

fille Excel with Datatable

Posted on 2013-11-11
2
311 Views
Last Modified: 2013-11-25
Is there a way to fill Excel with datatable in vb.net and save it as a file?
0
Comment
Question by:VBdotnet2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Accepted Solution

by:
anarki_jimbel earned 250 total points
ID: 39640574
There are examples and tutorial on Internet. You may find one on the MSDN web site:

http://code.msdn.microsoft.com/office/Export-DataTable-object-to-b3e2c1f0

The link is about importing dataset into Excel using VB.Net.
0
 
LVL 20

Assisted Solution

by:ElrondCT
ElrondCT earned 250 total points
ID: 39640711
The method shown in the article anarki_jimbel links to will work, but it's painfully slow. If your output has more than a few thousand cells, the overhead of doing each cell individually will kill you. You're much better off loading an array with the values from the DataTable, then loading the entire array into Excel using a command like
Dim oRange As Excel.Range = excelWorkSheet.Range("A1")
oRange.Value = oData

Open in new window

where excelWorkSheet is an individual sheet in a receiving Excel workbook (file) and oData is a two-dimensional array of values, which you would completely load before executing these lines.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question