1
我需要放置一個跨越四行的文本值。我想/希望這會工作:我如何獲得一個值來展開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)。
上面的代碼在所有四行中添加了說明,而不是在四行中只有一次。
如何防止描述的三個冗餘外觀?