Auto searching and merging cells of same value.
///
/// 把指定栏中的相同内容的cells合并成一个cell。
///
///
///
public void MergeIdenticalCells(int _rowIndexOfStartCell, int _columnIndexOfStartCell)
{
// 首先把returnedEndCell设为与startCell一样。
int rowIndexOfReturnedEndCell = _rowIndexOfStartCell;
int columnIndexOfReturnedEndCell = _columnIndexOfStartCell;
int rowIndexOfWholeColumn = _rowIndexOfStartCell - 1 + oSheet.UsedRange.Rows.Count;
try
{
while(rowIndexOfReturnedEndCell < rowindexofendcell =" _rowIndexOfStartCell;" columnindexofendcell =" _columnIndexOfStartCell;" rangeofstartcell =" (Range)(oSheet.Cells[_rowIndexOfStartCell," i =" _rowIndexOfStartCell;" selectedcell =" (Range)(oSheet.Cells[i," rowindexofendcell =" i;" rangeofendcell =" (Range)(oSheet.Cells[rowIndexOfEndCell," valueofendcell =" rangeOfEndCell.Value2.ToString();" themergedrange =" oSheet.get_Range(rangeOfStartCell," value2 =" Type.Missing;" value2 =" valueOfEndCell;" _rowindexofstartcell =" rangeOfEndCell.Row">