* Set the background fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value.
* <br>
* @param color the color to use
+ * @throws IllegalArgumentException if you provide a <code>Color</code> instance that is not a {@link XSSFColor}
* @since POI 5.2.3
*/
@Override
public void setFillBackgroundColor(org.apache.poi.ss.usermodel.Color color) {
if (color instanceof XSSFColor) {
setFillBackgroundColor((XSSFColor)color);
+ } else {
+ throw new IllegalArgumentException("XSSFCellStyle only accepts XSSFColor instances");
}
}
* Set the foreground fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value.
* <br>
* @param color the color to use
+ * @throws IllegalArgumentException if you provide a <code>Color</code> instance that is not a {@link XSSFColor}
* @since POI 5.2.3
*/
@Override
public void setFillForegroundColor(org.apache.poi.ss.usermodel.Color color) {
if (color instanceof XSSFColor) {
setFillForegroundColor((XSSFColor)color);
+ } else {
+ throw new IllegalArgumentException("XSSFCellStyle only accepts XSSFColor instances");
}
}
* Set the background fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value.
* <br>
* @param color the color to use
+ * @throws IllegalArgumentException if you provide a <code>Color</code> instance that is not a {@link HSSFColor}
* @since POI 5.2.3
*/
@Override
if (color instanceof HSSFColor) {
short index2 = ((HSSFColor)color).getIndex2();
if (index2 != -1) setFillBackgroundColor(index2);
+ } else {
+ throw new IllegalArgumentException("HSSFCellStyle only accepts HSSFColor instances");
}
}
* Set the foreground fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value.
* <br>
* @param color the color to use
+ * @throws IllegalArgumentException if you provide a <code>Color</code> instance that is not a {@link HSSFColor}
* @since POI 5.2.3
*/
@Override
if (color instanceof HSSFColor) {
short index2 = ((HSSFColor)color).getIndex2();
if (index2 != -1) setFillForegroundColor(index2);
+ } else {
+ throw new IllegalArgumentException("HSSFCellStyle only accepts HSSFColor instances");
}
}