How to read a cell if it has been merged? For example A1 A2 B1 B2 merged as one, how could I read it's data? Thanks.
DataTable dtGBPatient = new DataTable();
string strConn;
string excelName;
string excelPath;
OpenFileDialog fileDlg = new OpenFileDialog();
fileDlg.Multiselect = false;
fileDlg.Filter = "????(*.*)|*.*";//"excel 2003 ??(*.xls)|*.xls|excel 2007 ?? (*.xlsx)|*.xlsx";
if (fileDlg.ShowDialog() == DialogResult.OK)
{
excelPath = fileDlg.FileName;
// excelPath.inde
strConn = @"Provider = Microsoft.Jet.OLEDB.4.0;Data Source = '{0}'; Extended Properties = 'Excel 8.0; HDR = YES; IMEX = 1';";
string strConnection = string.Format(strConn, excelPath);
OleDbConnection conn = new OleDbConnection(strConnection);
conn.Open();
// excelName= GetFirstSheetNameFromExcelFileName(excelPath,0);
excelName = "The note list of Container";
OleDbDataAdapter oada = new OleDbDataAdapter("select * from [" + excelName + "$]", strConnection);
dtGBPatient.TableName = "gbPatientInfo";
oada.Fill(dtGBPatient);
conn.Close();
Can't read irregular cell,help me plz.