本文整理汇总了Java中org.apache.poi.ss.usermodel.FillPatternType类的典型用法代码示例。如果您正苦于以下问题:Java FillPatternType类的具体用法?Java FillPatternType怎么用?Java FillPatternType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FillPatternType类属于org.apache.poi.ss.usermodel包,在下文中一共展示了FillPatternType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIndentationCellStyle
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
public CellStyle createIndentationCellStyle(Workbook workbook, int s) {
CellStyle dataStyle1 = this.createBorderCellStyle(workbook, true);
Font dataFont = workbook.createFont();
dataFont.setColor((short) 12);
dataFont.setFontHeightInPoints((short) 10);
dataStyle1.setFillPattern(FillPatternType.SOLID_FOREGROUND);
dataStyle1.setFillForegroundColor((short) 11);
dataStyle1.setFont(dataFont);
dataStyle1.setVerticalAlignment(VerticalAlignment.CENTER);
dataStyle1.setAlignment(HorizontalAlignment.LEFT);
dataStyle1.setIndention(Short.valueOf(String.valueOf((s))));
return dataStyle1;
}
示例2: createHSSFCellStyle
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的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;
}
示例3: initReport
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
@Override
protected void initReport()
{
super.initReport();
XlsReportConfiguration configuration = getCurrentItemConfiguration();
if (!configuration.isWhitePageBackground())
{
backgroundMode = FillPatternType.NO_FILL;
}
nature =
new JRXlsExporterNature(
jasperReportsContext,
filter,
configuration.isIgnoreGraphics(),
configuration.isIgnorePageMargins()
);
}
示例4: getLoadedCellStyle
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
protected HSSFCellStyle getLoadedCellStyle(
FillPatternType mode,
short backcolor,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
short rotation,
HSSFFont font,
BoxStyle box,
boolean isWrapText,
boolean isCellLocked,
boolean isCellHidden,
boolean isShrinkToFit
)
{
StyleInfo style = new StyleInfo(mode, backcolor, horizontalAlignment, verticalAlignment, rotation, font, box, isWrapText, isCellLocked, isCellHidden, isShrinkToFit);
return getLoadedCellStyle(style);
}
示例5: defaultHeaderCellStyle
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
/**
* Returns the default header style. Obtained from:
* http://svn.apache.org/repos/asf/poi
* /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
*
* @param wb the wb
* @return the cell style
*/
protected CellStyle defaultHeaderCellStyle(final Workbook wb) {
CellStyle style;
final Font monthFont = wb.createFont();
monthFont.setFontHeightInPoints((short) 11);
monthFont.setColor(IndexedColors.WHITE.getIndex());
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
style.setFont(monthFont);
style.setWrapText(true);
return style;
}
示例6: StyleInfo
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
public StyleInfo(
FillPatternType mode,
short backcolor,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
short rotation,
HSSFFont font,
JRExporterGridCell gridCell,
boolean wrapText,
boolean cellLocked,
boolean cellHidden,
boolean shrinkToFit
)
{
this(mode,
backcolor,
horizontalAlignment,
verticalAlignment,
rotation,
font,
(gridCell == null ? null : new BoxStyle(gridCell)),
wrapText,
cellLocked,
cellHidden,
shrinkToFit);
}
示例7: initReport
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
@Override
protected void initReport()
{
super.initReport();
XlsReportConfiguration configuration = getCurrentItemConfiguration();
if (!configuration.isWhitePageBackground())
{
backgroundMode = FillPatternType.NO_FILL;
}
nature =
new JRXlsMetadataExporterNature(
jasperReportsContext,
filter,
configuration.isIgnoreGraphics(),
configuration.isIgnorePageMargins()
);
}
示例8: createCellStyleForColumnHeading
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的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;
}
示例9: addBackgroundColourToStyle
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
@Override
public void addBackgroundColourToStyle(Workbook workbook, CellStyle style, String colour) {
if(colour == null) {
return ;
}
if(IStyle.TRANSPARENT_VALUE.equals(colour)) {
return ;
}
if(style instanceof XSSFCellStyle) {
XSSFCellStyle cellStyle = (XSSFCellStyle)style;
XSSFColor xColour = getXColour(colour);
if(xColour != null) {
cellStyle.setFillForegroundColor(xColour);
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
}
}
}
示例10: XLSXTranslatorOutputFormat
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
/**
* Public constructor.
* @param os output stream
*/
public XLSXTranslatorOutputFormat(final OutputStream os) {
if (os == null) {
throw new NullPointerException("The output stream is null");
}
this.os = os;
// Temporary files will be compressed
this.wb.setCompressTempFiles(true);
// Define default style
Font defaultFont = this.wb.createFont();
defaultFont.setFontName("Arial");
defaultFont.setFontHeightInPoints((short) 10);
this.defaultStyle = this.wb.createCellStyle();
this.defaultStyle.setFont(defaultFont);
// Define header style
Font headerFont = this.wb.createFont();
headerFont.setFontName(defaultFont.getFontName());
headerFont.setFontHeightInPoints(defaultFont.getFontHeightInPoints());
headerFont.setItalic(true);
this.headerStyle = this.wb.createCellStyle();
this.headerStyle.setFillForegroundColor(IndexedColors.ORANGE.getIndex());
this.headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
this.headerStyle.setFont(headerFont);
// Define link style
Font linkfont = this.wb.createFont();
linkfont.setFontName(defaultFont.getFontName());
linkfont.setFontHeightInPoints(defaultFont.getFontHeightInPoints());
linkfont.setUnderline(XSSFFont.U_SINGLE);
linkfont.setColor(IndexedColors.BLUE.getIndex());
this.linkStyle = this.wb.createCellStyle();
this.linkStyle.setFont(linkfont);
}
示例11: addBlankCell
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
@Override
protected void addBlankCell(JRExporterGridCell gridCell, int colIndex, int rowIndex)
{
cell = row.createCell(colIndex);
FillPatternType mode = backgroundMode;
short backcolor = whiteIndex;
if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && gridCell.getCellBackcolor() != null)
{
mode = FillPatternType.SOLID_FOREGROUND;
backcolor = getWorkbookColor(gridCell.getCellBackcolor()).getIndex();
}
short forecolor = blackIndex;
if (gridCell.getForecolor() != null)
{
forecolor = getWorkbookColor(gridCell.getForecolor()).getIndex();
}
HSSFCellStyle cellStyle =
getLoadedCellStyle(
mode,
backcolor,
HorizontalAlignment.LEFT,
VerticalAlignment.TOP,
(short)0,
getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
gridCell,
true,
true,
false,
false
);
cell.setCellStyle(cellStyle);
}
示例12: createHeaderStyle
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
public static CellStyle createHeaderStyle(Workbook workbook) {
XSSFCellStyle headerStyle = createCellStyle(workbook);
XSSFColor header = new XSSFColor(new byte[]{(byte) 79, (byte) 129, (byte) 189});
headerStyle.setFillForegroundColor(header);
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
headerStyle.getFont().setColor(IndexedColors.WHITE.index);
return headerStyle;
}
示例13: exportExcelTemplate
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void exportExcelTemplate(HttpServletRequest req, HttpServletResponse resp) throws Exception {
List<VariableCategory> variableCategories=(List<VariableCategory>)httpSessionKnowledgeCache.get(req, VCS_KEY);
if(variableCategories==null){
KnowledgeBase knowledgeBase=buildKnowledgeBase(req);
variableCategories=knowledgeBase.getResourceLibrary().getVariableCategories();
}
SXSSFWorkbook wb = new SXSSFWorkbook();
XSSFCellStyle style=(XSSFCellStyle)wb.createCellStyle();
Color c=new Color(147,208,15);
XSSFColor xssfColor=new XSSFColor(c);
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
style.setFillForegroundColor(xssfColor);
for(VariableCategory vc:variableCategories){
buildSheet(wb, vc,style);
}
resp.setContentType("application/x-xls");
resp.setHeader("Content-Disposition","attachment; filename=urule-batch-test-template.xlsx");
OutputStream outputStream=resp.getOutputStream();
wb.write(outputStream);;
outputStream.flush();
outputStream.close();
}
示例14: defaultTotalsDoubleCellStyle
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
/**
* Returns the default totals row style for Double data. Obtained from:
* http://svn.apache.org/repos/asf/poi
* /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
*
* @param wb the wb
* @return the cell style
*/
protected CellStyle defaultTotalsDoubleCellStyle(final Workbook wb) {
CellStyle style;
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
style.setDataFormat(doubleDataFormat);
return style;
}
示例15: defaultTotalsIntegerCellStyle
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
/**
* Returns the default totals row style for Integer data. Obtained from:
* http://svn.apache.org/repos/asf/poi
* /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
*
* @param wb the wb
* @return the cell style
*/
protected CellStyle defaultTotalsIntegerCellStyle(final Workbook wb) {
CellStyle style;
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
style.setDataFormat(integerDataFormat);
return style;
}