Export Data from Datatable to excel in C#.net

Posted by Winodjadhav under WPF on 4/17/2015 | Points: 10 | Views : 2151 | Status : [Member] | Replies : 1
Hi
I have a datatable fetching from DB, which contain below details.

Name Type Sub Country Price Rate
-------------------------------------------------------------------------
Currency Ifra-Red Bat India 2 5
Currency Ifra-Red Bat China 4 3
Currency Ifra-Red Bat London 1 0
Currency Ifra-Red Ball UK 2 1
Currency White Tennis Canda 1 2
Currency white Tennis UK 2 1
Equity Infra-red Hocky Pak 2 4
Equity Infra-Red Hocky India 1 5
Equity white Bat China 1 1
Equity Green Ball India 3 2
Equity Green Ball London 1 1
Equity Green Bat UK 3 2

Now my requirement is that when i click on export to excel button data should be display like this in excel sheet with below design format.

Total Price = 23 Total Rate : 27
| Price | Rate
Currency | 12 | 12
Ifra-Red | 9 | 9
Bat | 7 | 8
India | 2 | 5
China | 4 | 3
London | 1 | 0
Ball | 2 | 1
White | 3 | 3
Tennis | 3 | 3
UK | 2 | 1
Canada| 1 | 2
Equity | 11 | 15
Infra-red | 3 | 9
Hocky | 3 | 9
Pak | 2 | 4
India | 1 | 5
White | 1 | 1
Bat | 1 | 1
China| 1 | 1
Green | 7 | 5
Ball | 4 | 3
India | 3 | 2
London| 1 | 1
Bat | 3 | 2
UK | 3 | 2


Hope you understood my question, please help me in this regards ASAP its very urgnet requirment.

Regards
Vinod




Responses

Posted by: Oliver32 on: 6/29/2015 [Member] Starter | Points: 25

Up
0
Down
Check this out : How to export datatable to Excel through DataGridView in C#

http://www.e-iceblue.com/Tutorials/Spire.DataExport/Spire.DataExport-Program-Guide/How-to-Export-Datatable-to-Excel-through-DataGridView.html

Winodjadhav, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response