本文整理了Java中org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle()
方法的一些代码示例,展示了HSSFWorkbook.createCellStyle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFWorkbook.createCellStyle()
方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFWorkbook
类名称:HSSFWorkbook
方法名:createCellStyle
[英]Create a new Cell style and add it to the workbook's style table. You can define up to 4000 unique styles in a .xls workbook.
[中]创建新的单元格样式并将其添加到工作簿的样式表中。您最多可以在一个文档中定义4000个独特样式。xls工作簿。
代码示例来源:origin: stackoverflow.com
HSSFWorkbook workbook=new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("FirstSheet");
HSSFRow rowhead= sheet.createRow((short)0);
HSSFCellStyle style = workbook.createCellStyle();
style.setWrapText(true);
row.setRowStyle(style);
row.getCell(0).setCellStyle(style);
代码示例来源:origin: rakam-io/rakam
boldFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
HSSFCellStyle headerSyle = workbook.createCellStyle();
headerSyle.setBorderBottom(CellStyle.BORDER_THIN);
headerSyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
代码示例来源:origin: stackoverflow.com
HSSFCellStyle style = wb.createCellStyle();
style.setFillForegroundColor(HSSFColor.LIME.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
代码示例来源:origin: cuba-platform/yarg
public static HSSFCellStyle adoptDetachedCellStyle(HSSFWorkbook workbook, HSSFCellStyle detachedCellStyle) {
HSSFCellStyle cellStyle = workbook.createCellStyle();
XslStyleHelper.cloneStyleRelations(detachedCellStyle, cellStyle);
return cellStyle;
}
}
代码示例来源:origin: paypal/SeLion
private static HSSFCellStyle createCustomStyle(HSSFFont fontStyle, Short... alignment) {
HSSFCellStyle style = wb1.createCellStyle();
style.setFont(fontStyle);
if (alignment.length > 0) {
style.setAlignment(alignment[0]);
}
return style;
}
代码示例来源:origin: com.github.hazendaz/displaytag
/**
* Gets the new cell style.
*
* @return the new cell style
*/
public HSSFCellStyle getNewCellStyle()
{
return getWb() == null ? null : getWb().createCellStyle();
}
代码示例来源:origin: com.github.hazendaz/displaytag
/**
* Gets the new cell style.
*
* @return the new cell style
*/
public HSSFCellStyle getNewCellStyle()
{
return getWb() == null ? null : getWb().createCellStyle();
}
代码示例来源:origin: stackoverflow.com
HSSFWorkbook wb = ...;
DataFormat format = wb.createDataFormat();
HSSFCellStyle cellStyle = wb.createCellStyle();
style.setDataFormat(format.getFormat("@")); // or "text"
cell.setCellStyle(cellStyle);
代码示例来源:origin: stackoverflow.com
HSSFWorkbook wb = new HSSFWorkbook();
HSSFRow row = wb.createSheet().createRow(0);
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setDataFormat(wb.getCreationHelper().createDataFormat().getFormat("HH:mm:ss"));
HSSFCell cell = row.createCell(1);
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 1970);
cal.set(Calendar.MONTH, 0);
cal.set(Calendar.DATE, 1);
//you can set the time you need here ...
cell.setCellValue(cal);
cell.setCellStyle(cellStyle);
代码示例来源:origin: stackoverflow.com
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Test");
Row row = sheet.createRow(0);
CellStyle style = wb.createCellStyle();
style.setLocked(true);
cell = row.createCell(0);
cell.setCellStyle(style);
// this is important as locking is pnly activated if sheet is protected
sheet.protectSheet("");
代码示例来源:origin: com.haulmont.charts/charts-web
protected void createCellStyle() {
HSSFFont boldFont = wb.createFont();
boldFont.setBold(true);
boldStyle = wb.createCellStyle();
boldStyle.setFont(boldFont);
}
代码示例来源:origin: TomasKypta/android-lang-tool
private static HSSFCellStyle createTextStyle(HSSFWorkbook wb) {
HSSFFont plain = wb.createFont();
plain.setFontHeightInPoints((short)12);
HSSFCellStyle textStyle = wb.createCellStyle();
textStyle.setFont(plain);
return textStyle;
}
代码示例来源:origin: jasperreports/jasperreports
protected void openWorkbook(OutputStream os)
{
workbook = new HSSFWorkbook();
emptyCellStyle = workbook.createCellStyle();
emptyCellStyle.setFillForegroundColor((new HSSFColor.WHITE()).getIndex());
emptyCellStyle.setFillPattern(backgroundMode);
dataFormat = workbook.createDataFormat();
}
代码示例来源:origin: qcadoo/mes
private HSSFCellStyle createStyle(final HSSFWorkbook workbook, boolean isFirst, short align) {
HSSFCellStyle style = workbook.createCellStyle();
if (isFirst) {
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
}
if (align == RIGHT) {
style.setAlignment(RIGHT);
style.setDataFormat(dataFormat.getFormat("[HH]:MM:SS"));
}
return style;
}
代码示例来源:origin: qcadoo/mes
public static HSSFCellStyle rowStyle2(final HSSFSheet sheet) {
HSSFCellStyle style = sheet.getWorkbook().createCellStyle();
style.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
style.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
style.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
style.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
return style;
}
}
代码示例来源:origin: TomasKypta/android-lang-tool
private static HSSFCellStyle createCommentStyle(HSSFWorkbook wb) {
HSSFFont commentFont = wb.createFont();
commentFont.setColor(HSSFColor.GREEN.index);
commentFont.setItalic(true);
commentFont.setFontHeightInPoints((short)12);
HSSFCellStyle commentStyle = wb.createCellStyle();
commentStyle.setFont(commentFont);
return commentStyle;
}
代码示例来源:origin: org.sakaiproject.assignment/sakai-assignment-impl
private HSSFCellStyle createHeaderStyle(){
//TO-DO read style information from sakai.properties
HSSFFont font = gradesWorkbook.createFont();
font.setFontName(HSSFFont.FONT_ARIAL);
font.setColor(IndexedColors.PLUM.getIndex());
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
HSSFCellStyle cellStyle = gradesWorkbook.createCellStyle();
cellStyle.setFont(font);
return cellStyle;
}
代码示例来源:origin: qcadoo/mes
private void whiteDataStyle(HSSFSheet sheet) {
HSSFCellStyle style = sheet.getWorkbook().createCellStyle();
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setWrapText(true);
style.setFont(fontNormal);
styles.put(I_WhiteDataStyle, style);
}
代码示例来源:origin: youseries/ureport
CellStyle rowStyle=cell.getRow().getCustomCellStyle();
CellStyle colStyle=cell.getColumn().getCustomCellStyle();
HSSFCellStyle style=wb.createCellStyle();
style.setWrapText(true);
String bgcolor=cellStyle.getBgcolor();
代码示例来源:origin: TomasKypta/android-lang-tool
private static HSSFCellStyle createTilteStyle(HSSFWorkbook wb) {
HSSFFont bold = wb.createFont();
bold.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
HSSFCellStyle style = wb.createCellStyle();
style.setFont(bold);
style.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setWrapText(true);
return style;
}
内容来源于网络,如有侵权,请联系作者删除!