org.apache.poi.ss.usermodel.Font.setItalic()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(248)

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

Font.setItalic介绍

[英]set whether to use italics or not
[中]设置是否使用斜体

代码示例

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

cellFont.setItalic(true);

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

facetFont.setItalic(true);

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

cellFont.setItalic(true);

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

facetFont.setItalic(true);

代码示例来源:origin: pentaho/pentaho-kettle

hlink_font.setFontHeight( origFont.getFontHeight() );
hlink_font.setFontName( origFont.getFontName() );
hlink_font.setItalic( origFont.getItalic() );
hlink_font.setStrikeout( origFont.getStrikeout() );
hlink_font.setTypeOffset( origFont.getTypeOffset() );

代码示例来源:origin: br.com.objectos/xls

@Override
 void apachePOI(Font font) {
  font.setItalic(true);
 }
},

代码示例来源:origin: br.com.objectos/xls-core

@Override
 void apachePOI(Font font) {
  font.setItalic(true);
 }
},

代码示例来源:origin: br.com.objectos/way-io

@Override
 void apachePOI(Font font) {
  font.setItalic(true);
 }
},

代码示例来源:origin: Vatavuk/excel-io

/**
 * Italic font.
 * @return FontStyle Font style
 */
public FontStyle withItalic() {
  return new FontStyle(
    this.props.with(font -> font.setItalic(true))
  );
}

代码示例来源:origin: org.primefaces/primefaces

cellFont.setItalic(true);

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

Workbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet("new sheet");

// Create a row and put some cells in it. Rows are 0 based.
Row row = sheet.createRow(1);

// Create a new font and alter it.
Font font = wb.createFont();
font.setCharSet(FontCharset.ARABIC.getValue());
font.setFontHeightInPoints((short)24);
font.setFontName("B Nazanin");
font.setItalic(true);
font.setStrikeout(true);

// Fonts are set into a style so create a new one to use.
CellStyle style = wb.createCellStyle();
style.setFont(font);

// Create a cell and put a value in it.
Cell cell = row.createCell(1);
cell.setCellValue("سلام");
cell.setCellStyle(style);

// Write the output to a file
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();

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

Cell cell = row.createCell(1);
 RichTextString rt = new XSSFRichTextString("The quick brown fox");
 Font font1 = wb.createFont();
 font1.setBoldWeight(Font.BOLDWEIGHT_BOLD);
 rt.applyFont(0, 10, font1);
 Font font2 = wb.createFont();
 font2.setItalic(true);
 font2.setUnderline(XSSFFont.U_DOUBLE);
 rt.applyFont(10, 19, font2);
 Font font3 = wb.createFont();
 font3.setBoldWeight(Font.BOLDWEIGHT_NORMAL);
 rt.append(" Jumped over the lazy dog", font3);
 cell.setCellValue(rt);

代码示例来源:origin: org.bidib.jbidib/jbidibc-experimental

private CellStyle prepareH1CellStyle(final Workbook wb) {
  // Create a new font and alter it.
  Font font = wb.createFont();
  font.setFontHeightInPoints((short) 24);
  // font.setFontName("Courier New");
  font.setItalic(true);
  font.setBold(true);
  // font.setStrikeout(true);
  font.setColor(IndexedColors.BLUE_GREY.getIndex());
  // Fonts are set into a style so create a new one to use.
  CellStyle style = wb.createCellStyle();
  style.setFont(font);
  return style;
}

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

public static void differentFontTypeInSameCell(){
  Workbook wb = new HSSFWorkbook();
  Sheet sheet = wb.createSheet("TestSheet");
  Cell cell = sheet.createRow(0).createCell(0);
  Font underlineFont = wb.createFont();
  underlineFont.setUnderline(HSSFFont.U_DOUBLE);
  Font boldFont = wb.createFont();
  boldFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
  Font italicFont = wb.createFont();
  italicFont.setItalic(true);
  CellStyle style = wb.createCellStyle();
  style.setFont(underlineFont);
  cell.setCellStyle(style);
  RichTextString richString = new HSSFRichTextString("Underline, Bold, Italic");
  richString.applyFont(11, 15, boldFont);
  richString.applyFont(17, 23, italicFont);
  cell.setCellValue(richString);
}

代码示例来源:origin: Appendium/objectlabkit

