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

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

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

HSSFFont.setStrikeout介绍

[英]set whether to use a strikeout horizontal line through the text or not
[中]设置是否在文本中使用删除线水平线

代码示例

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

  1. private HSSFFont matchFont( Font matchFont )
  2. {
  3. HSSFColor hssfColor = workbook.getCustomPalette()
  4. .findColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
  5. if (hssfColor == null)
  6. hssfColor = workbook.getCustomPalette().findSimilarColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
  7. boolean bold = (matchFont.getStyle() & Font.BOLD) != 0;
  8. boolean italic = (matchFont.getStyle() & Font.ITALIC) != 0;
  9. HSSFFont hssfFont = workbook.findFont(bold,
  10. hssfColor.getIndex(),
  11. (short)(matchFont.getSize() * 20),
  12. matchFont.getName(),
  13. italic,
  14. false,
  15. (short)0,
  16. (byte)0);
  17. if (hssfFont == null)
  18. {
  19. hssfFont = workbook.createFont();
  20. hssfFont.setBold(bold);
  21. hssfFont.setColor(hssfColor.getIndex());
  22. hssfFont.setFontHeight((short)(matchFont.getSize() * 20));
  23. hssfFont.setFontName(matchFont.getName());
  24. hssfFont.setItalic(italic);
  25. hssfFont.setStrikeout(false);
  26. hssfFont.setTypeOffset((short) 0);
  27. hssfFont.setUnderline((byte) 0);
  28. }
  29. return hssfFont;
  30. }

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

  1. private HSSFFont matchFont( Font font )
  2. {
  3. HSSFColor hssfColor = workbook.getCustomPalette()
  4. .findColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
  5. if (hssfColor == null)
  6. hssfColor = workbook.getCustomPalette().findSimilarColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
  7. boolean bold = (font.getStyle() & Font.BOLD) != 0;
  8. boolean italic = (font.getStyle() & Font.ITALIC) != 0;
  9. HSSFFont hssfFont = workbook.findFont(bold ? HSSFFont.BOLDWEIGHT_BOLD : 0,
  10. hssfColor.getIndex(),
  11. (short)(font.getSize() * 20),
  12. font.getName(),
  13. italic,
  14. false,
  15. (short)0,
  16. (byte)0);
  17. if (hssfFont == null)
  18. {
  19. hssfFont = workbook.createFont();
  20. hssfFont.setBoldweight(bold ? HSSFFont.BOLDWEIGHT_BOLD : 0);
  21. hssfFont.setColor(hssfColor.getIndex());
  22. hssfFont.setFontHeight((short)(font.getSize() * 20));
  23. hssfFont.setFontName(font.getName());
  24. hssfFont.setItalic(italic);
  25. hssfFont.setStrikeout(false);
  26. hssfFont.setTypeOffset((short) 0);
  27. hssfFont.setUnderline((byte) 0);
  28. }
  29. return hssfFont;
  30. }

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

  1. private HSSFFont matchFont( Font matchFont )
  2. {
  3. HSSFColor hssfColor = workbook.getCustomPalette()
  4. .findColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
  5. if (hssfColor == null)
  6. hssfColor = workbook.getCustomPalette().findSimilarColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
  7. boolean bold = (matchFont.getStyle() & Font.BOLD) != 0;
  8. boolean italic = (matchFont.getStyle() & Font.ITALIC) != 0;
  9. HSSFFont hssfFont = workbook.findFont(bold,
  10. hssfColor.getIndex(),
  11. (short)(matchFont.getSize() * 20),
  12. matchFont.getName(),
  13. italic,
  14. false,
  15. (short)0,
  16. (byte)0);
  17. if (hssfFont == null)
  18. {
  19. hssfFont = workbook.createFont();
  20. hssfFont.setBold(bold);
  21. hssfFont.setColor(hssfColor.getIndex());
  22. hssfFont.setFontHeight((short)(matchFont.getSize() * 20));
  23. hssfFont.setFontName(matchFont.getName());
  24. hssfFont.setItalic(italic);
  25. hssfFont.setStrikeout(false);
  26. hssfFont.setTypeOffset((short) 0);
  27. hssfFont.setUnderline((byte) 0);
  28. }
  29. return hssfFont;
  30. }

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

  1. private HSSFFont matchFont( Font font )
  2. {
  3. HSSFColor hssfColor = workbook.getCustomPalette()
  4. .findColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
  5. if (hssfColor == null)
  6. hssfColor = workbook.getCustomPalette().findSimilarColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
  7. boolean bold = (font.getStyle() & Font.BOLD) != 0;
  8. boolean italic = (font.getStyle() & Font.ITALIC) != 0;
  9. HSSFFont hssfFont = workbook.findFont(bold ? HSSFFont.BOLDWEIGHT_BOLD : 0,
  10. hssfColor.getIndex(),
  11. (short)(font.getSize() * 20),
  12. font.getName(),
  13. italic,
  14. false,
  15. (short)0,
  16. (byte)0);
  17. if (hssfFont == null)
  18. {
  19. hssfFont = workbook.createFont();
  20. hssfFont.setBoldweight(bold ? HSSFFont.BOLDWEIGHT_BOLD : 0);
  21. hssfFont.setColor(hssfColor.getIndex());
  22. hssfFont.setFontHeight((short)(font.getSize() * 20));
  23. hssfFont.setFontName(font.getName());
  24. hssfFont.setItalic(italic);
  25. hssfFont.setStrikeout(false);
  26. hssfFont.setTypeOffset((short) 0);
  27. hssfFont.setUnderline((byte) 0);
  28. }
  29. return hssfFont;
  30. }

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

  1. public static void main(String[] args) throws IOException {
  2. try (HSSFWorkbook wb = new HSSFWorkbook()) {
  3. HSSFSheet sheet = wb.createSheet("new sheet");
  4. // Create a row and put some cells in it. Rows are 0 based.
  5. HSSFRow row = sheet.createRow(1);
  6. // Create a new font and alter it.
  7. HSSFFont font = wb.createFont();
  8. font.setFontHeightInPoints((short) 24);
  9. font.setFontName("Courier New");
  10. font.setItalic(true);
  11. font.setStrikeout(true);
  12. // Fonts are set into a style so create a new one to use.
  13. HSSFCellStyle style = wb.createCellStyle();
  14. style.setFont(font);
  15. // Create a cell and put a value in it.
  16. HSSFCell cell = row.createCell(1);
  17. cell.setCellValue("This is a test of fonts");
  18. cell.setCellStyle(style);
  19. // Write the output to a file
  20. try (FileOutputStream fileOut = new FileOutputStream("workbook.xls")) {
  21. wb.write(fileOut);
  22. }
  23. }
  24. }
  25. }

代码示例来源:origin: stackoverflow.com

  1. fontNew.setFontHeight(fontOld.getFontHeight());
  2. fontNew.setItalic(fontOld.getItalic());
  3. fontNew.setStrikeout(fontOld.getStrikeout());
  4. fontNew.setTypeOffset(fontOld.getTypeOffset());
  5. fontNew.setUnderline(fontOld.getUnderline());

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

  1. cellFont.setStrikeout(true);

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

  1. newFont.setStrikeout(cellFont.getStrikeout());
  2. newFont.setTypeOffset(cellFont.getTypeOffset());
  3. newFont.setBold(cellFont.getBold());

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

  1. newFont.setStrikeout(cellFont.getStrikeout());
  2. newFont.setTypeOffset(cellFont.getTypeOffset());
  3. newFont.setBoldweight(cellFont.getBoldweight());

相关文章