当前位置: 首页>>代码示例>>Java>>正文


Java FillPatternType.SOLID_FOREGROUND属性代码示例

本文整理汇总了Java中org.apache.poi.ss.usermodel.FillPatternType.SOLID_FOREGROUND属性的典型用法代码示例。如果您正苦于以下问题:Java FillPatternType.SOLID_FOREGROUND属性的具体用法?Java FillPatternType.SOLID_FOREGROUND怎么用?Java FillPatternType.SOLID_FOREGROUND使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.poi.ss.usermodel.FillPatternType的用法示例。


在下文中一共展示了FillPatternType.SOLID_FOREGROUND属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addBlankCell

@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,代码行数:37,代码来源:JRXlsExporter.java

示例2: exportRectangle

@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,代码行数:33,代码来源:JRXlsExporter.java

示例3: exportFrame

@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,代码行数:33,代码来源:JRXlsExporter.java

示例4: exportText

@Override
public void exportText(JRPrintText textElement, JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
{
	JRStyledText styledText = getStyledText(textElement);

	if (styledText == null)
	{
		return;
	}

	short forecolor = getWorkbookColor(textElement.getForecolor()).getIndex();

	TextAlignHolder textAlignHolder = getTextAlignHolder(textElement);
	HorizontalAlignment horizontalAlignment = getHorizontalAlignment(textAlignHolder);
	VerticalAlignment verticalAlignment = getVerticalAlignment(textAlignHolder);
	short rotation = getRotation(textAlignHolder);

	FillPatternType mode = backgroundMode;
	short backcolor = whiteIndex;
	if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && gridCell.getCellBackcolor() != null)
	{
		mode = FillPatternType.SOLID_FOREGROUND;
		backcolor = getWorkbookColor(gridCell.getCellBackcolor()).getIndex();
	}

	StyleInfo baseStyle = 
		isIgnoreTextFormatting(textElement) 
		? new StyleInfo(
			mode,
			whiteIndex,
			horizontalAlignment,
			verticalAlignment,
			(short)0,
			null,
			(JRExporterGridCell)null, 
			isWrapText(textElement) || Boolean.TRUE.equals(((JRXlsExporterNature)nature).getColumnAutoFit(textElement)),
			isCellLocked(textElement),
			isCellHidden(textElement),
			isShrinkToFit(textElement)
			)
		: new StyleInfo(
			mode,
			backcolor,
			horizontalAlignment,
			verticalAlignment,
			rotation,
			getLoadedFont(textElement, forecolor, null, getTextLocale(textElement)),
			gridCell, 
			isWrapText(textElement) || Boolean.TRUE.equals(((JRXlsExporterNature)nature).getColumnAutoFit(textElement)),
			isCellLocked(textElement),
			isCellHidden(textElement),
			isShrinkToFit(textElement)
			);
	createTextCell(textElement, gridCell, colIndex, rowIndex, styledText, baseStyle, forecolor);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:55,代码来源:JRXlsExporter.java

示例5: configureStyle

private void configureStyle(XSSFCellStyle style) {
    XSSFFont font = style.getFont();
    if (font.getBold()) {
        _style.bold();
    }
    if (font.getItalic()) {
        _style.italic();
    }
    if (font.getUnderline() != FontUnderline.NONE.getByteValue()) {
        _style.underline();
    }

    if (style.getFillPatternEnum() == FillPatternType.SOLID_FOREGROUND) {
        XSSFColor fillForegroundXSSFColor = style.getFillForegroundXSSFColor();
        String argb = fillForegroundXSSFColor.getARGBHex();
        if (argb != null) {
            _style.background(argb.substring(2));
        }
    }

    final XSSFFont stdFont = _stylesTable.getStyleAt(0).getFont();
    final short fontHeight = style.getFont().getFontHeightInPoints();
    if (stdFont.getFontHeightInPoints() != fontHeight) {
        _style.fontSize(fontHeight, SizeUnit.PT);
    }

    XSSFColor fontColor = style.getFont().getXSSFColor();
    if (fontColor != null) {
        String argbHex = fontColor.getARGBHex();
        if (argbHex != null) {
            _style.foreground(argbHex.substring(2));
        }
    }

    switch (style.getAlignmentEnum()) {
    case LEFT:
        _style.leftAligned();
        break;
    case RIGHT:
        _style.rightAligned();
        break;
    case CENTER:
        _style.centerAligned();
        break;
    case JUSTIFY:
        _style.justifyAligned();
        break;
    default:
        // do nothing
        break;
    }

}
 
开发者ID:apache,项目名称:metamodel,代码行数:53,代码来源:XlsxSheetToRowsHandler.java

示例6: exportRectangle

@Override
protected void exportRectangle(JRPrintGraphicElement element) throws JRException {
	String currentColumnName = element.getPropertiesMap().getProperty(JRXlsAbstractMetadataExporter.PROPERTY_COLUMN_NAME);
	
	if (currentColumnName != null && currentColumnName.length() > 0) {
		boolean repeatValue = getPropertiesUtil().getBooleanProperty(element, JRXlsAbstractMetadataExporter.PROPERTY_REPEAT_VALUE, false);
		
		setColumnName(currentColumnName);
		adjustColumnWidth(currentColumnName, element.getWidth(), ((JRXlsExporterNature)nature).getColumnAutoFit(element));
		adjustRowHeight(element.getHeight(), ((JRXlsExporterNature)nature).getRowAutoFit(element));
		
		short forecolor = getWorkbookColor(element.getLinePen().getLineColor()).getIndex();

		FillPatternType mode = backgroundMode;
		short backcolor = whiteIndex;
		if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && element.getBackcolor() != null) {
			mode = FillPatternType.SOLID_FOREGROUND;
			backcolor = getWorkbookColor(element.getBackcolor()).getIndex();
		}

		HSSFCellStyle cellStyle =
			getLoadedCellStyle(
				mode,
				backcolor,
				HorizontalAlignment.LEFT,
				VerticalAlignment.TOP,
				(short)0,
				getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
				new BoxStyle(element),
				isCellLocked(element),
				isCellHidden(element),
				isShrinkToFit(element)
				);
		addBlankElement(cellStyle, repeatValue, currentColumnName);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:36,代码来源:JRXlsMetadataExporter.java

示例7: exportLine

@Override
protected void exportLine(JRPrintLine line, JRExporterGridCell gridCell, int colIndex, int rowIndex)
{
	short forecolor = getWorkbookColor(line.getLinePen().getLineColor()).getIndex();

	int side = BoxStyle.TOP;
	float ratio = line.getWidth() / line.getHeight();
	if (ratio > 1)
	{
		if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
		{
			side = BoxStyle.TOP;
		}
		else
		{
			side = BoxStyle.BOTTOM;
		}
	}
	else
	{
		if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
		{
			side = BoxStyle.LEFT;
		}
		else
		{
			side = BoxStyle.RIGHT;
		}
	}
	BoxStyle boxStyle = new BoxStyle(side, line.getLinePen());

	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()),
			boxStyle,
			false,
			isCellLocked(line),
			isCellHidden(line),
			isShrinkToFit(line)
			);

	createMergeRegion(gridCell, colIndex, rowIndex, cellStyle);

	cell = row.createCell(colIndex);
	cell.setCellStyle(cellStyle);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:59,代码来源:JRXlsExporter.java

示例8: exportLine

@Override
protected void exportLine(JRPrintLine line) throws JRException {
	String currentColumnName = line.getPropertiesMap().getProperty(JRXlsAbstractMetadataExporter.PROPERTY_COLUMN_NAME);
	
	if (currentColumnName != null && currentColumnName.length() > 0) {
		boolean repeatValue = getPropertiesUtil().getBooleanProperty(line, JRXlsAbstractMetadataExporter.PROPERTY_REPEAT_VALUE, false);
		
		setColumnName(currentColumnName);
		adjustColumnWidth(currentColumnName, line.getWidth(), ((JRXlsExporterNature)nature).getColumnAutoFit(line));
		adjustRowHeight(line.getHeight(), ((JRXlsExporterNature)nature).getRowAutoFit(line));
		
		short forecolor = getWorkbookColor(line.getLinePen().getLineColor()).getIndex();

		int side = BoxStyle.TOP;
		float ratio = line.getWidth() / line.getHeight();
		if (ratio > 1) {
			if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)	{
				side = BoxStyle.TOP;
			} else {
				side = BoxStyle.BOTTOM;
			}
		} else {
			if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN) {
				side = BoxStyle.LEFT;
			} else {
				side = BoxStyle.RIGHT;
			}
		}
		BoxStyle boxStyle = new BoxStyle(side, line.getLinePen());

		FillPatternType mode = backgroundMode;
		short backcolor = whiteIndex;
		if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && line.getBackcolor() != null) {
			mode = FillPatternType.SOLID_FOREGROUND;
			backcolor = getWorkbookColor(line.getBackcolor()).getIndex();
		}

		HSSFCellStyle cellStyle =
			getLoadedCellStyle(
				mode,
				backcolor,
				HorizontalAlignment.LEFT,
				VerticalAlignment.TOP,
				(short)0,
				getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
				boxStyle,
				isCellLocked(line),
				isCellHidden(line),
				isShrinkToFit(line)
				);
		addBlankElement(cellStyle, repeatValue, currentColumnName);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:53,代码来源:JRXlsMetadataExporter.java


注:本文中的org.apache.poi.ss.usermodel.FillPatternType.SOLID_FOREGROUND属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。