超简单, 通过Range的MergeCells 即可判断。
示例代码如下:
Excel.Application oXL;
Excel._Workbook oWB;
Excel._Worksheet oSheet;
Excel.Range oRng;
object missing = System.Type.Missing;
//创建Excel实例
oXL = new Excel.Application();
//打开已有的工作簿
oWB = oXL.Workbooks.Open(@"E:\BookTest.xls",missing,missing,missing,missing,missing,missing,
missing,missing,missing,missing,missing,missing,missing,missing);
oSheet = (Excel.Worksheet)oWB.Sheets.get_Item(1);
// 获取 A1 单元格
oRng = (Excel.Range)oSheet.Cells[1,"A"];
bool isMerge = (bool)oRng.MergeCells;
MessageBox.Show(isMerge.ToString());
Excel._Workbook oWB;
Excel._Worksheet oSheet;
Excel.Range oRng;
object missing = System.Type.Missing;
//创建Excel实例
oXL = new Excel.Application();
//打开已有的工作簿
oWB = oXL.Workbooks.Open(@"E:\BookTest.xls",missing,missing,missing,missing,missing,missing,
missing,missing,missing,missing,missing,missing,missing,missing);
oSheet = (Excel.Worksheet)oWB.Sheets.get_Item(1);
// 获取 A1 单元格
oRng = (Excel.Range)oSheet.Cells[1,"A"];
bool isMerge = (bool)oRng.MergeCells;
MessageBox.Show(isMerge.ToString());