org.apache.poi.hssf.usermodel.HSSFFont.getFontHeightInPoints()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中org.apache.poi.hssf.usermodel.HSSFFont.getFontHeightInPoints()方法的一些代码示例,展示了HSSFFont.getFontHeightInPoints()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFFont.getFontHeightInPoints()方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFFont
类名称:HSSFFont
方法名:getFontHeightInPoints

HSSFFont.getFontHeightInPoints介绍

[英]get the font height
[中]获取字体高度

代码示例

代码示例来源:origin: caryyu/excel2pdf

  1. /**
  2. * 將 POI Font 轉換到 iText Font
  3. * @param font
  4. * @return
  5. */
  6. public static com.itextpdf.text.Font getFont(HSSFFont font) {
  7. try {
  8. com.itextpdf.text.Font iTextFont =FontFactory.getFont(font.getFontName(), BaseFont.IDENTITY_H, BaseFont.EMBEDDED,font.getFontHeightInPoints());
  9. return iTextFont;
  10. } catch (Exception e) {
  11. e.printStackTrace();
  12. }
  13. return null;
  14. }
  15. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

  1. void buildStyle_font( HSSFWorkbook workbook, StringBuilder style,
  2. HSSFFont font ) {
  3. if ( font.getBold() )
  4. {
  5. style.append( "font-weight:bold;" );
  6. }
  7. final HSSFColor fontColor = workbook.getCustomPalette().getColor(
  8. font.getColor() );
  9. if ( fontColor != null )
  10. style.append("color: ").append(ExcelToHtmlUtils.getColor(fontColor)).append("; ");
  11. if ( font.getFontHeightInPoints() != 0 )
  12. style.append("font-size:").append(font.getFontHeightInPoints()).append("pt;");
  13. if ( font.getItalic() )
  14. {
  15. style.append( "font-style:italic;" );
  16. }
  17. }

代码示例来源:origin: org.apache.poi/poi-contrib

  1. /**
  2. * Creates a new font for a specific cell style
  3. */
  4. public static Font makeFont(HSSFFont font) {
  5. boolean isbold = font.getBoldweight() > HSSFFont.BOLDWEIGHT_NORMAL;
  6. boolean isitalics = font.getItalic();
  7. int fontstyle = Font.PLAIN;
  8. if (isbold) {
  9. fontstyle = Font.BOLD;
  10. }
  11. if (isitalics) {
  12. fontstyle = fontstyle | Font.ITALIC;
  13. }
  14. int fontheight = font.getFontHeightInPoints();
  15. if (fontheight == 9) {
  16. //fix for stupid ol Windows
  17. fontheight = 10;
  18. }
  19. return new Font(font.getFontName(), fontstyle, fontheight);
  20. }

