本文整理了Java中org.apache.poi.hssf.usermodel.HSSFWorkbook.createFont()
方法的一些代码示例,展示了HSSFWorkbook.createFont()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFWorkbook.createFont()
方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFWorkbook
类名称:HSSFWorkbook
方法名:createFont
[英]create a new Font and add it to the workbook's font table
[中]创建新字体并将其添加到工作簿的字体表中
代码示例来源: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: rakam-io/rakam
HSSFFont boldFont = workbook.createFont();
boldFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
代码示例来源:origin: stackoverflow.com
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
HSSFFont font = wb.createFont();
font.setColor(HSSFColor.RED.index);
style.setFont(font);
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected void createFonts() {
stdFont = wb.createFont();
boldFont = wb.createFont();
boldFont.setBold(true);
}
代码示例来源: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: com.haulmont.charts/charts-web
protected void createCellStyle() {
HSSFFont boldFont = wb.createFont();
boldFont.setBold(true);
boldStyle = wb.createCellStyle();
boldStyle.setFont(boldFont);
}
代码示例来源:origin: TomasKypta/android-lang-tool
private static HSSFCellStyle createTextStyle(HSSFWorkbook wb) {
HSSFFont plain = wb.createFont();
plain.setFontHeightInPoints((short)12);
HSSFCellStyle textStyle = wb.createCellStyle();
textStyle.setFont(plain);
return textStyle;
}
代码示例来源:origin: stackoverflow.com
private HSSFFont createAndSetFontStyle(HSSFWorkbook wb) {
HSSFFont font = wb.createFont();
font.setFontName(XSSFFont.DEFAULT_FONT_NAME);
font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);
font.setFontHeightInPoints((short)10);
return font;
}
HSSFCellStyle cellStyle = workBook.createCellStyle();
HSSFFont createfont = createAndSetFontStyle(workBook);
cellStyle.setFont(createfont);
cell.setCellStyle(cellStyle);
代码示例来源:origin: TomasKypta/android-lang-tool
private static HSSFCellStyle createKeyStyle(HSSFWorkbook wb) {
HSSFFont bold = wb.createFont();
bold.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
bold.setFontHeightInPoints((short)11);
HSSFCellStyle keyStyle = wb.createCellStyle();
keyStyle.setFont(bold);
return keyStyle;
}
代码示例来源:origin: paypal/SeLion
private static HSSFFont createCustomFont(short colorIndex, Byte underlineWeight) {
HSSFFont font = wb1.createFont();
font.setFontName(HSSFFont.FONT_ARIAL);
font.setFontHeightInPoints((short) 10);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setColor(colorIndex);
font.setUnderline(underlineWeight);
return font;
}
代码示例来源:origin: TomasKypta/android-lang-tool
private static HSSFCellStyle createCommentStyle(HSSFWorkbook wb) {
HSSFFont commentFont = wb.createFont();
commentFont.setColor(HSSFColor.GREEN.index);
commentFont.setItalic(true);
commentFont.setFontHeightInPoints((short)12);
HSSFCellStyle commentStyle = wb.createCellStyle();
commentStyle.setFont(commentFont);
return commentStyle;
}
代码示例来源:origin: TomasKypta/android-lang-tool
private static HSSFCellStyle createPlurarStyle(HSSFWorkbook wb) {
HSSFFont commentFont = wb.createFont();
commentFont.setColor(HSSFColor.GREY_50_PERCENT.index);
commentFont.setItalic(true);
commentFont.setFontHeightInPoints((short)12);
HSSFCellStyle commentStyle = wb.createCellStyle();
commentStyle.setFont(commentFont);
return commentStyle;
}
代码示例来源:origin: org.sakaiproject.assignment/sakai-assignment-impl
private HSSFCellStyle createHeaderStyle(){
//TO-DO read style information from sakai.properties
HSSFFont font = gradesWorkbook.createFont();
font.setFontName(HSSFFont.FONT_ARIAL);
font.setColor(IndexedColors.PLUM.getIndex());
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
HSSFCellStyle cellStyle = gradesWorkbook.createCellStyle();
cellStyle.setFont(font);
return cellStyle;
}
代码示例来源:origin: stackoverflow.com
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("New sheet");
HSSFFont font = wb.createFont();
font.setFontName("Arial Unicode MS");
HSSFCellStyle style = wb.createCellStyle();
style.setFont(font);
HSSFRow row = sheet.createRow((short) 0);
HSSFCell cell = row.createCell((short) 0);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellStyle(style);
cell.setCellValue("\u53f8");
代码示例来源:origin: youseries/ureport
HSSFFont font=wb.createFont();
font.setFontHeight((short)(cellStyle.getFontSize()*20));
Boolean bold=cellStyle.getBold();
代码示例来源:origin: TomasKypta/android-lang-tool
private static HSSFCellStyle createTilteStyle(HSSFWorkbook wb) {
HSSFFont bold = wb.createFont();
bold.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
HSSFCellStyle style = wb.createCellStyle();
style.setFont(bold);
style.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setWrapText(true);
return style;
}
代码示例来源:origin: org.seasar.tuigwaa/tuigwaa-ext
private void createDefaultHeaderCellStyle() {
headerCellStyle = workbook.createCellStyle();
HSSFFont font = workbook.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setColor(HSSFColor.WHITE.index);
headerCellStyle.setFont(font);
headerCellStyle
.setFillBackgroundColor(HSSFColor.GREY_25_PERCENT.index);
headerCellStyle.setFillPattern(HSSFCellStyle.FINE_DOTS);
headerCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
headerCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
}
代码示例来源: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;
}
}
代码示例来源:origin: org.metaeffekt.core/ae-inventory-processor
private HSSFCellStyle createHeaderStyle(HSSFWorkbook myWorkBook) {
Font headerFont = myWorkBook.createFont();
headerFont.setColor(Font.COLOR_NORMAL);
HSSFPalette palette = myWorkBook.getCustomPalette();
HSSFColor headerColor = palette.findSimilarColor((byte) 149, (byte) 179, (byte) 215);
HSSFCellStyle headerStyle = myWorkBook.createCellStyle();
headerStyle.setFillForegroundColor(headerColor.getIndex());
headerStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
headerStyle.setFont(headerFont);
headerStyle.setWrapText(true);
return headerStyle;
}
内容来源于网络,如有侵权,请联系作者删除!