From 282261ac06a34728cab114ce6c628b5639615085 Mon Sep 17 00:00:00 2001 From: "Andrew C. Oliver" Date: Fri, 6 Sep 2002 01:10:19 +0000 Subject: [PATCH] http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10702 PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352838 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hssf/usermodel/HSSFCellStyle.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java index 70ec27b169..0f968c2f07 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java @@ -68,6 +68,7 @@ import org.apache.poi.hssf.record.ExtendedFormatRecord; * @version 1.0-pre * * @author Andrew C. Oliver (acoliver at apache dot org) + * @author Jason Height (jheight at chariot dot net dot au) * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createCellStyle() * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(short) * @see org.apache.poi.hssf.usermodel.HSSFCell#setCellStyle(HSSFCellStyle) @@ -473,22 +474,34 @@ public class HSSFCellStyle /** * set the degree of rotation for the text in the cell - * @param rotation degrees + * @param rotation degrees (between -90 and 90 degrees) */ public void setRotation(short rotation) { + if ((rotation < 0)&&(rotation >= -90)) { + //Take care of the funny 4th quadrant issue + //The 4th quadrant (-1 to -90) is stored as (91 to 180) + rotation = (short)(90 - rotation); + } + else if ((rotation < -90) ||(rotation > 90)) + //Do not allow an incorrect rotation to be set + throw new IllegalArgumentException("The rotation must be between -90 and 90 degrees"); format.setRotation(rotation); } /** * get the degree of rotation for the text in the cell - * @return rotation degrees + * @return rotation degrees (between -90 and 90 degrees) */ public short getRotation() { - return format.getRotation(); + short rotation = format.getRotation(); + if (rotation > 90) + //This is actually the 4th quadrant + rotation = (short)(90-rotation); + return rotation; } /**