I have multiple data tables which i want to write in single excel sheet but it should be written in such a manner that 2-3 columns are left between each table
for eg:
so here we can see 4 different tables
in some cases it might be less than 4 or even more
so how can i append tables, column wise leaving a 2 column gap between each table
Count the columns of each datatable.
Let us say if you have 3 datatable:
Column count of table1=3
Column count of table2=4
Column count of table3=5
Then in the write Range for table 1:
For first table set it as “A1”
Then in the write Range for table 2:
ASCII value of A =65
table1 column count=3
Skip column count =2
Next Column to start writing Table2 is:
65+3+2=70 ,get the character for value 70 which is Column F, set the write Range from “F1”
Next Column to start writing Table3 is:
table1 column count=3
Skip column count =2
table2 column count=4
Skip column count =2
65+3+2+4+2=76,retreive the char for ASCII value 76 which is Column L,soL1
To get Character for the ASCII value use:
code=ASCII value of letters A-Z
Convert.ToString((char)code)