本文整理汇总了Java中org.apache.poi.hssf.usermodel.HSSFCellStyle.setBorderTop方法的典型用法代码示例。如果您正苦于以下问题:Java HSSFCellStyle.setBorderTop方法的具体用法?Java HSSFCellStyle.setBorderTop怎么用?Java HSSFCellStyle.setBorderTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.hssf.usermodel.HSSFCellStyle
的用法示例。
在下文中一共展示了HSSFCellStyle.setBorderTop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createMatrixCellStyle
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
private HSSFCellStyle createMatrixCellStyle(final HSSFWorkbook workbook, final HSSFCellStyle matrixHeaderTemplateCellStyle, final boolean top, final boolean right, final boolean bottom, final boolean left) {
final HSSFCellStyle cellStyle = POIUtils.copyCellStyle(workbook, matrixHeaderTemplateCellStyle);
if (top) {
cellStyle.setBorderTop(CellStyle.BORDER_THIN);
}
if (right) {
cellStyle.setBorderRight(CellStyle.BORDER_THIN);
}
if (bottom) {
cellStyle.setBorderBottom(CellStyle.BORDER_THIN);
}
if (left) {
cellStyle.setBorderLeft(CellStyle.BORDER_THIN);
}
return cellStyle;
}
示例3: createCellStyleForColumnHeading
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
public static HSSFCellStyle createCellStyleForColumnHeading(HSSFWorkbook workBook) {
HSSFCellStyle cellStyle = workBook.createCellStyle();
HSSFFont fontObj = workBook.createFont();
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setWrapText(true);
cellStyle.setAlignment(HorizontalAlignment.CENTER);
cellStyle.setFillBackgroundColor(Short.valueOf("22").shortValue());
cellStyle.setFillPattern(FillPatternType.BIG_SPOTS);
cellStyle.setFillForegroundColor(Short.valueOf("22").shortValue());
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
fontObj.setFontName("Calibri");
fontObj.setFontHeightInPoints(Short.valueOf("12").shortValue());
fontObj.setBold(true);
fontObj.setColor(Short.valueOf("8").shortValue());
cellStyle.setFont(fontObj);
return cellStyle;
}
示例4: createMatrixCellStyle
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
private HSSFCellStyle createMatrixCellStyle(HSSFWorkbook workbook,
HSSFCellStyle matrixHeaderTemplateCellStyle, boolean top,
boolean right, boolean bottom, boolean left) {
HSSFCellStyle cellStyle = POIUtils.copyCellStyle(workbook,
matrixHeaderTemplateCellStyle);
if (top) {
cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
}
if (right) {
cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
}
if (bottom) {
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
}
if (left) {
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
}
return cellStyle;
}
示例5: getHeaderStyle
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
private HSSFCellStyle getHeaderStyle(final int col)
{
String key = "header-" + col;
HSSFCellStyle cs_header = m_styles.get(key);
if (cs_header == null)
{
HSSFFont font_header = getFont(true);
cs_header = m_workbook.createCellStyle();
cs_header.setFont(font_header);
cs_header.setBorderLeft((short)2);
cs_header.setBorderTop((short)2);
cs_header.setBorderRight((short)2);
cs_header.setBorderBottom((short)2);
cs_header.setDataFormat(HSSFDataFormat.getBuiltinFormat("text"));
cs_header.setWrapText(true);
m_styles.put(key, cs_header);
}
return cs_header;
}
示例6: createSecondTitleStyle
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
private HSSFCellStyle createSecondTitleStyle(HSSFWorkbook wb){
HSSFCellStyle style = wb.createCellStyle();
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
style.setBorderBottom(HSSFCellStyle.BORDER_NONE);
style.setBorderLeft(HSSFCellStyle.BORDER_NONE);
style.setBorderRight(HSSFCellStyle.BORDER_NONE);
style.setBorderTop(HSSFCellStyle.BORDER_NONE);
style.setWrapText(true);
HSSFFont font = wb.createFont();
//font.setFontHeightInPoints((short)20);
font.setFontName("����");
style.setFont(font);
return style;
}
示例7: generateContStyle
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
/**
* @Description: 生成excel表格 单元格内容的样式
* @param workbook
* @return
*
* @History
* 1. 2014-12-19 linwb 创建方法
*/
private HSSFCellStyle generateContStyle(HSSFWorkbook workbook) {
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFillForegroundColor(contCellBackgroundColor);
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
cellStyle.setBorderBottom(contBorderBottom);
cellStyle.setBorderLeft(contBorderLeft);
cellStyle.setBorderRight(contBorderRight);
cellStyle.setBorderTop(contBorderTop);
cellStyle.setAlignment(contCellTextAlign);
cellStyle.setVerticalAlignment(contCellVehicleAlign);
// 生成字体
HSSFFont font = workbook.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
// 把字体应用到当前的样式
cellStyle.setFont(font);
return cellStyle;
}
示例8: estiloCabecalho
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
/**
* Estilo de cabecalho.
* @param wb
* @return retorna o estilo da celula.
* @author Ekler Paulino de Mattos.
*/
private HSSFCellStyle estiloCabecalho(HSSFWorkbook wb){
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THICK);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_THICK);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THICK);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_THICK);
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
// cellStyle.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
cellStyle.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
HSSFFont font = cellStyle.getFont(wb);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setColor(HSSFFont.COLOR_NORMAL);
font.setFontName(HSSFFont.FONT_ARIAL);
cellStyle.setFont(font);
return cellStyle;
}
示例9: estiloDadosConsultado
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
/**
* Estilo dos campos dos dados.
* @param wb
* @return retorna o estilo da celula.
* @author Ekler Paulino de Mattos.
*/
private HSSFCellStyle estiloDadosConsultado(HSSFWorkbook wb){
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
// plano de fundo - para que funcione deve se
// definido antes um padrao de preenchimento.
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
//cellStyle.setFillForegroundColor(HSSFColor.AQUA.index);
cellStyle.setFillForegroundColor(HSSFColor.WHITE.index);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
HSSFFont font = cellStyle.getFont(wb);
font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
font.setColor(HSSFFont.COLOR_NORMAL);
font.setFontName(HSSFFont.FONT_ARIAL);
cellStyle.setFont(font);
return cellStyle;
}
示例10: estiloDadosRetorno
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
/**
* Estilo dos campos dos dados.
* @param wb
* @return retorna o estilo da celula.
* @author Ekler Paulino de Mattos.
*/
private HSSFCellStyle estiloDadosRetorno(HSSFWorkbook wb){
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
// plano de fundo - para que funcione deve se
// definido antes um padrao de preenchimento.
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
//cellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
cellStyle.setFillForegroundColor(HSSFColor.PALE_BLUE.index);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
HSSFFont font = cellStyle.getFont(wb);
font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
font.setColor(HSSFFont.COLOR_NORMAL);
font.setFontName(HSSFFont.FONT_ARIAL);
cellStyle.setFont(font);
return cellStyle;
}
示例11: 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;
}
示例12: setHeaderStyle
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
private void setHeaderStyle(HSSFWorkbook wb) {
HSSFCellStyle style = wb.createCellStyle();
HSSFFont font = wb.createFont();
font.setColor(HSSFColor.BLACK.index);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setFontHeightInPoints((short) 8);
style.setFont(font);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setWrapText(true);
headerStyle = style;
}
示例13: setBorder
import org.apache.poi.hssf.usermodel.HSSFCellStyle; //导入方法依赖的package包/类
private void setBorder(WorkbookGeneratorContext context, HSSFCellStyle style) {
// 罫線
if (context.outputLine) {
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
}
}
示例14: 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;
}
示例15: 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;
}