代码示例来源:origin: org.apache.poi/poi-examples

  1. /**
  2. * Creates a new font for a specific cell style
  3. */
  4. public static Font makeFont(HSSFFont font) {
  5. boolean isbold = font.getBold();
  6. boolean isitalics = font.getItalic();
  7. int fontstyle = Font.PLAIN;
  8. if (isbold) {
  9. fontstyle = Font.BOLD;
  10. }
  11. if (isitalics) {
  12. fontstyle = fontstyle | Font.ITALIC;
  13. }
  14. int fontheight = font.getFontHeightInPoints();
  15. if (fontheight == 9) {
  16. //fix for stupid ol Windows
  17. fontheight = 10;
  18. }
  19. return new Font(font.getFontName(), fontstyle, fontheight);
  20. }

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

  1. void buildStyle_font( HSSFWorkbook workbook, StringBuilder style,
  2. HSSFFont font )
  3. {
  4. switch ( font.getBoldweight() )
  5. {
  6. case HSSFFont.BOLDWEIGHT_BOLD:
  7. style.append( "font-weight:bold;" );
  8. break;
  9. case HSSFFont.BOLDWEIGHT_NORMAL:
  10. // by default, not not increase HTML size
  11. // style.append( "font-weight: normal; " );
  12. break;
  13. }
  14. final HSSFColor fontColor = workbook.getCustomPalette().getColor(
  15. font.getColor() );
  16. if ( fontColor != null )
  17. style.append( "color: " + ExcelToHtmlUtils.getColor( fontColor )
  18. + "; " );
  19. if ( font.getFontHeightInPoints() != 0 )
  20. style.append( "font-size:" + font.getFontHeightInPoints() + "pt;" );
  21. if ( font.getItalic() )
  22. {
  23. style.append( "font-style:italic;" );
  24. }
  25. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

  1. /**
  2. * Creates a new font for a specific cell style
  3. */
  4. public static Font makeFont(HSSFFont font) {
  5. boolean isbold = font.getBoldweight() > HSSFFont.BOLDWEIGHT_NORMAL;
  6. boolean isitalics = font.getItalic();
  7. int fontstyle = Font.PLAIN;
  8. if (isbold) {
  9. fontstyle = Font.BOLD;
  10. }
  11. if (isitalics) {
  12. fontstyle = fontstyle | Font.ITALIC;
  13. }
  14. int fontheight = font.getFontHeightInPoints();
  15. if (fontheight == 9) {
  16. //fix for stupid ol Windows
  17. fontheight = 10;
  18. }
  19. return new Font(font.getFontName(), fontstyle, fontheight);
  20. }

代码示例来源:origin: com.haulmont.cuba/cuba-gui

  1. private FontMetrics getFontMetrics(HSSFFont hf){
  2. FontMetrics fm;
  3. Short pFont = hf.getIndex();
  4. fm = fontMetrics.get(pFont);
  5. if (fm == null) {
  6. int style;
  7. if (hf.getBold() || hf.getItalic()) {
  8. style = 0;
  9. if (hf.getBold()) style ^= Font.BOLD;
  10. if (hf.getItalic()) style ^= Font.ITALIC;
  11. } else {
  12. style = Font.PLAIN;
  13. }
  14. Font f = new java.awt.Font(hf.getFontName(), style, hf.getFontHeightInPoints());
  15. if (graphics == null) {
  16. BufferedImage i = new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_GRAY);
  17. graphics = i.createGraphics();
  18. }
  19. fm = graphics.getFontMetrics(f);
  20. fontMetrics.put(pFont, fm);
  21. }
  22. return fm;
  23. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

  1. protected void processCellStyleFont( HSSFWorkbook workbook,
  2. Element blockTarget, HSSFFont font )
  3. {
  4. Triplet triplet = new Triplet();
  5. triplet.fontName = font.getFontName();
  6. triplet.bold = font.getBold();
  7. triplet.italic = font.getItalic();
  8. getFontReplacer().update( triplet );
  9. setBlockProperties( blockTarget, triplet );
  10. final HSSFColor fontColor = workbook.getCustomPalette().getColor(
  11. font.getColor() );
  12. if ( fontColor != null )
  13. blockTarget.setAttribute( "color",
  14. ExcelToHtmlUtils.getColor( fontColor ) );
  15. if ( font.getFontHeightInPoints() != 0 )
  16. blockTarget.setAttribute( "font-size", font.getFontHeightInPoints()
  17. + "pt" );
  18. }

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

  1. protected void processCellStyleFont( HSSFWorkbook workbook,
  2. Element blockTarget, HSSFFont font )
  3. {
  4. Triplet triplet = new Triplet();
  5. triplet.fontName = font.getFontName();
  6. switch ( font.getBoldweight() )
  7. {
  8. case HSSFFont.BOLDWEIGHT_BOLD:
  9. triplet.bold = true;
  10. break;
  11. case HSSFFont.BOLDWEIGHT_NORMAL:
  12. triplet.bold = false;
  13. break;
  14. }
  15. if ( font.getItalic() )
  16. {
  17. triplet.italic = true;
  18. }
  19. getFontReplacer().update( triplet );
  20. setBlockProperties( blockTarget, triplet );
  21. final HSSFColor fontColor = workbook.getCustomPalette().getColor(
  22. font.getColor() );
  23. if ( fontColor != null )
  24. blockTarget.setAttribute( "color",
  25. ExcelToHtmlUtils.getColor( fontColor ) );
  26. if ( font.getFontHeightInPoints() != 0 )
  27. blockTarget.setAttribute( "font-size", font.getFontHeightInPoints()
  28. + "pt" );
  29. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

  1. if (isitalics) fontstyle = fontstyle | Font.ITALIC;
  2. int fontheight = f.getFontHeightInPoints();
  3. if (fontheight == 9) fontheight = 10; //fix for stupid ol Windows

代码示例来源:origin: org.apache.poi/poi-contrib

  1. if (isitalics) fontstyle = fontstyle | Font.ITALIC;
  2. int fontheight = f.getFontHeightInPoints();
  3. if (fontheight == 9) fontheight = 10; //fix for stupid ol Windows

代码示例来源:origin: jasperreports/jasperreports

  1. cf.getFontName().equals(fontName) &&
  2. (cf.getColor() == forecolor) &&
  3. (cf.getFontHeightInPoints() == fontSize) &&
  4. ((cf.getUnderline() == HSSFFont.U_SINGLE)?(font.isUnderline()):(!font.isUnderline())) &&
  5. (cf.getStrikeout() == font.isStrikeThrough()) &&

代码示例来源:origin: org.apache.poi/poi-examples

  1. int fontheight = f.getFontHeightInPoints();
  2. if (fontheight == 9) {
  3. fontheight = 10; //fix for stupid ol Windows

代码示例来源:origin: com.haulmont.yarg/yarg

  1. newFont.setUnderline(cellFont.getUnderline());
  2. newFont.setFontHeight(cellFont.getFontHeight());
  3. newFont.setFontHeightInPoints(cellFont.getFontHeightInPoints());
  4. fontCache.addCachedFont(cellFont, newFont);

代码示例来源:origin: cuba-platform/yarg

  1. newFont.setUnderline(cellFont.getUnderline());
  2. newFont.setFontHeight(cellFont.getFontHeight());
  3. newFont.setFontHeightInPoints(cellFont.getFontHeightInPoints());
  4. fontCache.addCachedFont(cellFont, newFont);

相关文章