java hssffont_Java HSSFFont.setBoldweight方法代碼示例
本文整理匯總了Java中org.apache.poi.hssf.usermodel.HSSFFont.setBoldweight方法的典型用法代碼示例。如果您正苦於以下問題:Java HSSFFont.setBoldweight方法的具體用法?Java HSSFFont.setBoldweight怎麽用?Java HSSFFont.setBoldweight使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.poi.hssf.usermodel.HSSFFont的用法示例。
在下文中一共展示了HSSFFont.setBoldweight方法的37個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: createColumnHeaders
點讚 3
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
*/
protected void createColumnHeaders() {
final HSSFRow headersRow = this.sheet.createRow(0);
final HSSFFont font = this.workbook.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
final HSSFCellStyle style = this.workbook.createCellStyle();
style.setFont(font);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
int counter = 1;
for (int i = 0; i < this.model.getColumnCount(); i++) {
final HSSFCell cell = headersRow.createCell(counter++);
// cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(this.model.getColumnName(i));
cell.setCellStyle(style);
}
}
開發者ID:kiswanij,項目名稱:jk-util,代碼行數:18,
示例2: generateContStyle
點讚 3
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* @Description: 生成excel表格 單元格內容的樣式
* @param workbook
* @return
*
* @History
* 1. 2014-12-19 linwb 創建方法
*/
private HSSFCellStyle generateContStyle(HSSFWorkbook workbook) {
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFillForegroundColor(contCellBackgroundColor);
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
cellStyle.setBorderBottom(contBorderBottom);
cellStyle.setBorderLeft(contBorderLeft);
cellStyle.setBorderRight(contBorderRight);
cellStyle.setBorderTop(contBorderTop);
cellStyle.setAlignment(contCellTextAlign);
cellStyle.setVerticalAlignment(contCellVehicleAlign);
// 生成字體
HSSFFont font = workbook.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
// 把字體應用到當前的樣式
cellStyle.setFont(font);
return cellStyle;
}
開發者ID:webinglin,項目名稱:excelExportor,代碼行數:29,
示例3: estiloCabecalho
點讚 3
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Estilo de cabecalho.
* @param wb
* @return retorna o estilo da celula.
* @author Ekler Paulino de Mattos.
*/
private HSSFCellStyle estiloCabecalho(HSSFWorkbook wb){
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THICK);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_THICK);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THICK);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_THICK);
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
//cellStyle.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
cellStyle.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
HSSFFont font = cellStyle.getFont(wb);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setColor(HSSFFont.COLOR_NORMAL);
font.setFontName(HSSFFont.FONT_ARIAL);
cellStyle.setFont(font);
return cellStyle;
}
開發者ID:darciopacifico,項目名稱:omr,代碼行數:30,
示例4: estiloDadosConsultado
點讚 3
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Estilo dos campos dos dados.
* @param wb
* @return retorna o estilo da celula.
* @author Ekler Paulino de Mattos.
*/
private HSSFCellStyle estiloDadosConsultado(HSSFWorkbook wb){
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
// plano de fundo - para que funcione deve se
// definido antes um padrao de preenchimento.
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
//cellStyle.setFillForegroundColor(HSSFColor.AQUA.index);
cellStyle.setFillForegroundColor(HSSFColor.WHITE.index);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
HSSFFont font = cellStyle.getFont(wb);
font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
font.setColor(HSSFFont.COLOR_NORMAL);
font.setFontName(HSSFFont.FONT_ARIAL);
cellStyle.setFont(font);
return cellStyle;
}
開發者ID:darciopacifico,項目名稱:omr,代碼行數:32,
示例5: estiloDadosRetorno
點讚 3
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Estilo dos campos dos dados.
* @param wb
* @return retorna o estilo da celula.
* @author Ekler Paulino de Mattos.
*/
private HSSFCellStyle estiloDadosRetorno(HSSFWorkbook wb){
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
// plano de fundo - para que funcione deve se
// definido antes um padrao de preenchimento.
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
//cellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
cellStyle.setFillForegroundColor(HSSFColor.PALE_BLUE.index);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
HSSFFont font = cellStyle.getFont(wb);
font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
font.setColor(HSSFFont.COLOR_NORMAL);
font.setFontName(HSSFFont.FONT_ARIAL);
cellStyle.setFont(font);
return cellStyle;
}
開發者ID:darciopacifico,項目名稱:omr,代碼行數:32,
示例6: estiloCabecalho
點讚 3
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Estilo de cabecalho.
* @param wb
* @return retorna o estilo da celula.
* @author Ekler Paulino de Mattos.
*/
private HSSFCellStyle estiloCabecalho(HSSFWorkbook wb){
if(this.estiloCabecalho==null){
this.estiloCabecalho = wb.createCellStyle();
this.estiloCabecalho.setBorderBottom(HSSFCellStyle.BORDER_THIN);
this.estiloCabecalho.setBorderRight(HSSFCellStyle.BORDER_THIN);
this.estiloCabecalho.setBorderLeft(HSSFCellStyle.BORDER_THIN);
this.estiloCabecalho.setBorderTop(HSSFCellStyle.BORDER_THIN);
this.estiloCabecalho.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
//cellStyle.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
this.estiloCabecalho.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
this.estiloCabecalho.setAlignment(HSSFCellStyle.ALIGN_LEFT);
HSSFFont font = this.estiloCabecalho.getFont(wb);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setColor(HSSFFont.COLOR_NORMAL);
font.setFontName(HSSFFont.FONT_ARIAL);
this.estiloCabecalho.setFont(font);
}
return this.estiloCabecalho;
}
開發者ID:darciopacifico,項目名稱:omr,代碼行數:32,
示例7: writeCaption
點讚 3
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);
}
開發者ID:webbfontaine,項目名稱:displaytag,代碼行數:22,
示例8: initStili
點讚 3
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);
}
開發者ID:giasap0,項目名稱:konga,代碼行數:26,
示例9: setHeaderStyle
點讚 3
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;
}
開發者ID:FenixEdu,項目名稱:fenixedu-commons,代碼行數:19,
示例10: setVerticalHeaderStyle
點讚 3
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);
}
開發者ID:FenixEdu,項目名稱:fenixedu-commons,代碼行數:17,
示例11: createHeader
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private void createHeader(
HSSFWorkbook wb,
HSSFSheet sheet,
List informeCamps) {
HSSFFont bold;
bold = wb.createFont();
bold.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
bold.setColor(HSSFColor.WHITE.index);
HSSFCellStyle headerStyle;
headerStyle = wb.createCellStyle();
headerStyle.setFillPattern(HSSFCellStyle.FINE_DOTS);
headerStyle.setFillBackgroundColor(HSSFColor.GREY_80_PERCENT.index);
headerStyle.setFont(bold);
int rowNum = 0;
int colNum = 0;
// Capçalera
HSSFRow xlsRow = sheet.createRow(rowNum++);
HSSFCell cell;
cell = xlsRow.createCell(colNum++);
cell.setCellValue(new HSSFRichTextString(StringUtils.capitalize("Expedient")));
cell.setCellStyle(headerStyle);
for (TascaDadaDto camp : informeCamps) {
sheet.autoSizeColumn(colNum);
cell = xlsRow.createCell(colNum++);
cell.setCellValue(new HSSFRichTextString(StringUtils.capitalize(camp.getCampEtiqueta())));
cell.setCellStyle(headerStyle);
}
}
開發者ID:GovernIB,項目名稱:helium,代碼行數:29,
示例12: setBold
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private static void setBold(HSSFWorkbook workbook, HSSFCell cell) {
HSSFCellStyle boldStyle = workbook.createCellStyle();
HSSFFont boldFont = workbook.createFont();
boldFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
boldStyle.setFont(boldFont);
cell.setCellStyle(boldStyle);
}
開發者ID:innovad,項目名稱:4mila-1.0,代碼行數:8,
示例13: getFont
點讚 2
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;
}
開發者ID:metasfresh,項目名稱:metasfresh,代碼行數:29,
示例14: generateHeaderStyle
點讚 2
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;
}
開發者ID:webinglin,項目名稱:excelExportor,代碼行數:35,
示例15: estiloDadosConsultado
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Estilo dos campos dos dados.
* @param wb
* @return retorna o estilo da celula.
* @author Ekler Paulino de Mattos.
*/
private HSSFCellStyle estiloDadosConsultado(HSSFWorkbook wb){
if(this.estiloDadoConsultado==null){
this.estiloDadoConsultado = wb.createCellStyle();
this.estiloDadoConsultado.setBorderBottom(HSSFCellStyle.BORDER_THIN);
this.estiloDadoConsultado.setBorderRight(HSSFCellStyle.BORDER_THIN);
this.estiloDadoConsultado.setBorderLeft(HSSFCellStyle.BORDER_THIN);
this.estiloDadoConsultado.setBorderTop(HSSFCellStyle.BORDER_THIN);
// plano de fundo - para que funcione deve se
// definido antes um padrao de preenchimento.
this.estiloDadoConsultado.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
//cellStyle.setFillForegroundColor(HSSFColor.AQUA.index);
this.estiloDadoConsultado.setFillForegroundColor(HSSFColor.WHITE.index);
this.estiloDadoConsultado.setAlignment(HSSFCellStyle.ALIGN_LEFT);
HSSFFont font = this.estiloDadoConsultado.getFont(wb);
font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
font.setColor(HSSFFont.COLOR_NORMAL);
font.setFontName(HSSFFont.FONT_ARIAL);
this.estiloDadoConsultado.setFont(font);
}
return this.estiloDadoConsultado;
}
開發者ID:darciopacifico,項目名稱:omr,代碼行數:34,
示例16: estiloDadosRetorno
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Estilo dos campos dos dados.
* @param wb
* @return retorna o estilo da celula.
* @author Ekler Paulino de Mattos.
*/
private HSSFCellStyle estiloDadosRetorno(HSSFWorkbook wb){
if(this.cellStyle==null){
this.cellStyle = wb.createCellStyle();
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
// plano de fundo - para que funcione deve se
// definido antes um padrao de preenchimento.
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
//cellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
cellStyle.setFillForegroundColor(HSSFColor.PALE_BLUE.index);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
HSSFFont font = cellStyle.getFont(wb);
font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
font.setColor(HSSFFont.COLOR_NORMAL);
font.setFontName(HSSFFont.FONT_ARIAL);
cellStyle.setFont(font);
}
return this.cellStyle;
}
開發者ID:darciopacifico,項目名稱:omr,代碼行數:33,
示例17: getCellStyle
點讚 2
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;
}
開發者ID:mpgerstl,項目名稱:tEFMA,代碼行數:9,
示例18: setHeaderStyle
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Sets header style
* @param worksheet the worksheet
* @param fontName font name
* @param fontColor font color
* @param fontBoldweight font weight
*/
public static void setHeaderStyle(Worksheet worksheet, String fontName,
short fontColor, short fontBoldweight) {
HSSFWorkbook workbook = worksheet.getWorkbook();
HSSFFont font = workbook.createFont();
font.setFontName(fontName);
font.setColor(fontColor);
font.setBoldweight(fontBoldweight);
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFont(font);
worksheet.setCellStyle(cellStyle);
}
開發者ID:Impetus,項目名稱:jumbune,代碼行數:19,
示例19: WorkbookWriter
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
public WorkbookWriter(String sheetName, String[] titles) {
workbook = new HSSFWorkbook();
sheet = workbook.createSheet(sheetName);
HSSFFont font = workbook.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
CellStyle titleStyle = workbook.createCellStyle();
titleStyle.setFont(font);
addRow(titles, titleStyle);
}
開發者ID:mhinters,項目名稱:BannedBookUtils,代碼行數:11,
示例20: postProcessXLS
點讚 2
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. ");
}
開發者ID:sudheerj,項目名稱:primefaces-blueprints,代碼行數:39,
示例21: postProcessXLS
點讚 2
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. ");
}
開發者ID:sudheerj,項目名稱:primefaces-blueprints,代碼行數:36,
示例22: postProcessXLS
點讚 2
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. ");
}
開發者ID:sudheerj,項目名稱:primefaces-blueprints,代碼行數:41,
示例23: getHeaderFooterStyle
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Obtain the style used to render a header or footer.
* @return The style used to render a header or footer.
*/
private HSSFCellStyle getHeaderFooterStyle()
{
HSSFCellStyle style = this.wb.createCellStyle();
// style.setFillPattern(HSSFCellStyle.FINE_DOTS);
// style.setFillBackgroundColor(HSSFColor.BLUE_GREY.index);
HSSFFont bold = this.wb.createFont();
bold.setBoldweight(Font.BOLDWEIGHT_BOLD);
// bold.setColor(HSSFColor.WHITE.index);
style.setBorderBottom(CellStyle.BORDER_THIN);
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
style.setFont(bold);
return style;
}
開發者ID:webbfontaine,項目名稱:displaytag,代碼行數:19,
示例24: createHeaderStyle
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Templated method that is called for all header cells.
* @param wb
* @param headerCell
* @return
*/
public HSSFCellStyle createHeaderStyle(HSSFWorkbook wb, HeaderCell headerCell)
{
HSSFCellStyle headerStyle = getNewCellStyle();
headerStyle.setFillPattern(CellStyle.FINE_DOTS);
headerStyle.setFillBackgroundColor(HSSFColor.BLUE_GREY.index);
HSSFFont bold = wb.createFont();
bold.setBoldweight(Font.BOLDWEIGHT_BOLD);
bold.setColor(HSSFColor.WHITE.index);
headerStyle.setFont(bold);
return headerStyle;
}
開發者ID:webbfontaine,項目名稱:displaytag,代碼行數:20,
示例25: getHeadlineCellStyle
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
protected HSSFCellStyle getHeadlineCellStyle(final HSSFSheet sheet) {
HSSFWorkbook workbook = sheet.getWorkbook();
HSSFCellStyle headlineCellStyle = workbook.createCellStyle();
HSSFFont font = workbook.createFont();
font.setColor(HSSFFont.COLOR_NORMAL);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
headlineCellStyle.setFont(font);
return headlineCellStyle;
}
開發者ID:Clemens85,項目名稱:runningdinner,代碼行數:10,
示例26: outputSummarySheet
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Output advance sample summary report, representing,
* bodyAdvancedSampleSearchResult.jsp
*
* @param searchBean
* @param wb
*/
private static void outputSummarySheet(AdvancedSampleSearchBean searchBean,
List sampleBeans, String viewSampleUrl,
HSSFWorkbook wb) throws IOException {
HSSFFont headerFont = wb.createFont();
headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
HSSFCellStyle headerStyle = wb.createCellStyle();
headerStyle.setFont(headerFont);
HSSFCellStyle hlinkStyle = wb.createCellStyle();
HSSFFont hlinkFont = wb.createFont();
hlinkFont.setUnderline(HSSFFont.U_SINGLE);
hlinkFont.setColor(HSSFColor.BLUE.index);
hlinkStyle.setFont(hlinkFont);
int rowIndex = 0;
HSSFSheet sheet = wb.createSheet("Advanced Sample Search Report");
// 1.Output Search Criteria. comment out as per Sharon.
// rowIndex = outputCriteria(searchBean, sheet, headerStyle, rowIndex);
// 2.Output table column headers.
rowIndex = outputHeader(sampleBeans.get(0), sheet, headerStyle,
rowIndex);
// 3.Output each table row.
for (AdvancedSampleBean sampleBean : sampleBeans) {
rowIndex = outputRow(sampleBean, viewSampleUrl, sheet, hlinkStyle,
rowIndex);
}
}
開發者ID:NCIP,項目名稱:cananolab,代碼行數:38,
示例27: outputSummarySheet
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Output sample Composition Summary report =>
* bodyCompositionSummaryView.jsp
*
* @param compBean
* @param wb
*/
private static void outputSummarySheet(CompositionBean compBean,
String downloadURL, HSSFWorkbook wb) throws IOException {
HSSFFont headerFont = wb.createFont();
headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
HSSFCellStyle headerStyle = wb.createCellStyle();
headerStyle.setFont(headerFont);
HSSFCellStyle hlinkStyle = wb.createCellStyle();
HSSFFont hlinkFont = wb.createFont();
hlinkFont.setUnderline(HSSFFont.U_SINGLE);
hlinkFont.setColor(HSSFColor.BLUE.index);
hlinkStyle.setFont(hlinkFont);
int entityCount = 1;
entityCount = outputNanomaterialEntities(compBean, wb, headerStyle,
hlinkStyle, entityCount, downloadURL);
entityCount = outputFunctionalEntities(compBean, wb, headerStyle,
hlinkStyle, entityCount, downloadURL);
entityCount = outputChemicalEntities(compBean, wb, headerStyle,
hlinkStyle, entityCount, downloadURL);
outputFilesEntities(compBean, wb, headerStyle, hlinkStyle, entityCount,
downloadURL);
}
開發者ID:NCIP,項目名稱:cananolab,代碼行數:34,
示例28: setTitleStyle
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private void setTitleStyle(HSSFWorkbook wb) {
HSSFCellStyle style = wb.createCellStyle();
HSSFFont font = wb.createFont();
font.setColor(HSSFColor.BLACK.index);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setFontHeightInPoints((short) 10);
style.setFont(font);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
titleStyle = style;
}
開發者ID:FenixEdu,項目名稱:fenixedu-commons,代碼行數:11,
示例29: setLabelStyle
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private void setLabelStyle(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_LEFT);
labelStyle = style;
}
開發者ID:FenixEdu,項目名稱:fenixedu-commons,代碼行數:11,
示例30: initializeComponents
點讚 2
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);
}
開發者ID:jwiesel,項目名稱:sfdcCommander,代碼行數:52,
示例31: exportExcel
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
public InputStream exportExcel(String fileName, String[] headTitle,
List list) throws IOException {
Workbook wb = new HSSFWorkbook();
//FileOutputStream fileOut = new FileOutputStream(fileName);
HSSFCellStyle style = (HSSFCellStyle) wb.createCellStyle();
// 設置這些樣式
style.setFillForegroundColor(HSSFColor.SKY_BLUE.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 生成一個字體
HSSFFont font = (HSSFFont) wb.createFont();
font.setColor(HSSFColor.VIOLET.index);
font.setFontHeightInPoints((short) 12);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
// 把字體應用到當前的樣式
style.setFont(font);
// 創建工作簿
Sheet sheet = wb.createSheet("sheet1");
// sheet.setDefaultColumnWidth((short)15);
// 創建頭部
Row row = sheet.createRow((short) 0);
for (int i = 0; i < headTitle.length; i++) {
row.createCell(i).setCellValue(headTitle[i]);
}
// 填充數據
for (int i = 0; i < list.size(); i++) {
Row r = sheet.createRow((short) (i + 1));
String[] strArray = list.get(i).split(",");
for (int j = 0; j < headTitle.length; j++) {
r.createCell(j).setCellValue(strArray[j]);
if (strArray[j].length()>3) {
sheet.setColumnWidth((short)j, 5000);
}
}
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
wb.write(baos);
} catch (IOException e) {
e.printStackTrace();
}
byte[] ba = baos.toByteArray();
ByteArrayInputStream excelStream = new ByteArrayInputStream(ba);
return excelStream;
}
開發者ID:dreajay,項目名稱:hrms,代碼行數:57,
示例32: postProcessXls
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
public void postProcessXls( Object document )
{
logger.trace( "postProcessXls start document " + document );
if ( document != null )
{
HSSFWorkbook workBook = ( HSSFWorkbook ) document;
HSSFSheet sheet = workBook.getSheetAt( 0 );
HSSFRow headerRow = sheet.getRow( 0 );
for ( int i = 0; i < headerRow.getPhysicalNumberOfCells(); i++ )
{
sheet.setColumnWidth( i, 30 * 265 ); // width for 40 characters
}
sheet.shiftRows( 0, sheet.getLastRowNum(), 5 ); // shift rows 0 to n
// by 1 to get space
// for header
sheet.addMergedRegion( CellRangeAddress.valueOf( "A1:F3" ) );
HSSFFont headerFont = workBook.createFont();
headerFont.setBoldweight( HSSFFont.BOLDWEIGHT_BOLD );
HSSFCellStyle headerCellStyle = workBook.createCellStyle();
headerCellStyle.setFillForegroundColor( HSSFColor.LIGHT_CORNFLOWER_BLUE.index );
headerCellStyle.setFillPattern( HSSFCellStyle.SOLID_FOREGROUND );
headerCellStyle.setFont( headerFont );
headerCellStyle.setAlignment( HSSFCellStyle.ALIGN_CENTER );
headerCellStyle.setVerticalAlignment( HSSFCellStyle.VERTICAL_CENTER );
HSSFCell headerCell = headerRow.createCell( 0 );
headerCell.setCellStyle( headerCellStyle );
headerCell.setCellValue( "CATS Uptime and Reboot Status : " + ( new Date() ) );
HSSFCellStyle metaDataCellStyle = workBook.createCellStyle();
metaDataCellStyle.setFont( headerFont );
HSSFRow metaDataRow = sheet.getRow( 3 );
if ( metaDataRow == null )
{
metaDataRow = sheet.createRow( 3 );
}
HSSFCell metaDataKey = metaDataRow.createCell( 0 );
metaDataKey.setCellStyle( metaDataCellStyle );
metaDataKey.setCellValue( "CATS Instance" );
HSSFCell metaDataValue = metaDataRow.createCell( 1 );
metaDataValue.setCellStyle( metaDataCellStyle );
metaDataValue.setCellValue( AuthController.getHostAddress() );
HSSFCellStyle datatTableHeaderCellStyle = workBook.createCellStyle();
datatTableHeaderCellStyle.setFillForegroundColor( HSSFColor.LIGHT_YELLOW.index );
datatTableHeaderCellStyle.setFillPattern( HSSFCellStyle.SOLID_FOREGROUND );
datatTableHeaderCellStyle.setFont( headerFont );
HSSFRow actualDataTableHeaderRow = sheet.getRow( 5 );
for ( int i = 0; i < actualDataTableHeaderRow.getPhysicalNumberOfCells(); i++ )
{
HSSFCell cell = actualDataTableHeaderRow.getCell( i );
if ( cell != null )
{
String cellValue = cell.getStringCellValue();
cellValue = cellValue.replace( "
", "" ); // replace
// any line
// breaks
cell.setCellValue( cellValue );
cell.setCellStyle( datatTableHeaderCellStyle );
}
}
}
logger.trace( "postProcessXls end" );
}
開發者ID:Comcast,項目名稱:cats,代碼行數:74,
示例33: apply
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
public void apply(HSSFCell cell, HSSFCellStyle cellStyle, Map 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);
}
}
開發者ID:chyxion,項目名稱:table-to-xls,代碼行數:47,
示例34: exportSummarySheet
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Output Excel report for sample publication summary report.
*
* @param summaryBean
* @param wb
*/
private static void exportSummarySheet(
PublicationSummaryViewBean summaryBean, HSSFWorkbook wb) {
HSSFRow row = null;
HSSFFont headerFont = wb.createFont();
headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
HSSFCellStyle headerStyle = wb.createCellStyle();
headerStyle.setFont(headerFont);
Set categories = summaryBean.getPublicationCategories();
if (categories != null && !categories.isEmpty()) {
for (String category : categories) {
int rowIndex = 0;
// Create one work sheet for each category.
HSSFSheet sheet = wb.createSheet(category);
row = sheet.createRow(rowIndex++);
// Output header of report
ExportUtils.createCell(row, 0, headerStyle, BIBLIOBRAPHY_INFO);
ExportUtils.createCell(row, 1, headerStyle, RESEARCH_CATEGORY);
ExportUtils.createCell(row, 2, headerStyle, DESCRIPTION);
ExportUtils.createCell(row, 3, headerStyle, PUB_STATUS);
// Output data of report
SortedMap> pubs = summaryBean
.getCategory2Publications();
if (pubs != null && !pubs.isEmpty()) {
List pubBeans = pubs.get(category);
if (pubBeans != null && !pubBeans.isEmpty()) {
for (PublicationBean pubBean : pubBeans) {
Publication pub = (Publication) pubBean
.getDomainFile();
row = sheet.createRow(rowIndex++);
// Bibliography Info: cell index = 0.
ExportUtils.createCell(row, 0,
getBibliographyInfo(pubBean));
// Research Category: cell index = 1.
ExportUtils.createCell(row, 1, pub
.getResearchArea());
// Description: cell index = 2.
if (!StringUtils.isEmpty(pub.getDescription())) {
ExportUtils.createCell(row, 2, pub
.getDescription());
}
// Publication Status: cell index = 3.
ExportUtils.createCell(row, 3, pub.getStatus());
}
}
}
}
}
}
開發者ID:NCIP,項目名稱:cananolab,代碼行數:63,
示例35: outputSummarySheet
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
* Output Sample Characterization Summary report (==>
* bodyCharacterizationSummaryPrintViewTable.jsp)
*
* @param summaryBean
* @param wb
* @throws IOException
*/
private static void outputSummarySheet(List charTypes,
CharacterizationSummaryViewBean summaryBean, String downloadURL,
HSSFWorkbook wb) throws IOException {
HSSFFont headerFont = wb.createFont();
headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
HSSFCellStyle headerStyle = wb.createCellStyle();
headerStyle.setFont(headerFont);
HSSFCellStyle hlinkStyle = wb.createCellStyle();
HSSFFont hlinkFont = wb.createFont();
hlinkFont.setUnderline(HSSFFont.U_SINGLE);
hlinkFont.setColor(HSSFColor.BLUE.index);
hlinkStyle.setFont(hlinkFont);
int charCount = 1;
Map> charBeanMap = summaryBean
.getType2Characterizations();
for (String type : charTypes) {
// Output data of report
SortedSet charBeans = charBeanMap.get(type);
if (charBeans != null && !charBeans.isEmpty()) {
for (CharacterizationBean charBean : charBeans) {
int rowIndex = 0;
// Create one work sheet for each Characterization.
HSSFSheet sheet = wb.createSheet(charCount++ + "."
+ charBean.getCharacterizationName());
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
// 1. Output Characterization type at (0, 0).
rowIndex = outputHeader(charBean, sheet, headerStyle,
rowIndex);
// 2. Output Assay Type (2, 0).
rowIndex = outputAssayType(charBean, sheet, headerStyle,
rowIndex);
// 3. Output POC at (3, 0).
rowIndex = outputPOC(charBean, sheet, headerStyle, rowIndex);
// 4. Output Characterization Date at (4, 0).
rowIndex = outputCharDate(charBean, sheet, headerStyle,
rowIndex);
// 5. Output Protocol at (5, 0).
rowIndex = outputProtocol(charBean, sheet, headerStyle,
rowIndex);
// 6. Output Properties at (6, 0).
rowIndex = outputProperties(charBean, sheet, headerStyle,
rowIndex);
// 7. Output Design Description at (7, 0).
rowIndex = outputDesignDescription(charBean, sheet,
headerStyle, rowIndex);
// 8. Output Technique and Instruments at (8, 0).
rowIndex = outputTechInstruments(charBean, sheet,
headerStyle, rowIndex);
// 9. Output Characterization Results at (9, 0).
rowIndex = outputCharResults(charBean, downloadURL, wb,
sheet, headerStyle, hlinkStyle, patriarch, rowIndex);
// 10.Output Analysis and Conclusion at (10, 0).
rowIndex = outputConclusion(charBean, sheet, headerStyle,
rowIndex);
}
}
}
}
開發者ID:NCIP,項目名稱:cananolab,代碼行數:71,
示例36: appendToStyle
點讚 2
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
@Override
protected void appendToStyle(HSSFWorkbook book, HSSFCellStyle style, HSSFFont font) {
font.setBoldweight(boldweight);
}
開發者ID:FenixEdu,項目名稱:fenixedu-commons,代碼行數:5,
示例37: buildHeader
點讚 1
import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private void buildHeader(HSSFWorkbook workbook, HSSFSheet sheet, HSSFCellStyle style, HSSFCellStyle style2,HSSFPatriarch patriarch,String title,String[] headers){
// 設置這些樣式
style.setFillForegroundColor(HSSFColor.SKY_BLUE.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 生成一個字體
HSSFFont font = workbook.createFont();
font.setColor(HSSFColor.VIOLET.index);
font.setFontHeightInPoints((short) 12);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
// 把字體應用到當前的樣式
style.setFont(font);
// 生成並設置另一個樣式
style2 = workbook.createCellStyle();
style2.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
style2.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style2.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style2.setBorderRight(HSSFCellStyle.BORDER_THIN);
style2.setBorderTop(HSSFCellStyle.BORDER_THIN);
style2.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style2.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
// 生成另一個字體
HSSFFont font2 = workbook.createFont();
font2.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
// 把字體應用到當前的樣式
style2.setFont(font2);
// 定義注釋的大小和位置,詳見文檔
HSSFComment comment = patriarch.createComment(new HSSFClientAnchor(0,
0, 0, 0, (short) 4, 2, (short) 6, 5));
// 設置注釋內容
comment.setString(new HSSFRichTextString("可以在POI中添加注釋!"));
// 設置注釋作者,當鼠標移動到單元格上是可以在狀態欄中看到該內容.
comment.setAuthor("leno");
// 產生表格標題行
HSSFRow row = sheet.createRow(0);
for (short i = 0; i < headers.length; i++) {
HSSFCell cell = row.createCell(i);
cell.setCellStyle(style);
HSSFRichTextString text = new HSSFRichTextString(headers[i]);
cell.setCellValue(headers[i]);
}
}
開發者ID:zhanggh,項目名稱:mtools,代碼行數:52,
注:本文中的org.apache.poi.hssf.usermodel.HSSFFont.setBoldweight方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。