Hello,
I have a datatable
suppose like
A B C D
1 2 3 4
5 6 7 8
Now I have to write it in excel like
Header1 Header2 Header3
A:1 2 4
C:3 2 4
A:5 6 8
C:7 6 8
There by one line in my datatable is creating two rows in excel?
Can anyone can suggest any solution to how to do that?
I am sorry I did not get your problem here. But you can access the elements from data table like this
row(“ColumnName”).ToString or DataTable.Rows(RowIndex)(ColumnIndex).ToString
By doing this you can easily write a cell or an excel row even
I can access the elements but my doubt is with single row of data table I want to create 2 rows in excel.
| A | B | C | D |
…
| 1 | 2 | 3 | 4 |
…
| 5 | 6 | 7 | 8 |
…
Suppose lets consider A B C D are headers of my data table and above shown is my datatable Table1
I want it to be written in excel in 2 rows
i.e…
| H1 | H2 | H3 |
…
| A:1 | 2 | 4 |
…
| C:3 | 2 | 4 |
…
| A:5 | 6 | 8 |
…
| C:7 | 6 | 8 |
…
Under same header1 H1 I need A and C of my datatable in different rows and B and D are common in both rows.