Coloring rows without using a theme
Posted: Mon Jun 18, 2012 10:54 pm
Today I tried to add a background fill to my rows. In order to keep my code simple, I wanted to do this without using theme colors. So I tried the setRgb method on CTColor when creating a fill for my stylesheet. But for some reason, it ignored this color. No matter what color I used, it came out as a shade of grey.
Here's the code I tried:
All the code surrounding it should be in order, because as soon as I add the theme and replace setRgb with setTheme, it works perfectly. Any idea why this doesn't work?
Here's the code I tried:
- Code: Select all
CTFill blueFill = new CTFill();
CTPatternFill bluePatternfill = new CTPatternFill();
bluePatternfill.setPatternType(STPatternType.SOLID);
CTColor blue = new CTColor();
blue.setTint(0.6);
byte[] rgbBlue = "4BACC6".getBytes();
blue.setRgb(rgbBlue);
bluePatternfill.setFgColor(blue);
bluePatternfill.setBgColor(bgColor);
blueFill.setPatternFill(bluePatternfill);
styleSheet.getFills().getFill().add(blueFill);
All the code surrounding it should be in order, because as soon as I add the theme and replace setRgb with setTheme, it works perfectly. Any idea why this doesn't work?