本文整理了Java中org.apache.poi.hssf.usermodel.HSSFWorkbook.getCustomPalette()
方法的一些代码示例,展示了HSSFWorkbook.getCustomPalette()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFWorkbook.getCustomPalette()
方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFWorkbook
类名称:HSSFWorkbook
方法名:getCustomPalette
暂无
代码示例来源:origin: stackoverflow.com
HSSFWorkbook hwb = new HSSFWorkbook();
HSSFPalette palette = hwb.getCustomPalette();
// get the color which most closely matches the color you want to use
HSSFColor myColor = palette.findSimilarColor(255, 0, 0);
// get the palette index of that color
short palIndex = myColor.getIndex();
// code to get the style for the cell goes here
style.setFillForegroundColor(palIndex);
代码示例来源:origin: org.apache.poi/poi
@Override
public HSSFColor getTopBorderColorColor() {
return workbook.getCustomPalette().getColor(
borderFormatting.getTopBorderColor()
);
}
代码示例来源:origin: org.apache.poi/poi
@Override
public HSSFColor getLeftBorderColorColor() {
return workbook.getCustomPalette().getColor(
borderFormatting.getLeftBorderColor()
);
}
代码示例来源:origin: org.apache.poi/poi
/**
* get the color value for the font
*/
public HSSFColor getHSSFColor(HSSFWorkbook wb)
{
HSSFPalette pallette = wb.getCustomPalette();
return pallette.getColor( getColor() );
}
代码示例来源:origin: org.apache.poi/poi
public HSSFColor getFontColor() {
return workbook.getCustomPalette().getColor(
getFontColorIndex()
);
}
代码示例来源:origin: org.apache.poi/poi
@Override
public HSSFColor getBottomBorderColorColor() {
return workbook.getCustomPalette().getColor(
borderFormatting.getBottomBorderColor()
);
}
代码示例来源:origin: org.apache.poi/poi
@Override
public HSSFColor getDiagonalBorderColorColor() {
return workbook.getCustomPalette().getColor(
borderFormatting.getDiagonalBorderColor()
);
}
代码示例来源:origin: org.apache.poi/poi
@Override
public HSSFColor getRightBorderColorColor() {
return workbook.getCustomPalette().getColor(
borderFormatting.getRightBorderColor()
);
}
代码示例来源:origin: org.apache.poi/poi
public HSSFColor getFillBackgroundColorColor() {
return workbook.getCustomPalette().getColor(getFillBackgroundColor());
}
代码示例来源:origin: org.apache.poi/poi
public HSSFColor getFillForegroundColorColor() {
return workbook.getCustomPalette().getColor(getFillForegroundColor());
}
代码示例来源:origin: stackoverflow.com
public HSSFColor setColor(HSSFWorkbook workbook, byte r,byte g, byte b){
HSSFPalette palette = workbook.getCustomPalette();
HSSFColor hssfColor = null;
try {
hssfColor= palette.findColor(r, g, b);
if (hssfColor == null ){
palette.setColorAtIndex(HSSFColor.LAVENDER.index, r, g,b);
hssfColor = palette.getColor(HSSFColor.LAVENDER.index);
}
} catch (Exception e) {
logger.error(e);
}
return hssfColor;
}
代码示例来源:origin: org.apache.poi/poi
private HSSFFont matchFont( Font matchFont )
{
HSSFColor hssfColor = workbook.getCustomPalette()
.findColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
if (hssfColor == null)
hssfColor = workbook.getCustomPalette().findSimilarColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
boolean bold = (matchFont.getStyle() & Font.BOLD) != 0;
boolean italic = (matchFont.getStyle() & Font.ITALIC) != 0;
HSSFFont hssfFont = workbook.findFont(bold,
hssfColor.getIndex(),
(short)(matchFont.getSize() * 20),
matchFont.getName(),
italic,
false,
(short)0,
(byte)0);
if (hssfFont == null)
{
hssfFont = workbook.createFont();
hssfFont.setBold(bold);
hssfFont.setColor(hssfColor.getIndex());
hssfFont.setFontHeight((short)(matchFont.getSize() * 20));
hssfFont.setFontName(matchFont.getName());
hssfFont.setItalic(italic);
hssfFont.setStrikeout(false);
hssfFont.setTypeOffset((short) 0);
hssfFont.setUnderline((byte) 0);
}
return hssfFont;
}
代码示例来源:origin: primefaces/primefaces
String cellFontColor = options.getCellFontColor();
if (cellFontColor != null) {
HSSFPalette palette = ((HSSFWorkbook) wb).getCustomPalette();
Color color = Color.decode(cellFontColor);
HSSFColor cellColor = palette.findSimilarColor(color.getRed(), color.getGreen(), color.getBlue());
代码示例来源:origin: primefaces/primefaces
HSSFPalette palette = ((HSSFWorkbook) wb).getCustomPalette();
Color color = null;
代码示例来源:origin: youseries/ureport
private HSSFColor buildHSSFColor(HSSFWorkbook wb,String colorStr){
String[] color=colorStr.split(",");
HSSFPalette palette=wb.getCustomPalette();
byte r=BigInteger.valueOf(Integer.valueOf(color[0])).byteValue();
byte g=BigInteger.valueOf(Integer.valueOf(color[1])).byteValue();
byte b=BigInteger.valueOf(Integer.valueOf(color[2])).byteValue();
HSSFColor targetColor=palette.findColor(r,g,b);
if(targetColor==null){
palette.setColorAtIndex(HSSFColorPredefined.LAVENDER.getIndex(), r, g,b);
targetColor=palette.getColor(HSSFColorPredefined.LAVENDER.getIndex());
}
return targetColor;
}
代码示例来源:origin: stackoverflow.com
HSSFPalette palette = wb.getCustomPalette();
代码示例来源:origin: org.apache.poi/poi-examples
public HSSFHtmlHelper(HSSFWorkbook wb) {
this.wb = wb;
// If there is no custom palette, then this creates a new one that is
// a copy of the default
colors = wb.getCustomPalette();
}
代码示例来源:origin: com.haulmont.thirdparty/poi
/**
* get the color value for the font
*/
public HSSFColor getHSSFColor(HSSFWorkbook wb)
{
HSSFPalette pallette = wb.getCustomPalette();
return pallette.getColor( getColor() );
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public HSSFColor getLeftBorderColorColor() {
return workbook.getCustomPalette().getColor(
borderFormatting.getLeftBorderColor()
);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public HSSFColor getRightBorderColorColor() {
return workbook.getCustomPalette().getColor(
borderFormatting.getRightBorderColor()
);
}
内容来源于网络,如有侵权,请联系作者删除!