本文整理汇总了Java中org.apache.poi.ss.usermodel.FillPatternType类的典型用法代码示例。如果您正苦于以下问题:Java FillPatternType类的具体用法?Java FillPatternType怎么用?Java FillPatternType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FillPatternType类属于org.apache.poi.ss.usermodel包,在下文中一共展示了FillPatternType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:bsteker,项目名称:bdf2,代码行数:14,代码来源:GridStyleBuilder.java
示例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;
}
开发者ID:bsteker,项目名称:bdf2,代码行数:24,代码来源:TitleStyleBuilder.java
示例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()
);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:21,代码来源:JRXlsExporter.java
示例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);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:JRXlsExporter.java
示例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;
}
开发者ID:TFyre,项目名称:vaadin-gridexport,代码行数:23,代码来源:ExcelExport.java
示例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);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:27,代码来源:JRXlsExporter.java
示例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()
);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:21,代码来源:JRXlsMetadataExporter.java
示例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;
}
开发者ID:siteadmin,项目名称:CCDA-Score-CARD,代码行数:21,代码来源:ScorecardExcelGenerator.java
示例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);
}
}
}
开发者ID:eclipse,项目名称:birt,代码行数:18,代码来源:StyleManagerXUtils.java
示例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);
}
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:42,代码来源:XLSXTranslatorOutputFormat.java
示例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);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:38,代码来源:JRXlsExporter.java
示例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;
}
开发者ID:Adobe-Consulting-Services,项目名称:aem-epic-tool,代码行数:9,代码来源:ReportUtil.java
示例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();
}
开发者ID:youseries,项目名称:urule,代码行数:24,代码来源:PackageServletHandler.java
示例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;
}
开发者ID:TFyre,项目名称:vaadin-gridexport,代码行数:19,代码来源:ExcelExport.java
示例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;
}
开发者ID:TFyre,项目名称:vaadin-gridexport,代码行数:19,代码来源:ExcelExport.java
示例16: getValue
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
/**
* 对变量名称反射出来的值进行加工处理
*
* @author ZhengWei(HY)
* @createDate 2017-06-29
* @version v1.0
*
* @param i_RTemplate 模板
* @param i_TemplateCell 模板单元格对象
* @param i_DataCell 数据单元格对象
* @param i_DataWorkbook 数据工作薄对象
* @param i_RSystemValue 系统变量信息
* @param i_Datas 本行对应的数据
* @param i_Value 反射出来的变量名称对应的值
* @return
*/
public String getValue(RTemplate i_RTemplate ,Cell i_TemplateCell ,Cell i_DataCell ,RWorkbook i_DataWorkbook ,RSystemValue i_RSystemValue ,Object i_Datas ,Object i_Value)
{
CellStyle v_NewCellStyle = null;
if ( i_DataCell.getRow().getRowNum() % 2 == 1 )
{
v_NewCellStyle = i_DataWorkbook.getCellStyleByCopy("单行" ,i_DataCell ,i_RTemplate);
v_NewCellStyle.setFillForegroundColor(IndexedColors.ORANGE.index);
}
else
{
v_NewCellStyle = i_DataWorkbook.getCellStyleByCopy("双行" ,i_DataCell ,i_RTemplate);
v_NewCellStyle.setFillForegroundColor(IndexedColors.RED.index);
}
v_NewCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
i_DataCell.setCellStyle(v_NewCellStyle);
if ( i_Value == null )
{
return "";
}
return i_Value.toString();
}
开发者ID:HY-ZhengWei,项目名称:hy.common.report,代码行数:43,代码来源:ColorListener.java
示例17: test_001
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
@Test
public void test_001()
{
HSSFWorkbook v_Workbook = new HSSFWorkbook();
HSSFSheet v_Sheet = v_Workbook.createSheet("测试单元格颜色");
v_Sheet.setColumnWidth(0 ,2560);
for (int v_RowIndex=0; v_RowIndex<4000; v_RowIndex++)
{
HSSFRow v_Row = v_Sheet.createRow(v_RowIndex);
for (int v_ColIndex=0; v_ColIndex<1; v_ColIndex++)
{
HSSFCell v_Cell = v_Row.createCell(v_ColIndex);
HSSFCellStyle v_CellStyle = v_Workbook.createCellStyle();
v_CellStyle.setFillForegroundColor((short)(v_RowIndex + 1));
v_CellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
v_Cell.setCellStyle(v_CellStyle);
v_Cell.setCellValue("" + (v_RowIndex + 1));
}
}
ExcelHelp.save(v_Workbook ,"/Users/hy/Downloads/测试2003版本的单元格颜色");
}
开发者ID:HY-ZhengWei,项目名称:hy.common.report,代码行数:28,代码来源:JU_Excel2003Color.java
示例18: createXSSFCellStyle
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
private XSSFCellStyle createXSSFCellStyle(Workbook wb, int[] bgColor, int[] fontColor, int fontSize) {
SXSSFWorkbook workbook = (SXSSFWorkbook) wb;
XSSFFont titleFont = (XSSFFont) workbook.createFont();
titleFont.setCharSet(HSSFFont.DEFAULT_CHARSET);
titleFont.setFontName("宋体");
XSSFColor color9 = new XSSFColor(new java.awt.Color(fontColor[0], fontColor[1], fontColor[2]));
XSSFColor color10 = new XSSFColor(new java.awt.Color(bgColor[0], bgColor[1], bgColor[2]));
if (!(fontColor[0] == 0 && fontColor[1] == 0 && fontColor[2] == 0)) {
titleFont.setColor(color9);
}
titleFont.setBold(true);
titleFont.setFontHeightInPoints((short) fontSize);
XSSFCellStyle titleStyle = (XSSFCellStyle) createBorderCellStyle(workbook, true);
titleStyle.setFont(titleFont);
titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
titleStyle.setFillForegroundColor(color10);
titleStyle.setAlignment(HorizontalAlignment.CENTER);
titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
return titleStyle;
}
开发者ID:bsteker,项目名称:bdf2,代码行数:25,代码来源:TitleStyleBuilder.java
示例19: exportRectangle
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
@Override
protected void exportRectangle(JRPrintGraphicElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex)
{
short forecolor = getWorkbookColor(element.getLinePen().getLineColor()).getIndex();
FillPatternType mode = backgroundMode;
short backcolor = whiteIndex;
if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && gridCell.getCellBackcolor() != null)
{
mode = FillPatternType.SOLID_FOREGROUND;
backcolor = getWorkbookColor(gridCell.getCellBackcolor()).getIndex();
}
HSSFCellStyle cellStyle =
getLoadedCellStyle(
mode,
backcolor,
HorizontalAlignment.LEFT,
VerticalAlignment.TOP,
(short)0,
getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
gridCell,
isWrapText(element),
isCellLocked(element),
isCellHidden(element),
isShrinkToFit(element)
);
createMergeRegion(gridCell, colIndex, rowIndex, cellStyle);
cell = row.createCell(colIndex);
cell.setCellStyle(cellStyle);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:34,代码来源:JRXlsExporter.java
示例20: exportFrame
import org.apache.poi.ss.usermodel.FillPatternType; //导入依赖的package包/类
@Override
protected void exportFrame(JRPrintFrame frame, JRExporterGridCell gridCell, int x, int y)
{
FillPatternType mode = backgroundMode;
short backcolor = whiteIndex;
if (frame.getModeValue() == ModeEnum.OPAQUE)
{
mode = FillPatternType.SOLID_FOREGROUND;
backcolor = getWorkbookColor(frame.getBackcolor()).getIndex();
}
short forecolor = getWorkbookColor(frame.getForecolor()).getIndex();
HSSFCellStyle cellStyle =
getLoadedCellStyle(
mode,
backcolor,
HorizontalAlignment.LEFT,
VerticalAlignment.TOP,
(short)0,
getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
gridCell,
isWrapText(frame),
isCellLocked(frame),
isCellHidden(frame),
isShrinkToFit(frame)
);
createMergeRegion(gridCell, x, y, cellStyle);
cell = row.createCell(x);
cell.setCellStyle(cellStyle);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:34,代码来源:JRXlsExporter.java
注:本文中的org.apache.poi.ss.usermodel.FillPatternType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论