dotnetcore/NPOI

Excel ICellStyle.Rotation not working

TomGriffith opened this issue · 0 comments

When using ICellStyle.Rotation to rotate a column header 90 degrees it works fine but setting it to -90 sets it to zero. The documentation states it can be set between -90 and 90. I also tried -89 and 270 to see what happened but they both set to 0 as well.

Sample code:

Dim vertStyle As ICellStyle = workbook.CreateCellStyle()
vertStyle.Rotation = -90
cell = row.CreateCell(0)
cell.SetCellValue("Employment")
cell.CellStyle = vertStyle

With Rotation set to -90 degrees it appears like this (note: this is in LibreOffice but it looks the same in Excel):
image

With Rotation set to 90 degrees it appears like this (appears to be working correctly):
image