Usages of

org.apache.poi.xssf.streaming.SXSSFCell.setCellStyle(?)
static void createHeaderCell(SXSSFRow row, int index, String header, int width, CellStyle style) { SXSSFSheet sheet = row.getSheet(); sheet.setColumnWidth(index, width); SXSSFCell cell = row.createCell(index); cell.setCellValue(header); cell.setCellStyle(style); }
private void setCellStyle(){ SXSSFCell sxssfCell = _xssfCellExportContext.getExcelCell(); XSSFCellStyle cellStyle = CellStyleHandler.instance().getOrCreateCellStyle(_xssfCellExportContext); if(cellStyle != null){ sxssfCell.setCellStyle(cellStyle); }else if(_xssfCellExportContext.parentContext().isSheetNeedProtection()){ sxssfCell.setCellStyle(_xssfCellExportContext.parentContext().parentContext().getNonProtectionStyle()); } }
/** * ��������������� * * @param sheet * @param titles * @param object * @author nan.li */ private static void generateTitleRow(SXSSFSheet sheet, String[] titles, CellStyle cellStyle) { SXSSFRow row = sheet.createRow(0); for (int i = 0; i < titles.length; i++) { SXSSFCell cell = row.createCell(i); cell.setCellStyle(cellStyle);// ��������������������� cell.setCellValue(titles[i]); } }
/** * ��������������� * * @author nan.li * @param sheet * @param titles * @param object */ private static void generateTitleRow(SXSSFSheet sheet, String[] titles, CellStyle cellStyle) { SXSSFRow row = sheet.createRow(0); for (int i = 0; i < titles.length; i++) { SXSSFCell cell = row.createCell(i); cell.setCellStyle(cellStyle);// ��������������������� cell.setCellValue(titles[i]); } }
public static void createCell(SXSSFRow row, int cellNum, String cellValue, @Nullable CellStyle style, Map<Integer, Integer> cellWidth) { SXSSFCell cell = row.createCell(cellNum); cell.setCellValue(cellValue); if (style != null) { cell.setCellStyle(style); } if (cellWidth.get(cellNum) == null || cellWidth.get(cellNum) < cellValue.getBytes().length) { cellWidth.put(cellNum, cellValue.getBytes().length); } }
/** * * ������ :��������������� * ���������wuyechun 2016-6-24 * @param row * @param style * @param cellValue */ public static void createCell(SXSSFRow row,int column,CellStyle style,String cellValue){ SXSSFCell cell = row.createCell(column); cell.setCellStyle(style); cell.setCellValue(cellValue); }
private SXSSFCell cell = null; // code omitted ... /** * ������������ * @param sheetName * @param headers */ private void createSheet(String sheetName,String headers[][],SXSSFWorkbook wb) { sheet = (SXSSFSheet) wb.createSheet(sheetName); row = (SXSSFRow) sheet.createRow(currentRow); for (int i = 0; i < headers.length; i++) { //7680=30*256 sheet.setColumnWidth(i, 7680); cell = (SXSSFCell) row.createCell(i); cell.setCellType(XSSFCell.CELL_TYPE_STRING); cell.setCellValue(headers[i][0]); cell.setCellStyle(head_Style); } currentRow++; }
private static int createCellForUpdateInExcelCells(SXSSFSheet sheet, String values, int cellIndex, SXSSFRow row, boolean wrapText, boolean isNumeric) { int cellIndexx = cellIndex++; SXSSFCell cell = ExcelOperationUtil.createCell(row, cellIndexx); if (isNumeric && !StringUtils.isEmpty(values)) { Double value = Double.valueOf(values.replaceAll("[^0-9.]|\\s+", "")); cell.setCellValue(value); } else { cell.setCellValue(handleEmpty(values)); } if (wrapText) { cs.setWrapText(true); cell.setCellStyle(cs); } return cellIndex; }
public static void setUpHeaderInfo(SXSSFWorkbook workbook, SXSSFSheet sheet, List<String> headers, int rowIndex) { SXSSFRow row = ExcelOperationUtil.createRow(sheet, rowIndex); int cellIndex = 0; // Simple style CellStyle style = workbook.createCellStyle(); // Bold Fond Font bold = workbook.createFont(); bold.setBoldweight(Font.BOLDWEIGHT_BOLD); style.setFont(bold); for (String header : headers) { SXSSFCell cell = ExcelOperationUtil.createCell(row, cellIndex); cell.setCellValue(header); cell.setCellStyle(style); cellIndex++; } }
private static int createCellForUpdateInExcelCells(SXSSFSheet sheet, String values, int cellIndex, SXSSFRow row, boolean wrapText, boolean isNumeric) { int cellIndexx = cellIndex++; SXSSFCell cell = ExcelOperationUtil.createCell(row, cellIndexx); if (isNumeric && !StringUtils.isEmpty(values)) { Double value = Double.valueOf(values.replaceAll("[^0-9.]|\\s+", "")); cell.setCellValue(value); cell.setCellType(Cell.CELL_TYPE_NUMERIC); } else { cell.setCellValue(handleEmpty(values)); } if (wrapText) { cs.setWrapText(true); cell.setCellStyle(cs); } return cellIndex; }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes