本文整理了Java中org.apache.poi.hssf.usermodel.HSSFFont.setBold()
方法的一些代码示例,展示了HSSFFont.setBold()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFFont.setBold()
方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFFont
类名称:HSSFFont
方法名:setBold
[英]sets the font to be bold or not
[中]将字体设置为粗体或非粗体
代码示例来源: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: com.haulmont.cuba/cuba-gui
protected void createFonts() {
stdFont = wb.createFont();
boldFont = wb.createFont();
boldFont.setBold(true);
}
代码示例来源:origin: com.haulmont.charts/charts-web
protected void createCellStyle() {
HSSFFont boldFont = wb.createFont();
boldFont.setBold(true);
boldStyle = wb.createCellStyle();
boldStyle.setFont(boldFont);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.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: stackoverflow.com
font.setFontHeightInPoints((short)12);
font.setFontName("Arial");
font.setBold(true);
代码示例来源:origin: youseries/ureport
font.setBold(bold);
代码示例来源:origin: stackoverflow.com
InputStream inp;
HSSFWorkbook wb = null;
HSSFSheet sheet = null;
HSSFRow hssf_DataRow;
HSSFCell cell = null;
inp = new FileInputStream(FileName);
wb = new HSSFWorkbook(inp);
sheet = wb.getSheetAt(1);
hssf_DataRow = sheet.createRow((short) 1);
cell = hssf_DataRow.createCell(1);
HSSFFont font = (HSSFFont) sheet.getWorkbook().createFont();
HSSFCellStyle style = (HSSFCellStyle) cell.getCellStyle();
font.setBold(true);
style.setFont(font);
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
style.setFillForegroundColor(new HSSFColor.BLUE().getIndex());
cell.setCellStyle(style);
代码示例来源:origin: com.github.hazendaz/displaytag
/**
* Obtain the style used to render a header or footer.
* @return The style used to render a header or footer.
*/
private HSSFCellStyle getHeaderFooterStyle()
{
HSSFCellStyle style = this.wb.createCellStyle();
HSSFFont bold = this.wb.createFont();
bold.setBold(true);
style.setBorderBottom(BorderStyle.THIN);
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
style.setFont(bold);
return style;
}
代码示例来源:origin: stackoverflow.com
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("FirstSheet");
HSSFRow rowhead = sheet.createRow(0);
HSSFCellStyle style = wb.createCellStyle();
HSSFFont font = wb.createFont();
font.setFontName(HSSFFont.FONT_ARIAL);
font.setFontHeightInPoints((short)10);
font.setBold(true);
style.setFont(font);
rowhead.createCell(0).setCellValue("ID");
rowhead.createCell(1).setCellValue("First");
rowhead.createCell(2).setCellValue("Second");
rowhead.createCell(3).setCellValue("Third");
for(int j = 0; j<=3; j++)
rowhead.getCell(j).setCellStyle(style);
代码示例来源:origin: com.github.hazendaz/displaytag
/**
* Templated method that is called for all header cells.
*
* @param wb the wb
* @param headerCell the header cell
* @return the HSSF cell style
*/
public HSSFCellStyle createHeaderStyle(HSSFWorkbook wb, HeaderCell headerCell)
{
HSSFCellStyle headerStyle = getNewCellStyle();
headerStyle.setFillPattern(FillPatternType.FINE_DOTS);
headerStyle.setFillBackgroundColor(HSSFColorPredefined.BLUE_GREY.getIndex());
HSSFFont bold = wb.createFont();
bold.setBold(true);
bold.setColor(HSSFColorPredefined.WHITE.getIndex());
headerStyle.setFont(bold);
return headerStyle;
}
代码示例来源:origin: org.apache.poi/poi-examples
boldFont.setBold(true);
代码示例来源:origin: com.github.hazendaz/displaytag
/**
* @see org.displaytag.render.TableWriterTemplate#writeCaption(org.displaytag.model.TableModel)
*/
@Override
protected void writeCaption(TableModel model) throws Exception
{
HSSFCellStyle style = this.wb.createCellStyle();
HSSFFont bold = this.wb.createFont();
bold.setBold(true);
bold.setFontHeightInPoints((short) 14);
style.setFont(bold);
style.setAlignment(HorizontalAlignment.CENTER);
this.colNum = 0;
this.currentRow = this.sheet.createRow(this.sheetRowNum++);
this.currentCell = this.currentRow.createCell(this.colNum);
this.currentCell.setCellStyle(style);
String caption = model.getCaption();
this.currentCell.setCellValue(new HSSFRichTextString(caption));
this.rowSpanTable(model);
}
代码示例来源:origin: org.tentackle/tentackle-swing
HSSFRow row = sheet.createRow(srow);
HSSFFont font = wb.createFont();
font.setBold(true);
HSSFCellStyle cs = wb.createCellStyle();
cs.setAlignment(HorizontalAlignment.CENTER);
HSSFFont font = wb.createFont();
font.setItalic(true);
font.setBold(true);
HSSFCellStyle cs = wb.createCellStyle();
cs.setAlignment(HorizontalAlignment.CENTER);
代码示例来源:origin: org.apache.poi/poi-examples
f.setBold(true);
f2.setFontHeightInPoints((short) 10);
f2.setColor((short) 0xf);
f2.setBold(true);
cs.setFont(f);
cs.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)"));
代码示例来源:origin: org.apache.poi/poi-examples
f.setBold(true);
f2.setBold(true);
代码示例来源:origin: cuba-platform/yarg
newFont.setStrikeout(cellFont.getStrikeout());
newFont.setTypeOffset(cellFont.getTypeOffset());
newFont.setBold(cellFont.getBold());
newFont.setCharSet(cellFont.getCharSet());
newFont.setColor(cellFont.getColor());
代码示例来源:origin: com.bstek.ureport/ureport2-core
font.setBold(bold);
内容来源于网络,如有侵权,请联系作者删除!