/** * This implementation creates an {@link XSSFWorkbook} for the XLSX format. */ @Override protected Workbook createWorkbook(Map<String, Object> model, HttpServletRequest request) { return new XSSFWorkbook(); }
/** * Returns hyperlink associated with this cell * * @return hyperlink associated with this cell or <code>null</code> if not found */ @Override public XSSFHyperlink getHyperlink() { return getSheet().getHyperlink(_row.getRowNum(), _cellNum); }
/** * Set a single paragraph of text on the shape. Note this will replace all * existing paragraphs created on the shape. * * @param text * string representing the paragraph text */ public void setText(String text) { clearText(); addNewTextParagraph().addNewTextRun().setText(text); }
protected XSSFCellStyle createStyle(XSSFColor color) { XSSFCellStyle style = workbook.createCellStyle(); if (color != null) { style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFillForegroundColor(color); } style.setWrapText(true); style.setVerticalAlignment(VerticalAlignment.CENTER); return style; }
protected XSSFCell nextCellVertically(XSSFCellStyle cellStyle) { currentRowNumber++; currentRow = currentSheet.getRow(currentRowNumber); XSSFCell cell = currentRow.createCell(currentColumnNumber); cell.setCellStyle(cellStyle); return cell; }
protected void nextSheet(String sheetName, int colSplit, int rowSplit, boolean view) { currentSheet = workbook.createSheet(sheetName); currentDrawing = currentSheet.createDrawingPatriarch(); currentSheet.createFreezePane(colSplit, rowSplit); currentRowNumber = -1; headerCellCount = 0; if (view) { currentSheet.setTabColor(VIEW_TAB_COLOR); } }
/** * Creates a new XSSFRichTextString for you. */ @Override public XSSFRichTextString createRichTextString(String text) { XSSFRichTextString rt = new XSSFRichTextString(text); rt.setStylesTableReference(workbook.getStylesSource()); return rt; }
/** * Returns the cell at the given (0 based) index, * with the {@link org.apache.poi.ss.usermodel.Row.MissingCellPolicy} from the parent Workbook. * * @return the cell at the given (0 based) index */ @Override public XSSFCell getCell(int cellnum) { return getCell(cellnum, _sheet.getWorkbook().getMissingCellPolicy()); }
/** * Get the value of the cell as a string * <p> * For numeric cells we throw an exception. For blank cells we return an empty string. * For formulaCells that are not string Formulas, we throw an exception * </p> * @return the value of the cell as a string */ @Override public String getStringCellValue() { return getRichStringCellValue().getString(); }
/** * Removes the hyperlink for this cell, if there is one. */ @Override public void removeHyperlink() { getSheet().removeHyperlink(_row.getRowNum(), _cellNum); }
protected byte[] getIndexedRGB() { if (isIndexed()) { if (indexedColorMap != null) return indexedColorMap.getRGB(getIndex()); return DefaultIndexedColorMap.getDefaultRGB(getIndex()); } return null; }
/** * Creates new XSSFSheet - called by XSSFWorkbook to create a sheet from scratch. * * @see org.apache.poi.xssf.usermodel.XSSFWorkbook#createSheet() */ protected XSSFSheet() { super(); dataValidationHelper = new XSSFDataValidationHelper(this); onDocumentCreate(); }
@Override public void setDiagonalBorderColor(Color color) { XSSFColor xcolor = XSSFColor.toXSSFColor(color); if (xcolor == null) setDiagonalBorderColor((CTColor)null); else setDiagonalBorderColor(xcolor.getCTColor()); } @Override
public void setFillForegroundColor(Color fg) { XSSFColor xcolor = XSSFColor.toXSSFColor(fg); if (xcolor == null) setFillForegroundColor((CTColor)null); else setFillForegroundColor(xcolor.getCTColor()); } public void setFillForegroundColor(short fg) {
@Override public void setBottomBorderColor(Color color) { XSSFColor xcolor = XSSFColor.toXSSFColor(color); if (xcolor == null) setBottomBorderColor((CTColor)null); else setBottomBorderColor(xcolor.getCTColor()); } @Override
/** * Returns the odd footer. Used on all pages unless * other footers also present, when used on only * odd pages. */ public Footer getOddFooter() { return new XSSFOddFooter(getSheetTypeHeaderFooter()); } /**
/** * @return the sheet which contains the picture shape */ @Override public XSSFSheet getSheet() { return (XSSFSheet)getDrawing().getParent(); }
/** * Add a new paragraph run to this shape, set to the provided string * * @return created paragraph run */ public XSSFTextParagraph addNewTextParagraph(String text) { XSSFTextParagraph paragraph = addNewTextParagraph(); paragraph.addNewTextRun().setText(text); return paragraph; }
/** * This implementation creates an {@link XSSFWorkbook} for the XLSX format. */ @Override protected Workbook createWorkbook(Map<String, Object> model, HttpServletRequest request) { return new XSSFWorkbook(); }