private void processSheet(Element container, XSSFSheet sheet) { Element table = htmlDocumentFacade.createTable(); int sIndex = sheet.getWorkbook().getSheetIndex(sheet); String sId = "sheet_".concat(String.valueOf(sIndex)); table.setAttribute("id", sId); table.setAttribute("border", "1"); table.setAttribute("cellpadding", "2"); table.setAttribute("cellspacing", "0"); table.setAttribute("style", "border-collapse: collapse;"); css.append("#") .append(sId) .append(" tr{height:") .append(sheet.getDefaultRowHeightInPoints() / 28.34) .append("cm}\n"); css.append("#") .append(sId) .append(" td{width:") .append(sheet.getDefaultColumnWidth() * 0.21) .append("cm}\n"); // cols generateColumns(sheet, table); // rows Iterator<Row> rows = sheet.iterator(); while (rows.hasNext()) { Row row = rows.next(); if (row instanceof XSSFRow) processRow(table, (XSSFRow) row, sheet); } container.appendChild(table); }
/** * Get the default column width for the sheet (if the columns do not define their own width) in * characters * * @return default column width measured in characters */ public int getDefaultColumnWidth() { return _sh.getDefaultColumnWidth(); }