From 8bc07881fb2d2dfb4fe6e0abf183578d498acd08 Mon Sep 17 00:00:00 2001 From: Paolo Mottadelli Date: Sat, 5 Apr 2008 16:30:17 +0000 Subject: [PATCH] XSSFCellAlignment get/setTextRotation + get/setWrapText + tests git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@645131 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java | 6 ++---- .../poi/xssf/usermodel/extensions/XSSFCellAlignment.java | 8 ++++++++ .../org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java | 8 ++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java index 4fe095ded..c3d148b6e 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java @@ -284,8 +284,7 @@ public class XSSFCellStyle implements CellStyle { } public void setRotation(short rotation) { - // TODO Auto-generated method stub - + getCellAlignment().setTextRotation(rotation); } public void setTopBorderColor(short color) { @@ -302,8 +301,7 @@ public class XSSFCellStyle implements CellStyle { } public void setWrapText(boolean wrapped) { - // TODO Auto-generated method stub - + getCellAlignment().setWrapText(wrapped); } private XSSFCellBorder getCellBorder() { diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/extensions/XSSFCellAlignment.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/extensions/XSSFCellAlignment.java index 18656b61e..71a32d4df 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/extensions/XSSFCellAlignment.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/extensions/XSSFCellAlignment.java @@ -63,7 +63,15 @@ public class XSSFCellAlignment { return cellAlignement.getTextRotation(); } + public void setTextRotation(long rotation) { + cellAlignement.setTextRotation(rotation); + } + public boolean getWrapText() { return cellAlignement.getWrapText(); } + + public void setWrapText(boolean wrapped) { + cellAlignement.setWrapText(wrapped); + } } diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java index ef1bcf23a..378375f71 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java @@ -183,4 +183,12 @@ public class TestXSSFCellStyle extends TestCase { cellStyle.setVerticalAlignmentEnum(STVerticalAlignment.JUSTIFY); assertEquals((short)4, cellStyle.getVerticalAlignment()); } + + public void testGetSetWrapText() { + assertFalse(cellStyle.getWrapText()); + cellXf.getAlignment().setWrapText(true); + assertTrue(cellStyle.getWrapText()); + cellStyle.setWrapText(false); + assertFalse(cellXf.getAlignment().getWrapText()); + } }