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
This commit is contained in:
Andrew C. Oliver 2002-09-06 01:10:19 +00:00
parent 0c8abbbec4
commit ce178660f2

View File

@ -68,6 +68,7 @@ import org.apache.poi.hssf.record.ExtendedFormatRecord;
* @version 1.0-pre * @version 1.0-pre
* *
* @author Andrew C. Oliver (acoliver at apache dot org) * @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#createCellStyle()
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(short) * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(short)
* @see org.apache.poi.hssf.usermodel.HSSFCell#setCellStyle(HSSFCellStyle) * @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 * 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) 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); format.setRotation(rotation);
} }
/** /**
* get the degree of rotation for the text in the cell * 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() 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;
} }
/** /**