本文整理汇总了Java中org.apache.poi.hssf.usermodel.HSSFFont.setItalic方法的典型用法代码示例。如果您正苦于以下问题:Java HSSFFont.setItalic方法的具体用法?Java HSSFFont.setItalic怎么用?Java HSSFFont.setItalic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.hssf.usermodel.HSSFFont
的用法示例。
在下文中一共展示了HSSFFont.setItalic方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFont
import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
private HSSFFont getFont(final boolean isHeader)
{
HSSFFont font = null;
if (isHeader)
{
if (m_fontHeader == null)
{
m_fontHeader = m_workbook.createFont();
m_fontHeader.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
}
font = m_fontHeader;
}
else if (isFunctionRow())
{
font = m_workbook.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setItalic(true);
}
else
{
if (m_fontDefault == null)
{
m_fontDefault = m_workbook.createFont();
}
font = m_fontDefault;
}
return font;
}
示例2: getCellStyle
import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
protected HSSFCellStyle getCellStyle(short boldweight, boolean italic) {
final HSSFCellStyle style = workbook.createCellStyle();
final HSSFFont font = workbook.createFont();
font.setBoldweight(boldweight);
font.setItalic(italic);
style.setFont(font);
return style;
}
示例3: postProcessXLS
import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
public void postProcessXLS(Object document) {
HSSFWorkbook wb = (HSSFWorkbook) document;
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow header = sheet.getRow(0);
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(HSSFColor.GREEN.index);
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
for(int i=0; i < header.getPhysicalNumberOfCells();i++) {
HSSFCell cell = header.getCell(i);
cell.setCellStyle(cellStyle);
}
Row row=sheet.createRow((short)sheet.getLastRowNum()+3);
Cell cellDisclaimer = row.createCell(0);
HSSFFont customFont= wb.createFont();
customFont.setFontHeightInPoints((short)10);
customFont.setFontName("Arial");
customFont.setColor(IndexedColors.BLACK.getIndex());
customFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
customFont.setItalic(true);
cellDisclaimer.setCellValue("Disclaimer");
HSSFCellStyle cellStyleDisclaimer = wb.createCellStyle();
cellStyleDisclaimer.setFont(customFont);
cellDisclaimer.setCellStyle(cellStyleDisclaimer);
Row row1=sheet.createRow(sheet.getLastRowNum()+2);
Cell cellDisclaimerContent1 = row1.createCell(0);
cellDisclaimerContent1.setCellValue("The information contained in this website is for information purposes only, and does not constitute, nor is it intended to constitute, the provision of financial product advice.");
Row row2=sheet.createRow(sheet.getLastRowNum()+1);
Cell cellDisclaimerContent2 = row2.createCell(0);
cellDisclaimerContent2.setCellValue("This website is intended to track the investor account summary information,investments and transaction in a partcular period of time. ");
}
示例4: postProcessXLS
import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
public void postProcessXLS(Object document) {
HSSFWorkbook wb = (HSSFWorkbook) document;
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow header = sheet.getRow(0);
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(HSSFColor.GREEN.index);
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
for(int i=0; i < header.getPhysicalNumberOfCells();i++) {
HSSFCell cell = header.getCell(i);
cell.setCellStyle(cellStyle);
}
Row row=sheet.createRow((short)sheet.getLastRowNum()+3);
Cell cellDisclaimer = row.createCell(0);
HSSFFont customFont= wb.createFont();
customFont.setFontHeightInPoints((short)10);
customFont.setFontName("Arial");
customFont.setColor(IndexedColors.BLACK.getIndex());
customFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
customFont.setItalic(true);
cellDisclaimer.setCellValue("Disclaimer");
HSSFCellStyle cellStyleDisclaimer = wb.createCellStyle();
cellStyleDisclaimer.setFont(customFont);
cellDisclaimer.setCellStyle(cellStyleDisclaimer);
Row row1=sheet.createRow(sheet.getLastRowNum()+2);
Cell cellDisclaimerContent1 = row1.createCell(0);
cellDisclaimerContent1.setCellValue("The information contained in this website is for information purposes only, and does not constitute, nor is it intended to constitute, the provision of financial product advice.");
Row row2=sheet.createRow(sheet.getLastRowNum()+1);
Cell cellDisclaimerContent2 = row2.createCell(0);
cellDisclaimerContent2.setCellValue("This website is intended to track the investor account summary information,investments and transaction in a partcular period of time. ");
}
示例5: postProcessXLS
import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
public void postProcessXLS(Object document) {
HSSFWorkbook wb = (HSSFWorkbook) document;
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow header = sheet.getRow(0);
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(HSSFColor.GREEN.index);
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
for (int i = 0; i < header.getPhysicalNumberOfCells(); i++) {
HSSFCell cell = header.getCell(i);
cell.setCellStyle(cellStyle);
}
Row row = sheet.createRow((short) sheet.getLastRowNum() + 3);
Cell cellDisclaimer = row.createCell(0);
HSSFFont customFont = wb.createFont();
customFont.setFontHeightInPoints((short) 10);
customFont.setFontName("Arial");
customFont.setColor(IndexedColors.BLACK.getIndex());
customFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
customFont.setItalic(true);
cellDisclaimer.setCellValue("Disclaimer");
HSSFCellStyle cellStyleDisclaimer = wb.createCellStyle();
cellStyleDisclaimer.setFont(customFont);
cellDisclaimer.setCellStyle(cellStyleDisclaimer);
Row row1 = sheet.createRow(sheet.getLastRowNum() + 2);
Cell cellDisclaimerContent1 = row1.createCell(0);
cellDisclaimerContent1
.setCellValue("The information contained in this website is for information purposes only, and does not constitute, nor is it intended to constitute, the provision of financial product advice.");
Row row2 = sheet.createRow(sheet.getLastRowNum() + 1);
Cell cellDisclaimerContent2 = row2.createCell(0);
cellDisclaimerContent2
.setCellValue("This website is intended to track the investor account summary information,investments and transaction in a partcular period of time. ");
}
示例6: initializeComponents
import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
/**
* Initialize components.
*/
public final void initializeComponents() {
HSSFFont fontHeading1;
HSSFFont fontHeading2;
HSSFFont fontHeading3;
HSSFFont greenFont;
HSSFFont yellowFont;
heading1Cs = wb.createCellStyle();
heading2Cs = wb.createCellStyle();
heading3Cs = wb.createCellStyle();
equalCs = wb.createCellStyle();
notEqualCs = wb.createCellStyle();
greenCs = wb.createCellStyle();
yellowCs = wb.createCellStyle();
fontHeading1 = wb.createFont();
fontHeading2 = wb.createFont();
fontHeading3 = wb.createFont();
greenFont = wb.createFont();
yellowFont = wb.createFont();
fontHeading1.setFontHeightInPoints(H1_SIZE);
fontHeading1.setItalic(true);
fontHeading1.setBoldweight(Font.BOLDWEIGHT_BOLD);
fontHeading1.setColor(IndexedColors.DARK_BLUE.getIndex());
heading1Cs.setFont(fontHeading1);
fontHeading2.setFontHeightInPoints(H2_SIZE);
fontHeading2.setItalic(true);
heading2Cs.setFont(fontHeading2);
fontHeading3.setFontHeightInPoints(H3_SIZE);
fontHeading3.setBoldweight(Font.BOLDWEIGHT_BOLD);
heading3Cs.setFont(fontHeading3);
heading3Cs.setBorderBottom((short) 1);
equalCs.setFillForegroundColor(IndexedColors.GREEN.getIndex());
equalCs.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
notEqualCs.setFillForegroundColor(IndexedColors.RED.getIndex());
notEqualCs.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
greenFont.setColor(IndexedColors.GREEN.getIndex());
greenCs.setFont(greenFont);
yellowFont.setColor(IndexedColors.DARK_YELLOW.getIndex());
yellowCs.setFont(yellowFont);
}
示例7: apply
import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void apply(HSSFCell cell, HSSFCellStyle cellStyle, Map<String, String> style) {
HSSFWorkbook workBook = cell.getSheet().getWorkbook();
HSSFFont font = null;
if (ITALIC.equals(style.get(FONT_STYLE))) {
font = getFont(cell, font);
font.setItalic(true);
}
int fontSize = CssUtils.getInt(style.get(FONT_SIZE));
if (fontSize > 0) {
font = getFont(cell, font);
font.setFontHeightInPoints((short) fontSize);
}
if (BOLD.equals(style.get(FONT_WEIGHT))) {
font = getFont(cell, font);
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
}
String fontFamily = style.get(FONT_FAMILY);
if (StringUtils.isNotBlank(fontFamily)) {
font = getFont(cell, font);
font.setFontName(fontFamily);
}
HSSFColor color = CssUtils.parseColor(workBook, style.get(COLOR));
if (color != null) {
if (color.getIndex() != BLACK.index) {
font = getFont(cell, font);
font.setColor(color.getIndex());
}
else {
log.info("Text Color [{}] Is Black Or Fimiliar To Black, Ignore.",
style.remove(COLOR));
}
}
// text-decoration
String textDecoration = style.get(TEXT_DECORATION);
if (UNDERLINE.equals(textDecoration)) {
font = getFont(cell, font);
font.setUnderline(Font.U_SINGLE);
}
if (font != null) {
cellStyle.setFont(font);
}
}