本文整理匯總了Java中org.apache.poi.hssf.usermodel.HSSFFont.setFontHeightInPoints方法的典型用法代碼示例。如果您正苦於以下問題:Java HSSFFont.setFontHeightInPoints方法的具體用法?Java HSSFFont.setFontHeightInPoints怎麽用?Java HSSFFont.setFontHeightInPoints使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.poi.hssf.usermodel.HSSFFont
的用法示例。
在下文中一共展示了HSSFFont.setFontHeightInPoints方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createHSSFCellStyle
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private HSSFCellStyle createHSSFCellStyle(Workbook wb, int[] bgColor, int[] fontColor, int fontSize) {
HSSFWorkbook workbook = (HSSFWorkbook) wb;
HSSFPalette palette = workbook.getCustomPalette();
palette.setColorAtIndex((short) 9, (byte) fontColor[0], (byte) fontColor[1], (byte) fontColor[2]);
palette.setColorAtIndex((short) 10, (byte) bgColor[0], (byte) bgColor[1], (byte) bgColor[2]);
HSSFFont titleFont = workbook.createFont();
titleFont.setCharSet(HSSFFont.DEFAULT_CHARSET);
titleFont.setFontName("宋體");
titleFont.setColor((short) 9);
titleFont.setBold(true);
titleFont.setFontHeightInPoints((short) fontSize);
HSSFCellStyle titleStyle = (HSSFCellStyle) createBorderCellStyle(workbook, true);
titleStyle.setFont(titleFont);
titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
titleStyle.setFillForegroundColor((short) 10);
titleStyle.setAlignment(HorizontalAlignment.CENTER);
titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
return titleStyle;
}
示例2: writeCaption
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* @see org.displaytag.render.TableWriterTemplate#writeCaption(org.displaytag.model.TableModel)
*/
@Override
protected void writeCaption(TableModel model) throws Exception
{
HSSFCellStyle style = this.wb.createCellStyle();
HSSFFont bold = this.wb.createFont();
bold.setBoldweight(Font.BOLDWEIGHT_BOLD);
bold.setFontHeightInPoints((short) 14);
style.setFont(bold);
style.setAlignment(CellStyle.ALIGN_CENTER);
this.colNum = 0;
this.currentRow = this.sheet.createRow(this.sheetRowNum++);
this.currentCell = this.currentRow.createCell(this.colNum);
this.currentCell.setCellStyle(style);
String caption = model.getCaption();
this.currentCell.setCellValue(new HSSFRichTextString(caption));
this.rowSpanTable(model);
}
示例3: createCellStyleForColumnHeading
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
public static HSSFCellStyle createCellStyleForColumnHeading(HSSFWorkbook workBook) {
HSSFCellStyle cellStyle = workBook.createCellStyle();
HSSFFont fontObj = workBook.createFont();
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setWrapText(true);
cellStyle.setAlignment(HorizontalAlignment.CENTER);
cellStyle.setFillBackgroundColor(Short.valueOf("22").shortValue());
cellStyle.setFillPattern(FillPatternType.BIG_SPOTS);
cellStyle.setFillForegroundColor(Short.valueOf("22").shortValue());
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
fontObj.setFontName("Calibri");
fontObj.setFontHeightInPoints(Short.valueOf("12").shortValue());
fontObj.setBold(true);
fontObj.setColor(Short.valueOf("8").shortValue());
cellStyle.setFont(fontObj);
return cellStyle;
}
示例4: initStili
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* ereditare questo metodo per modificare gli stili utilizzati
*/
protected void initStili()
{
HSSFFont fontGrassetto = _workBook.createFont();
fontGrassetto.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
fontGrassetto.setFontHeightInPoints((short) 10);
HSSFFont fontTesto = _workBook.createFont();
fontTesto.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL );
fontTesto.setFontHeightInPoints((short) 10);
_styleIntestazioni = _workBook.createCellStyle();
_styleIntestazioni.setFont(fontGrassetto);
_styleIntestazioni.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
_styleIntestazioni.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
_styleIntestazioni.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
_styleIntestazioni.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
_styleIntestazioni.setAlignment(HSSFCellStyle.ALIGN_CENTER);
_styleIntestazioni.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
_styleTesto = _workBook.createCellStyle();
_styleTesto.setFont(fontTesto);
}
示例5: setHeaderStyle
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private void setHeaderStyle(HSSFWorkbook wb) {
HSSFCellStyle style = wb.createCellStyle();
HSSFFont font = wb.createFont();
font.setColor(HSSFColor.BLACK.index);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setFontHeightInPoints((short) 8);
style.setFont(font);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setWrapText(true);
headerStyle = style;
}
示例6: setVerticalHeaderStyle
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private void setVerticalHeaderStyle(HSSFWorkbook wb) {
verticalHeaderStyle = wb.createCellStyle();
HSSFFont font = wb.createFont();
font.setColor(HSSFColor.BLACK.index);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setFontHeightInPoints((short) 8);
verticalHeaderStyle.setFont(font);
verticalHeaderStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
verticalHeaderStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
verticalHeaderStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
verticalHeaderStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
verticalHeaderStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
verticalHeaderStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
verticalHeaderStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
verticalHeaderStyle.setRotation((short) 90);
}
示例7: setDoubleNegativeStyle
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private void setDoubleNegativeStyle(HSSFWorkbook wb) {
HSSFCellStyle style = wb.createCellStyle();
HSSFFont font = wb.createFont();
font.setColor(HSSFColor.BLACK.index);
font.setFontHeightInPoints((short) 8);
style.setFont(font);
style.setAlignment(HSSFCellStyle.ALIGN_RIGHT);
style.setDataFormat(wb.createDataFormat().getFormat("#,##0.00"));
font.setColor(HSSFColor.RED.index);
doubleNegativeStyle = style;
}
示例8: createCellStyleForComRepNotSetUp
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
public static HSSFCellStyle createCellStyleForComRepNotSetUp(HSSFWorkbook workBook) {
HSSFCellStyle cellStyle = workBook.createCellStyle();
HSSFFont fontObj = workBook.createFont();
cellStyle.setAlignment(HorizontalAlignment.CENTER);
fontObj.setFontName("Calibri");
fontObj.setFontHeightInPoints(Short.valueOf("12").shortValue());
fontObj.setBold(true);
fontObj.setColor((short) 10);
cellStyle.setFont(fontObj);
return cellStyle;
}
示例9: createCellStyleForComRepSetUp
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
public static HSSFCellStyle createCellStyleForComRepSetUp(HSSFWorkbook workBook) {
HSSFCellStyle cellStyle = workBook.createCellStyle();
HSSFFont fontObj = workBook.createFont();
cellStyle.setAlignment(HorizontalAlignment.CENTER);
fontObj.setFontName("Calibri");
fontObj.setFontHeightInPoints(Short.valueOf("12").shortValue());
fontObj.setBold(true);
fontObj.setColor((short) 17);
cellStyle.setFont(fontObj);
return cellStyle;
}
示例10: createTitleStyle
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private HSSFCellStyle createTitleStyle(HSSFWorkbook wb){
HSSFCellStyle style = wb.createCellStyle();
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setWrapText(true);
HSSFFont font = wb.createFont();
font.setFontHeightInPoints((short)20);
font.setFontName("����");
style.setFont(font);
return style;
}
示例11: generateHeaderStyle
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Description: 生成表格的 頭部的單元格樣式
* @param workbook
* @return
*
* @History
* 1. 2014-12-19 linwb 創建方法
*/
private HSSFCellStyle generateHeaderStyle(HSSFWorkbook workbook) {
//生成表格頭部標題欄樣式
HSSFCellStyle headerStyle = workbook.createCellStyle();
// 設置這些樣式
headerStyle.setFillForegroundColor(headerCellBackgroundColor);
headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
headerStyle.setBorderBottom(headerBorderBottom);
headerStyle.setBorderLeft(headerBorderLeft);
headerStyle.setBorderRight(headerBorderRight);
headerStyle.setBorderTop(headerBorderTop);
headerStyle.setAlignment(headerCellTextAlign);
headerStyle.setVerticalAlignment(headerCellVehicleAlign);
// 生成字體
HSSFFont font = workbook.createFont();
font.setColor(headerFontColor);
font.setFontHeightInPoints(headerFontHeight);
font.setBoldweight(headerFontWeight);
// 把字體應用到當前的樣式
headerStyle.setFont(font);
return headerStyle;
}
示例12: formatCell
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
protected void formatCell(HSSFWorkbook workbook, HSSFCell cell) {
HSSFFont hssfFont = workbook.createFont();
hssfFont.setFontName(Font.MONOSPACED);
hssfFont.setFontHeightInPoints((short) 9);
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFont(hssfFont);
cell.setCellStyle(cellStyle);
}
示例13: 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. ");
}
示例14: 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. ");
}
示例15: 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. ");
}