public void body(TableModel model, Column column) { if (column.isFirstColumn()) { rownum++; cellnum = 0; hssfRow = sheet.createRow(rownum); } String value = column.getCellDisplay(); if (StringUtils.isNumeric(value)) { value = column.getValue() == null ? "" : column.getValue().toString(); } value = value.replaceAll("\t", "").replaceAll("\n", ""); value = ExportViewUtils.parseXLS(value); HSSFCell hssfCell = hssfRow.createCell(cellnum); // modify by springside // hssfCell.setEncoding(HSSFCell.ENCODING_UTF_16); // end of modify by springside if (column.isEscapeAutoFormat()) { writeToCellAsText(hssfCell, value); } else { writeToCellFormatted(hssfCell, value); } cellnum++; }
public String header(TableModel model) { StringBuffer sb = new StringBuffer(); Export export = model.getExportHandler().getCurrentExport(); String headerColor = export.getAttributeAsString(HEADER_COLOR); String headerBackgroundColor = export.getAttributeAsString(HEADER_BACKGROUND_COLOR); sb.append(" <fo:table-header background-color=\"" + headerBackgroundColor + "\" color=\"" + headerColor + "\"> "); sb.append(" <fo:table-row> "); List columns = model.getColumnHandler().getHeaderColumns(); for (Iterator iter = columns.iterator(); iter.hasNext();) { Column column = (Column) iter.next(); String title = column.getCellDisplay(); sb.append(" <fo:table-cell border=\"solid silver .5px\" text-align=\"center\" display-align=\"center\" padding=\"3pt\"> "); sb.append(" <fo:block" + getFont() + ">" + title + "</fo:block> "); sb.append(" </fo:table-cell> "); } sb.append(" </fo:table-row> "); sb.append(" </fo:table-header> "); return sb.toString(); }
public void body(TableModel model, Column column) { if (column.isFirstColumn()) { xlsfo.append(" <fo:table-row> "); } String value = ExportViewUtils.parsePDF(column.getCellDisplay()); xlsfo.append(" <fo:table-cell border=\"solid silver .5px\" display-align=\"center\" padding=\"3pt\"> "); xlsfo.append(" <fo:block" + getFont() + ">" + value + "</fo:block> "); xlsfo.append(" </fo:table-cell> "); if (column.isLastColumn()) { xlsfo.append(" </fo:table-row> "); } }
private void createHeader(TableModel model) { rownum = 0; cellnum = 0; HSSFRow row = sheet.createRow(rownum); List columns = model.getColumnHandler().getHeaderColumns(); for (Iterator iter = columns.iterator(); iter.hasNext(); ) { Column column = (Column) iter.next(); String title = column.getCellDisplay(); HSSFCell cell = row.createCell(cellnum); // modify by springside // cell.setEncoding(HSSFCell.ENCODING_UTF_16); // end of modify by springside cell.setCellStyle((HSSFCellStyle) styles.get("titleStyle")); cell.setCellType(HSSFCell.CELL_TYPE_STRING); cell.setCellValue(title); int valWidth = (title + "").length() * WIDTH_MULT; sheet.setColumnWidth(cell.getCellNum(), (short) valWidth); cellnum++; } }