我怎样才能得到一个价值来展开Excel中的多行?

我需要放置一个跨越四行的文本值。 我想/希望这会工作:

private int curDescriptionTopRow = 8; . . . private void AddDescription(String desc) { int curDescriptionBottomRow = curDescriptionTopRow + 3; _xlSheet.Range[_xlSheet.Cells[curDescriptionTopRow, 1], _xlSheet.Cells[curDescriptionBottomRow, 1]].Font.Bold = true; _xlSheet.Range[_xlSheet.Cells[curDescriptionTopRow, 1], _xlSheet.Cells[curDescriptionBottomRow, 1]].VerticalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter; _xlSheet.Range[_xlSheet.Cells[curDescriptionTopRow, 1], _xlSheet.Cells[curDescriptionBottomRow, 1]].Value2 = desc; curDescriptionTopRow = curDescriptionTopRow + 4; } 

我需要第一个描述在单元格A8 – A11(列A,第8-11行)中垂直居中显示。

上面的代码在所有四行中都添加了描述,而不是四行中的一次。

我怎样才能防止描述的三个多余的外观?

定义并合并范围工作:

 private int curDescriptionTopRow = 8; . . . private void AddDescription(String desc) { int curDescriptionBottomRow = curDescriptionTopRow + 3; var range = _xlSheet.Range[_xlSheet.Cells[curDescriptionTopRow, 1], _xlSheet.Cells[curDescriptionBottomRow, 1]]; range.Merge(); range.Font.Bold = true; range.VerticalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter; range.Value2 = desc; }