Excel 合并单元格 C#

合并竖着的单元格

Range rangeLecture = worksheet.get_Range(worksheet.Cells[1, 1], worksheet.Cells[2,  1]);
                    rangeLecture.Application.DisplayAlerts = false;
                    rangeLecture.Merge(Missing.Value);
                    rangeLecture.Application.DisplayAlerts = true;

合并横着的单元格

Range rangeProgram = worksheet.get_Range(worksheet.Cells[1, 1], worksheet.Cells[1, 2]);//获取需要合并的单元格的范围
                            rangeProgram.Application.DisplayAlerts = false;
                            rangeProgram.Merge(Missing.Value);
                            rangeProgram.Application.DisplayAlerts = true;

 

posted @ 2014-04-15 16:35  偶不是大叔  阅读(16124)  评论(5编辑  收藏  举报