EPPlus Excel 文件。显示对角线单元格的正确输出
EPPlus Excel File. Show correct output for diagonal cell
使用 EPPlus 我编写了代码来显示对角线单元格信息。
我读了这个tutorial on how to achieve this in Excel。
这是我写的代码:
private void AddDiagonalTitleHeaders(ExcelWorksheet ws, string diagonalLocation)
{
var diagonalCell = ws.Cells[diagonalLocation];
var border = diagonalCell.Style.Border;
border.Diagonal.Style = ExcelBorderStyle.Thick;
border.DiagonalDown = true;
diagonalCell.Style.Font.Size = 18;
diagonalCell.Style.VerticalAlignment = ExcelVerticalAlignment.Top;
var altEnter = ((char)10).ToString();
var spaces = " ";
var diagonalText = string.Format("{1}{1}{1}ActionFlags{0}{0}{0}{0}{0}{0}{0}{0}Status", altEnter, spaces);
diagonalCell.Value = diagonalText;
}
当我打开 Excel 文件时,它最初看起来像这样:
然后我双击单元格进入模式:'editing directly in cells'。
我点击离开,然后我看到了正确的输出结果:
我的问题:怎样才能立即显示正确的输出结果?
仅供参考:
var diagonalText = " ActionFlags\n\n\n\n\n\n\n\nStatus"; //Is the same
尝试打开文字环绕:
diagonalCell.Style.WrapText = true;
使用 EPPlus 我编写了代码来显示对角线单元格信息。
我读了这个tutorial on how to achieve this in Excel。
这是我写的代码:
private void AddDiagonalTitleHeaders(ExcelWorksheet ws, string diagonalLocation)
{
var diagonalCell = ws.Cells[diagonalLocation];
var border = diagonalCell.Style.Border;
border.Diagonal.Style = ExcelBorderStyle.Thick;
border.DiagonalDown = true;
diagonalCell.Style.Font.Size = 18;
diagonalCell.Style.VerticalAlignment = ExcelVerticalAlignment.Top;
var altEnter = ((char)10).ToString();
var spaces = " ";
var diagonalText = string.Format("{1}{1}{1}ActionFlags{0}{0}{0}{0}{0}{0}{0}{0}Status", altEnter, spaces);
diagonalCell.Value = diagonalText;
}
当我打开 Excel 文件时,它最初看起来像这样:
然后我双击单元格进入模式:'editing directly in cells'。 我点击离开,然后我看到了正确的输出结果:
我的问题:怎样才能立即显示正确的输出结果?
仅供参考:
var diagonalText = " ActionFlags\n\n\n\n\n\n\n\nStatus"; //Is the same
尝试打开文字环绕:
diagonalCell.Style.WrapText = true;