本文整理匯總了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;
}