Lines 68-73
Link Here
|
68 |
* @version 1.0-pre |
68 |
* @version 1.0-pre |
69 |
* |
69 |
* |
70 |
* @author Andrew C. Oliver (acoliver at apache dot org) |
70 |
* @author Andrew C. Oliver (acoliver at apache dot org) |
|
|
71 |
* @author Jason Height (jheight at chariot dot net dot au) |
71 |
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createCellStyle() |
72 |
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createCellStyle() |
72 |
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(short) |
73 |
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(short) |
73 |
* @see org.apache.poi.hssf.usermodel.HSSFCell#setCellStyle(HSSFCellStyle) |
74 |
* @see org.apache.poi.hssf.usermodel.HSSFCell#setCellStyle(HSSFCellStyle) |
Lines 473-494
Link Here
|
473 |
|
474 |
|
474 |
/** |
475 |
/** |
475 |
* set the degree of rotation for the text in the cell |
476 |
* set the degree of rotation for the text in the cell |
476 |
* @param rotation degrees |
477 |
* @param rotation degrees (between -90 and 90 degrees) |
477 |
*/ |
478 |
*/ |
478 |
|
479 |
|
479 |
public void setRotation(short rotation) |
480 |
public void setRotation(short rotation) |
480 |
{ |
481 |
{ |
|
|
482 |
if ((rotation < 0)&&(rotation >= -90)) { |
483 |
//Take care of the funny 4th quadrant issue |
484 |
//The 4th quadrant (-1 to -90) is stored as (91 to 180) |
485 |
rotation = (short)(90 - rotation); |
486 |
} |
487 |
else if ((rotation < -90) ||(rotation > 90)) |
488 |
//Do not allow an incorrect rotation to be set |
489 |
throw new IllegalArgumentException("The rotation must be between -90 and 90 degrees"); |
481 |
format.setRotation(rotation); |
490 |
format.setRotation(rotation); |
482 |
} |
491 |
} |
483 |
|
492 |
|
484 |
/** |
493 |
/** |
485 |
* get the degree of rotation for the text in the cell |
494 |
* get the degree of rotation for the text in the cell |
486 |
* @return rotation degrees |
495 |
* @return rotation degrees (between -90 and 90 degrees) |
487 |
*/ |
496 |
*/ |
488 |
|
497 |
|
489 |
public short getRotation() |
498 |
public short getRotation() |
490 |
{ |
499 |
{ |
491 |
return format.getRotation(); |
500 |
short rotation = format.getRotation(); |
|
|
501 |
if (rotation > 90) |
502 |
//This is actually the 4th quadrant |
503 |
rotation = (short)(90-rotation); |
504 |
return rotation; |
492 |
} |
505 |
} |
493 |
|
506 |
|