本文整理汇总了Java中org.apache.poi.ss.usermodel.Font.BOLDWEIGHT_NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Java Font.BOLDWEIGHT_NORMAL属性的具体用法?Java Font.BOLDWEIGHT_NORMAL怎么用?Java Font.BOLDWEIGHT_NORMAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.poi.ss.usermodel.Font
的用法示例。
在下文中一共展示了Font.BOLDWEIGHT_NORMAL属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: poiFontWeightFromBirt
/**
* Object a POI font weight from a BIRT string.
* @param fontWeight
* The font weight as understood by BIRT.
* @return
* One of the Font.BOLDWEIGHT_* constants.
*/
public short poiFontWeightFromBirt(String fontWeight) {
if(fontWeight == null) {
return 0;
}
if("bold".equals(fontWeight)) {
return Font.BOLDWEIGHT_BOLD;
}
return Font.BOLDWEIGHT_NORMAL;
}
示例2: netxiliaStyle2Poi
public static CellStyle netxiliaStyle2Poi(Styles nxStyle, Workbook workbook, CellStyle poiStyle) {
if (nxStyle == null) {
return poiStyle;
}
poiStyle.setWrapText(nxStyle.contains(DefaultStyle.nowrap.getStyle()));
// font
short bold = nxStyle.contains(DefaultStyle.bold.getStyle()) ? Font.BOLDWEIGHT_BOLD : Font.BOLDWEIGHT_NORMAL;
byte underline = nxStyle.contains(DefaultStyle.underline.getStyle()) ? Font.U_SINGLE : Font.U_NONE;
boolean italic = nxStyle.contains(DefaultStyle.italic.getStyle());
boolean strikeout = nxStyle.contains(DefaultStyle.strikeout.getStyle());
Font defaultFont = workbook.getFontAt(poiStyle.getFontIndex());
Font font = workbook.findFont(bold, defaultFont.getColor(), defaultFont.getFontHeight(),
defaultFont.getFontName(), italic, strikeout, defaultFont.getTypeOffset(), underline);
if (font == null) {
font = workbook.createFont();
font.setBoldweight(bold);
font.setItalic(italic);
font.setUnderline(underline);
font.setStrikeout(strikeout);
}
poiStyle.setFont(font);
// borders
if (nxStyle.contains(DefaultStyle.borderLeft.getStyle())) {
poiStyle.setBorderLeft(CellStyle.BORDER_THIN);
}
if (nxStyle.contains(DefaultStyle.borderRight.getStyle())) {
poiStyle.setBorderRight(CellStyle.BORDER_THIN);
}
if (nxStyle.contains(DefaultStyle.borderTop.getStyle())) {
poiStyle.setBorderTop(CellStyle.BORDER_THIN);
}
if (nxStyle.contains(DefaultStyle.borderBottom.getStyle())) {
poiStyle.setBorderBottom(CellStyle.BORDER_THIN);
}
// align
if (nxStyle.contains(DefaultStyle.alignLeft.getStyle())) {
poiStyle.setAlignment(CellStyle.ALIGN_LEFT);
} else if (nxStyle.contains(DefaultStyle.alignRight.getStyle())) {
poiStyle.setAlignment(CellStyle.ALIGN_RIGHT);
} else if (nxStyle.contains(DefaultStyle.alignCenter.getStyle())) {
poiStyle.setAlignment(CellStyle.ALIGN_CENTER);
} else if (nxStyle.contains(DefaultStyle.alignJustify.getStyle())) {
poiStyle.setAlignment(CellStyle.ALIGN_JUSTIFY);
}
return poiStyle;
}