I am creating a Windows Forms Application using Visual Studio 2010.
I populate data to a DataGridView from an excel file using OleDbDataAdapter method.
Here is my code
dataGridView1.DataSource = null;
dataGridView1.Update();
var connectionString =
string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=No;IMEX=1\";", fileName);
var adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", connectionString);
var ds = new DataSet();
DataTable t = new DataTable();
adapter.Fill(t);
dataGridView1.DataSource = t;
Now Problem is if some cells are merged in the excel file output get bit different.
Here is the image for better understanding.

So how can I fix this problem ?
I think if I can identify the merge cells then I can fix this. But I don’t have a clear idea at the moment.
Is there a better way to represent excel data in grid view as it is in the excel file ?
Any answer would be help. Please share any suggestions.
Thanks
Yohan
My solution: