本文整理了Java中org.apache.poi.ss.usermodel.Font.setBoldweight()
方法的一些代码示例,展示了Font.setBoldweight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Font.setBoldweight()
方法的具体详情如下:
包路径:org.apache.poi.ss.usermodel.Font
类名称:Font
方法名:setBoldweight
暂无
代码示例来源:origin: wuyouzhuguli/FEBS-Shiro
@Override
public CellStyle headCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
Font font = wb.createFont();
cellStyle.setFillForegroundColor((short) 12);
cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);// 填充模式
cellStyle.setBorderTop(CellStyle.BORDER_THIN);// 上边框为细边框
cellStyle.setBorderRight(CellStyle.BORDER_THIN);// 右边框为细边框
cellStyle.setBorderBottom(CellStyle.BORDER_THIN);// 下边框为细边框
cellStyle.setBorderLeft(CellStyle.BORDER_THIN);// 左边框为细边框
cellStyle.setAlignment(CellStyle.ALIGN_LEFT);// 对齐
cellStyle.setFillForegroundColor(HSSFColor.GREEN.index);
cellStyle.setFillBackgroundColor(HSSFColor.GREEN.index);
font.setBoldweight(Font.BOLDWEIGHT_NORMAL);
// font.setFontHeightInPoints((short) 12);// 字体大小
font.setColor(HSSFColor.WHITE.index);
// 应用标题字体到标题样式
cellStyle.setFont(font);
return cellStyle;
}
代码示例来源:origin: stackoverflow.com
Sheet sheet = wb.createSheet("test");
CellStyle cs = wb.createCellStyle();
Font f = wb.createFont();
f.setBoldweight(Font.BOLDWEIGHT_BOLD);
cs.setFont(f);
sheet.setDefaultColumnStyle(1,cs); //set bold for column 1
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) {
Path myFile = Paths.get(System.getProperty("user.home"), "Desktop", "tester.xlsx");
try {
XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(myFile.toFile()));
XSSFSheet sheet = wb.getSheetAt(0);
makeRowBold(wb, sheet.getRow(0));
wb.write(new FileOutputStream(myFile.toFile()));
} catch (IOException e) {
e.printStackTrace();
}
}
public static void makeRowBold(Workbook wb, Row row){
CellStyle style = wb.createCellStyle();//Create style
Font font = wb.createFont();//Create font
font.setBoldweight(Font.BOLDWEIGHT_BOLD);//Make font bold
style.setFont(font);//set it to bold
for(int i = 0; i < row.getLastCellNum(); i++){//For each cell in the row
row.getCell(i).setCellStyle(style);//Set the sty;e
}
}
代码示例来源:origin: stackoverflow.com
public static void makeRowBold(Workbook wb, Row row){
CellStyle style = wb.createCellStyle();//Create style
Font font = wb.createFont();//Create font
font.setBoldweight(Font.BOLDWEIGHT_BOLD);//Make font bold
style.setFont(font);//set it to bold
for(int i = 0; i < row.getLastCellNum(); i++){//For each cell in the row
row.getCell(i).setCellStyle(style);//Set the style
}
}
代码示例来源:origin: br.com.objectos/xls
@Override
void apachePOI(Font font) {
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
}
},
代码示例来源:origin: br.com.objectos/xls-core
@Override
void apachePOI(Font font) {
font.setBoldweight(Font.BOLDWEIGHT_NORMAL);
}
};
代码示例来源:origin: br.com.objectos/way-io
@Override
void apachePOI(Font font) {
font.setBoldweight(Font.BOLDWEIGHT_NORMAL);
}
};
代码示例来源:origin: br.com.objectos/xls
@Override
void apachePOI(Font font) {
font.setBoldweight(Font.BOLDWEIGHT_NORMAL);
}
};
代码示例来源:origin: br.com.objectos/xls-core
@Override
void apachePOI(Font font) {
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
}
},
代码示例来源:origin: br.com.objectos/way-io
@Override
void apachePOI(Font font) {
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
}
},
代码示例来源:origin: stackoverflow.com
private static Map<String, CellStyle> styles;
private static Map<String, CellStyle> createStyles(Workbook wb){
Map<String, CellStyle> styles = new HashMap<String, CellStyle>();
DataFormat df = wb.createDataFormat();
CellStyle style;
Font headerFont = wb.createFont();
headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
headerFont.setFontHeightInPoints((short) 12);
style = createBorderedStyle(wb);
style.setAlignment(CellStyle.ALIGN_CENTER);
style.setFont(headerFont);
styles.put("style1", style);
style = createBorderedStyle(wb);
style.setAlignment(CellStyle.ALIGN_CENTER);
style.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex());
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
style.setFont(headerFont);
style.setDataFormat(df.getFormat("d-mmm"));
styles.put("date_style", style);
...
return styles;
}
代码示例来源:origin: qcadoo/mes
FontsContainer(HSSFWorkbook workbook) {
boldFont = workbook.createFont();
boldFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
}
}
代码示例来源:origin: qcadoo/mes
FontsContainer(HSSFWorkbook workbook) {
headerFont = workbook.createFont();
headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
}
}
代码示例来源:origin: stackoverflow.com
for (int i = 0; i < 10000; i++) {
Row row = sheet.createRow(i);
Cell cell = row.createCell((short) 0);
CellStyle style = workbook.createCellStyle();
Font font = workbook.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
style.setFont(font);
cell.setCellStyle(style);
}
代码示例来源:origin: stackoverflow.com
CellStyle style = workbook.createCellStyle();
Font font = workbook.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
style.setFont(font);
for (int i = 0; i < 10000; i++) {
Row row = sheet.createRow(i);
Cell cell = row.createCell((short) 0);
cell.setCellStyle(style);
}
代码示例来源:origin: stackoverflow.com
Row rowhead= sheet.createRow((short)0);
Font f = wb.createFont();
f.setBoldweight(Font.BOLDWEIGHT_BOLD);
CellStyle cs = wb.createCellStyle();
cs.setFont(f);
Cell cell;
cell = rowhead.createCell((short) 0);
cell.setCellValue("SRNum");
cell.setCellStyle(cs);
cell = rowhead.createCell((short) 1);
cell.setCellValue("Name");
cell.setCellStyle(cs);
代码示例来源:origin: qcadoo/mes
private static Font createFontArialWithGivenBoldweight(XSSFWorkbook workbook, short boldweight) {
Font font = workbook.createFont();
font.setFontName(HSSFFont.FONT_ARIAL);
font.setFontHeightInPoints((short) 10);
font.setBoldweight(boldweight);
return font;
}
代码示例来源:origin: br.com.objectos/way-io
CellStyle createStyle(Workbook wb) {
CellStyle style = wb.createCellStyle();
style.setAlignment(align.apachePOI());
if (bold) {
Font font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
style.setFont(font);
}
return style;
}
代码示例来源:origin: br.com.objectos.way/io-legacy
CellStyle createStyle(Workbook wb) {
CellStyle style = wb.createCellStyle();
style.setAlignment(align.apachePOI());
if (bold) {
Font font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
style.setFont(font);
}
return style;
}
代码示例来源:origin: org.motechproject/motech-bulk-export-import
public HSSFCellStyle style() {
Font font = worksheet.getWorkbook().createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
font.setFontHeight((short) TITLE_FONT_HEIGHT);
HSSFCellStyle cellStyle = worksheet.getWorkbook().createCellStyle();
cellStyle.setAlignment(alignment);
cellStyle.setWrapText(true);
cellStyle.setFont(font);
return cellStyle;
}
}
内容来源于网络,如有侵权,请联系作者删除!