public void testGetSetHoriAlignment() {
int rowindex = 3, columnindex = 0;
Table table = odsdoc.getTableByName("Sheet1");
Cell fcell = table.getCellByPosition(columnindex, rowindex);
HorizontalAlignmentType align = fcell.getHorizontalAlignmentType();
Assert.assertEquals(HorizontalAlignmentType.CENTER, align);
fcell.setHorizontalAlignment(HorizontalAlignmentType.DEFAULT);
HorizontalAlignmentType newAlign = fcell.getHorizontalAlignmentType();
Assert.assertEquals(HorizontalAlignmentType.DEFAULT, newAlign);
fcell.setHorizontalAlignment(HorizontalAlignmentType.LEFT);
align = fcell.getHorizontalAlignmentType();
Assert.assertEquals(HorizontalAlignmentType.LEFT, align);
// "left" and "right" should be mapped as "start" and "end".
fcell.setHorizontalAlignment(HorizontalAlignmentType.LEFT);
// get string
String aligns = fcell.getHorizontalAlignment();
Assert.assertEquals("start", aligns);
// get type
align = fcell.getHorizontalAlignmentType();
Assert.assertEquals(HorizontalAlignmentType.LEFT, align);
fcell.setHorizontalAlignment(HorizontalAlignmentType.RIGHT);
// get string
aligns = fcell.getHorizontalAlignment();
Assert.assertEquals("end", aligns);
// get type
align = fcell.getHorizontalAlignmentType();
Assert.assertEquals(HorizontalAlignmentType.RIGHT, align);
saveods();
SpreadsheetDocument ods;
try {
ods = SpreadsheetDocument.newSpreadsheetDocument();
Table tbl = ods.getTableByName("Sheet1");
Cell cell = tbl.getCellByPosition(0, 0);
HorizontalAlignmentType horizonAlignment = cell.getHorizontalAlignmentType();
Assert.assertEquals(HorizontalAlignmentType.DEFAULT, horizonAlignment);
table = ods.getTableByName("Sheet2");
if (table != null) {
table.remove();