本文整理汇总了Java中org.apache.poi.hssf.usermodel.HSSFCellStyle.setRightBorderColor方法的典型用法代码示例。如果您正苦于以下问题:Java HSSFCellStyle.setRightBorderColor方法的具体用法?Java HSSFCellStyle.setRightBorderColor怎么用?Java HSSFCellStyle.setRightBorderColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.hssf.usermodel.HSSFCellStyle
的用法示例。
在下文中一共展示了HSSFCellStyle.setRightBorderColor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCellStyle
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
/**
* 获取单元格式样式
*
* @param wb
* @param color
* @return
*/
private static HSSFCellStyle getCellStyle(HSSFWorkbook wb, int color) {
if (STYLE_MAP.get(color) != null) {
return STYLE_MAP.get(color);
}
HSSFCellStyle style = wb.createCellStyle();
if (color != -1) {
style.setFillForegroundColor(Short.valueOf(color + ""));
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setAlignment(CellStyle.ALIGN_CENTER);
}
style.setBorderBottom(CellStyle.BORDER_THIN);
style.setBorderLeft(CellStyle.BORDER_THIN);
style.setBorderRight(CellStyle.BORDER_THIN);
style.setBorderTop(CellStyle.BORDER_THIN);
style.setBottomBorderColor(HSSFColor.BLACK.index);
style.setLeftBorderColor(HSSFColor.BLACK.index);
style.setRightBorderColor(HSSFColor.BLACK.index);
style.setTopBorderColor(HSSFColor.BLACK.index);
STYLE_MAP.put(color, style);
return style;
}
示例2: updateSubreportBandElementStyle
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
private HSSFCellStyle updateSubreportBandElementStyle(HSSFCellStyle cellStyle, BandElement bandElement, Object value, int gridRow, int gridColumn, int colSpan) {
if (subreportCellStyle == null) {
return cellStyle;
}
if (gridColumn == 0) {
cellStyle.setBorderLeft(subreportCellStyle.getBorderLeft());
cellStyle.setLeftBorderColor(subreportCellStyle.getLeftBorderColor());
} else if (gridColumn+colSpan-1 == bean.getReportLayout().getColumnCount()-1) {
cellStyle.setBorderRight(subreportCellStyle.getBorderRight());
cellStyle.setRightBorderColor(subreportCellStyle.getRightBorderColor());
}
if (pageRow == 0) {
cellStyle.setBorderTop(subreportCellStyle.getBorderTop());
cellStyle.setTopBorderColor(subreportCellStyle.getTopBorderColor());
} else if ( (pageRow+1) == getRowsCount()) {
cellStyle.setBorderBottom(subreportCellStyle.getBorderBottom());
cellStyle.setBottomBorderColor(subreportCellStyle.getBottomBorderColor());
}
return cellStyle;
}
示例3: copyCellStyle
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
public static HSSFCellStyle copyCellStyle(final HSSFWorkbook workbook, final HSSFCellStyle style) {
final HSSFCellStyle newCellStyle = workbook.createCellStyle();
newCellStyle.setAlignment(style.getAlignment());
newCellStyle.setBorderBottom(style.getBorderBottom());
newCellStyle.setBorderLeft(style.getBorderLeft());
newCellStyle.setBorderRight(style.getBorderRight());
newCellStyle.setBorderTop(style.getBorderTop());
newCellStyle.setBottomBorderColor(style.getBottomBorderColor());
newCellStyle.setDataFormat(style.getDataFormat());
newCellStyle.setFillBackgroundColor(style.getFillBackgroundColor());
newCellStyle.setFillForegroundColor(style.getFillForegroundColor());
newCellStyle.setFillPattern(style.getFillPattern());
newCellStyle.setHidden(style.getHidden());
newCellStyle.setIndention(style.getIndention());
newCellStyle.setLeftBorderColor(style.getLeftBorderColor());
newCellStyle.setLocked(style.getLocked());
newCellStyle.setRightBorderColor(style.getRightBorderColor());
newCellStyle.setRotation(style.getRotation());
newCellStyle.setTopBorderColor(style.getTopBorderColor());
newCellStyle.setVerticalAlignment(style.getVerticalAlignment());
newCellStyle.setWrapText(style.getWrapText());
final HSSFFont font = workbook.getFontAt(style.getFontIndex());
newCellStyle.setFont(font);
return newCellStyle;
}
示例4: copyCellStyle
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
public static HSSFCellStyle copyCellStyle(HSSFWorkbook workbook,
HSSFCellStyle style) {
HSSFCellStyle newCellStyle = workbook.createCellStyle();
newCellStyle.setAlignment(style.getAlignment());
newCellStyle.setBorderBottom(style.getBorderBottom());
newCellStyle.setBorderLeft(style.getBorderLeft());
newCellStyle.setBorderRight(style.getBorderRight());
newCellStyle.setBorderTop(style.getBorderTop());
newCellStyle.setBottomBorderColor(style.getBottomBorderColor());
newCellStyle.setDataFormat(style.getDataFormat());
newCellStyle.setFillBackgroundColor(style.getFillBackgroundColor());
newCellStyle.setFillForegroundColor(style.getFillForegroundColor());
newCellStyle.setFillPattern(style.getFillPattern());
newCellStyle.setHidden(style.getHidden());
newCellStyle.setIndention(style.getIndention());
newCellStyle.setLeftBorderColor(style.getLeftBorderColor());
newCellStyle.setLocked(style.getLocked());
newCellStyle.setRightBorderColor(style.getRightBorderColor());
newCellStyle.setRotation(style.getRotation());
newCellStyle.setTopBorderColor(style.getTopBorderColor());
newCellStyle.setVerticalAlignment(style.getVerticalAlignment());
newCellStyle.setWrapText(style.getWrapText());
HSSFFont font = workbook.getFontAt(style.getFontIndex());
newCellStyle.setFont(font);
return newCellStyle;
}
示例5: applyBorderStyle
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
@Override
public void applyBorderStyle(Workbook workbook, CellStyle style, BorderSide side, CSSValue colour, CSSValue borderStyle, CSSValue width) {
if( ( colour != null ) || ( borderStyle != null ) || ( width != null ) ) {
String colourString = colour == null ? "rgb(0,0,0)" : colour.getCssText();
String borderStyleString = borderStyle == null ? "solid" : borderStyle.getCssText();
String widthString = width == null ? "medium" : width.getCssText();
if( style instanceof HSSFCellStyle ) {
HSSFCellStyle hStyle = (HSSFCellStyle)style;
short hBorderStyle = poiBorderStyleFromBirt(borderStyleString, widthString);
short colourIndex = getHColour((HSSFWorkbook)workbook, colourString);
if( colourIndex > 0 ) {
if(hBorderStyle != CellStyle.BORDER_NONE) {
switch( side ) {
case TOP:
hStyle.setBorderTop(hBorderStyle);
hStyle.setTopBorderColor(colourIndex);
// log.debug( "Top border: " + xStyle.getBorderTop() + " / " + xStyle.getTopBorderXSSFColor().getARGBHex() );
break;
case LEFT:
hStyle.setBorderLeft(hBorderStyle);
hStyle.setLeftBorderColor(colourIndex);
// log.debug( "Left border: " + xStyle.getBorderLeft() + " / " + xStyle.getLeftBorderXSSFColor().getARGBHex() );
break;
case RIGHT:
hStyle.setBorderRight(hBorderStyle);
hStyle.setRightBorderColor(colourIndex);
// log.debug( "Right border: " + xStyle.getBorderRight() + " / " + xStyle.getRightBorderXSSFColor().getARGBHex() );
break;
case BOTTOM:
hStyle.setBorderBottom(hBorderStyle);
hStyle.setBottomBorderColor(colourIndex);
// log.debug( "Bottom border: " + xStyle.getBorderBottom() + " / " + xStyle.getBottomBorderXSSFColor().getARGBHex() );
break;
}
}
}
}
}
}
示例6: main
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Planilha");
HSSFRow row = sheet.createRow((short) 2);
HSSFCell cell = row.createCell((short) (1),HSSFCell.CELL_TYPE_STRING);
cell.setCellValue("Alinhe isto!fim");
sheet.setColumnWidth( (short) 1, (short) ( ( 10 * cell.getStringCellValue().length() ) / ( (double) 1 / 20 ) ) );
HSSFCellStyle estilo = wb.createCellStyle();
//Alinhando ao centro
estilo.setAlignment(HSSFCellStyle.ALIGN_CENTER);
short cor = HSSFColor.BLUE.index;
// inserindo fontes e cores.
estilo.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
estilo.setFillForegroundColor(HSSFColor.GREEN.index);
//estilo.setFillBackgroundColor(HSSFColor.BLUE.index);
// estilo.setFillForegroundColor(HSSFColor.BLUE.index2);
// funcionando
// estilo.setFillPattern(HSSFCellStyle.FINE_DOTS );
// estilo.setFillBackgroundColor(new HSSFColor.RED().getIndex());
// estilo.setFillPattern(HSSFCellStyle.FINE_DOTS );
// estilo.setFillForegroundColor(new HSSFColor.BLUE().getIndex());
// estilo.setFillBackgroundColor(new HSSFColor.RED().getIndex());
// estilo.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
// estilo.setFillForegroundColor(new HSSFColor.RED().getIndex());
//Adicionando bordas
estilo.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
estilo.setBottomBorderColor(cor);
estilo.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
estilo.setLeftBorderColor(cor);
estilo.setBorderRight(HSSFCellStyle.BORDER_THIN);
estilo.setRightBorderColor(cor);
estilo.setBorderTop(HSSFCellStyle.BORDER_MEDIUM_DASHED);
estilo.setTopBorderColor(cor);
cell.setCellStyle(estilo);
FileOutputStream fileOut = new FileOutputStream("C:/planilha.xls");
wb.write(fileOut);
fileOut.close();
}