aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew C. Oliver <acoliver@apache.org>2002-09-06 01:10:19 +0000
committerAndrew C. Oliver <acoliver@apache.org>2002-09-06 01:10:19 +0000
commit282261ac06a34728cab114ce6c628b5639615085 (patch)
tree9cea9a15eb232d3d98d9046f7892f0e762450d27 /src
parent5793d7ceb8d09d91341cced5d562c0d17753852d (diff)
downloadpoi-282261ac06a34728cab114ce6c628b5639615085.tar.gz
poi-282261ac06a34728cab114ce6c628b5639615085.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java19
1 files 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;
}
/**