private void addFontFormat(ExcelCell cell, CellStyle cellStyle) {
  if (bold || italic || underline || header || fontColour != null || strikeout) {
    Font f = cell.workbook().createFont();
    f.setBold(bold || header);
    if (underline) {
      f.setUnderline(Font.U_SINGLE);
    }
    if (fontColour != null) {
      f.setColor(fontColour.getIndex());
    }
    f.setItalic(italic);
    f.setStrikeout(strikeout);
    cellStyle.setFont(f);
  }
}

代码示例来源:origin: subtlelib/poi

@Override
public void enrich(WorkbookContext workbookContext, org.apache.poi.ss.usermodel.CellStyle style) {
  Font font = workbookContext.toNativeWorkbook().createFont();
  font.setFontName(workbookContext.getDefaultFontName());
  font.setFontHeightInPoints(height);
  font.setBold(boldWeight);
  font.setUnderline(underline);
  font.setItalic(italic);
  style.setFont(font);
  style.setAlignment(horizontalAlignment);
  style.setVerticalAlignment(verticalAlignment);
}

代码示例来源:origin: br.com.tecsinapse/tecsinapse-data-io

private void configFont(Font font) {
  font.setBold(isBold());
  font.setItalic(isItalic());
  font.setStrikeout(isStrikeout());
  font.setUnderline(isUnderline() ? Font.U_SINGLE : Font.U_NONE);
  if (getFontSize() != null) {
    font.setFontHeightInPoints(fontSize.shortValue());
  }
  if (getFontColor() != null) {
    if (font instanceof XSSFFont) {
      ((XSSFFont)font).setColor(new XSSFColor(toRgbByte(fontColor)));
    } else {
      font.setColor(fontColor.getIndex());
    }
  }
}

代码示例来源:origin: openl-tablets/openl-tablets

public static void setCellFont(Cell cell,
    boolean boldWeight, short color, short fontHeight, String name, boolean italic,
    boolean strikeout, short typeOffset, byte underline) {
  if (cell != null) {
    Workbook workbook = cell.getSheet().getWorkbook();
    Font font = workbook.findFont(
        boldWeight, color, fontHeight, name, italic, strikeout, typeOffset, underline);
    if (font == null) { // Create new font
      font = cell.getSheet().getWorkbook().createFont();
      font.setBold(boldWeight);
      font.setColor(color);
      font.setFontHeight(fontHeight);
      font.setFontName(name);
      font.setItalic(italic);
      font.setStrikeout(strikeout);
      font.setTypeOffset(typeOffset);
      font.setUnderline(underline);
    }
    CellUtil.setFont(cell, font);
  }
}

代码示例来源:origin: pentaho/pentaho-reporting

/**
 * Returns the excel font stored in this wrapper.
 *
 * @param wrapper
 *          the font wrapper that holds all font information from the repagination.
 * @return the created font.
 */
private Font createFont( final HSSFFontWrapper wrapper ) {
 final Font font = workbook.createFont();
 font.setBold( wrapper.isBold() );
 font.setColor( wrapper.getColorIndex() );
 font.setFontName( wrapper.getFontName() );
 font.setFontHeightInPoints( (short) wrapper.getFontHeight() );
 font.setItalic( wrapper.isItalic() );
 font.setStrikeout( wrapper.isStrikethrough() );
 if ( wrapper.isUnderline() ) {
  font.setUnderline( Font.U_SINGLE );
 } else {
  font.setUnderline( Font.U_NONE );
 }
 return font;
}

代码示例来源:origin: openl-tablets/openl-tablets

public static Font cloneFontFrom(Cell cell) {
  Font newFont = null;
  if (cell != null) {
    Workbook workbook = cell.getSheet().getWorkbook();
    newFont = workbook.createFont();
    int fontIndex = cell.getCellStyle().getFontIndexAsInt();
    Font fromFont = workbook.getFontAt(fontIndex);
    newFont.setBold(fromFont.getBold());
    newFont.setColor(fromFont.getColor());
    newFont.setFontHeight(fromFont.getFontHeight());
    newFont.setFontName(fromFont.getFontName());
    newFont.setItalic(fromFont.getItalic());
    newFont.setStrikeout(fromFont.getStrikeout());
    newFont.setTypeOffset(fromFont.getTypeOffset());
    newFont.setUnderline(fromFont.getUnderline());
    newFont.setCharSet(fromFont.getCharSet());
  }
  return newFont;
}

相关文章