本文整理了Java中org.apache.poi.xssf.usermodel.XSSFColor
类的一些代码示例,展示了XSSFColor
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSSFColor
类的具体详情如下:
包路径:org.apache.poi.xssf.usermodel.XSSFColor
类名称:XSSFColor
[英]Represents a color in SpreadsheetML
[中]表示电子表格ML中的颜色
代码示例来源:origin: primefaces/primefaces
XSSFColor backgroundColor = new XSSFColor(Color.decode(facetBackground));
((XSSFCellStyle) facetStyle).setFillForegroundColor(backgroundColor);
facetStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFColor facetColor = new XSSFColor(Color.decode(facetFontColor));
((XSSFFont) facetFont).setColor(facetColor);
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Get the foreground fill color.
* <p>
* Many cells are filled with this, instead of a
* background color ({@link #getFillBackgroundColor()})
* </p>
* @see IndexedColors
* @return fill color, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#AUTOMATIC}
*/
@Override
public short getFillForegroundColor() {
XSSFColor clr = getFillForegroundXSSFColor();
return clr == null ? IndexedColors.AUTOMATIC.getIndex() : clr.getIndexed();
}
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public void setFontColor(Color color) {
XSSFColor xcolor = XSSFColor.toXSSFColor(color);
if (xcolor == null) {
_font.getColorList().clear();
} else if(_font.sizeOfColorArray() == 0) {
_font.addNewColor().setRgb(xcolor.getRGB());
} else {
_font.setColorArray(0, xcolor.getCTColor());
}
}
代码示例来源:origin: org.apache.poi/poi-ooxml
private boolean sameIndexed(XSSFColor other) {
if (isIndexed() == other.isIndexed()) {
return !isIndexed() || getIndexed() == other.getIndexed();
}
return false;
}
private boolean sameARGB(XSSFColor other) {
代码示例来源:origin: stackoverflow.com
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet();
XSSFRow row = sheet.createRow(0);
XSSFCell cell = row.createCell( 0);
cell.setCellValue("custom XSSF colors");
XSSFCellStyle style1 = wb.createCellStyle();
style1.setFillForegroundColor(new XSSFColor(new java.awt.Color(128, 0, 128)));
style1.setFillPattern(CellStyle.SOLID_FOREGROUND);
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
CellStyle createHeaderStyle(Workbook wb){
XSSFCellStyle xstyle = (XSSFCellStyle)wb.createCellStyle();
XSSFColor header = new XSSFColor(new Color(79, 129, 189));
xstyle.setFillForegroundColor(header);
xstyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont font = (XSSFFont)wb.createFont();
font.setColor(IndexedColors.WHITE.index);
xstyle.setFont(font);
return xstyle;
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* @param color
* @param map
* @return null if color is null, new instance otherwise
*/
public static XSSFColor from(CTColor color, IndexedColorMap map) {
return color == null ? null : new XSSFColor(color, map);
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Set the foreground fill color as a indexed color value
* <br/>
* <i>Note: Ensure Foreground color is set prior to background color.</i>
* @param fg the color to use
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setFillForegroundColor(short fg) {
XSSFColor clr = new XSSFColor();
clr.setIndexed(fg);
setFillForegroundColor(clr);
}
代码示例来源:origin: org.eobjects.metamodel/MetaModel-excel
private void configureStyle(XSSFCellStyle style) {
XSSFFont font = style.getFont();
if (font.getBold()) {
_style.bold();
if (style.getFillPatternEnum() == FillPatternType.SOLID_FOREGROUND) {
XSSFColor fillForegroundXSSFColor = style
.getFillForegroundXSSFColor();
String argb = fillForegroundXSSFColor.getARGBHex();
if (argb != null) {
_style.background(argb.substring(2));
XSSFColor fontColor = style.getFont().getXSSFColor();
if (fontColor != null) {
String argbHex = fontColor.getARGBHex();
if (argbHex != null) {
_style.foreground(argbHex.substring(2));
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Set the color to use for the bottom border
* @param color the index of the color definition
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setBottomBorderColor(short color) {
XSSFColor clr = new XSSFColor();
clr.setIndexed(color);
setBottomBorderColor(clr);
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Set the color to use for the left border as a indexed color value
*
* @param color the index of the color definition
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setLeftBorderColor(short color) {
XSSFColor clr = new XSSFColor();
clr.setIndexed(color);
setLeftBorderColor(clr);
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Set the color to use for the right border
*
* @param color the index of the color definition
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setRightBorderColor(short color) {
XSSFColor clr = new XSSFColor();
clr.setIndexed(color);
setRightBorderColor(clr);
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Set the color to use for the top border
*
* @param color the index of the color definition
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setTopBorderColor(short color) {
XSSFColor clr = new XSSFColor();
clr.setIndexed(color);
setTopBorderColor(clr);
}
代码示例来源:origin: stackoverflow.com
XSSFCellStyle cellStyle = workbook.createCellStyle();
XSSFColor color = new XSSFColor(new java.awt.Color(128, 0, 128));
cellStyle.setBorderColor(XSSFCellBorder.BorderSide.BOTTOM, color);
cellStyle.setBottomBorderColor(color);
代码示例来源:origin: com.bstek.ureport/ureport2-console
private CellStyle buildCellStyle(XSSFCell cell,XSSFWorkbook book){
CellStyle style=new CellStyle();
XSSFCellStyle cellStyle=cell.getCellStyle();
HorizontalAlignment align=cellStyle.getAlignmentEnum();
if(align.equals(HorizontalAlignment.CENTER)){
style.setAlign(Alignment.center);
style.setAlign(Alignment.left);
VerticalAlignment valign=cellStyle.getVerticalAlignmentEnum();
if(valign.equals(VerticalAlignment.BOTTOM)){
style.setValign(Alignment.bottom);
style.setValign(Alignment.middle);
XSSFFont font=cellStyle.getFont();
if(font.getBold()){
style.setBold(true);
String rgb=color.getARGBHex();
style.setForecolor(hex2Rgb(rgb));
}else{
XSSFColor bgcolor=cellStyle.getFillForegroundColorColor();
if(bgcolor!=null){
String hex=bgcolor.getARGBHex();
style.setBgcolor(hex2Rgb(hex));
代码示例来源:origin: pentaho/pentaho-reporting
public short getNearestColor( final Color awtColor ) {
XSSFColor color = new XSSFColor( awtColor );
return color.getIndexed();
}
}
代码示例来源:origin: stackoverflow.com
if (cellColor instanceof XSSFColor) {
XSSFColor xssfCellColor = (XSSFColor) cellColor;
if(xssfCellColor.getARGBHex().equals(new XSSFColor(java.awt.Color.GREEN).getARGBHex())) {
System.out.print(0+",");
} else if(xssfCellColor.getARGBHex().equals(new XSSFColor(java.awt.Color.YELLOW).getARGBHex())) {
System.out.print(1+",");
代码示例来源:origin: openl-tablets/openl-tablets
public static XSSFColor getColor(short[] color, XSSFWorkbook workbook) {
byte rgb[] = new byte[3];
for (int i = 0; i < 3; i++) {
rgb[i] = (byte) (color[i] & 0xFF);
}
IndexedColorMap indexedColors = workbook.getStylesSource().getIndexedColors();
XSSFColor xssfColor = new XSSFColor(indexedColors);
xssfColor.setRGB(rgb);
return xssfColor;
}
代码示例来源:origin: jbaliuka/x4j-analytic
public Color getAwtColor(XSSFColor color) {
if(color == null){
return Color.BLACK;
}
if (color.getRgb() != null) {
return new Color(ByteBuffer.wrap(color.getRgb()).getInt(), true);
}
else {
if(color.getIndexed() == 64){
return Color.BLACK;
}
return getAwtColor(color.getTheme(), color.getTint());
}
}
代码示例来源:origin: stackoverflow.com
XSSFFont font = cs.getFont();
System.out.println("Font color : " + color.getARGBHex());
内容来源于网络,如有侵权,请联系作者删除!