public void SetVerticalAlignmentEnum() { IWorkbook wb = _testDataProvider.CreateWorkbook(); ISheet sh = wb.CreateSheet(); IRow row = sh.CreateRow(0); ICell A1 = row.CreateCell(0); ICell B1 = row.CreateCell(1); // Assumptions Assert.AreEqual(A1.CellStyle, B1.CellStyle); // should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call. // HSSFCellStyle wraps an underlying style record, and the underlying // style record is the same between multiple getCellStyle() calls. Assert.AreEqual(VerticalAlignment.Bottom, A1.CellStyle.VerticalAlignment); Assert.AreEqual(VerticalAlignment.Bottom, B1.CellStyle.VerticalAlignment); // get/set alignment modifies the cell's style CellUtil.SetVerticalAlignment(A1, VerticalAlignment.Top); Assert.AreEqual(VerticalAlignment.Top, A1.CellStyle.VerticalAlignment); // get/set alignment doesn't affect the style of cells with // the same style prior to modifying the style Assert.AreNotEqual(A1.CellStyle, B1.CellStyle); Assert.AreEqual(VerticalAlignment.Bottom, B1.CellStyle.VerticalAlignment); wb.Close(); }