Java Code Examples for org.apache.poi.ss.usermodel.FillPatternType#SOLID_FOREGROUND
The following examples show how to use
org.apache.poi.ss.usermodel.FillPatternType#SOLID_FOREGROUND .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JRXlsExporter.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@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); }
Example 2
Source File: JRXlsExporter.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@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); }
Example 3
Source File: JRXlsExporter.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@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); }
Example 4
Source File: JRXlsMetadataExporter.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@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); } }
Example 5
Source File: JRXlsExporter.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
@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); }
Example 6
Source File: JRXlsExporter.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
@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); }
Example 7
Source File: JRXlsMetadataExporter.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
@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); } }