Examples of autoSizeColumn()


Examples of org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn()

             
              String cellWidthString = nodeValueForKey(cellNode, "width", null);
              if(cellWidthString != null && cellWidthString.indexOf("%") < 0) {
                if ("auto".equalsIgnoreCase(cellWidthString)) {
                    try {
                      sheet.autoSizeColumn((short) currentColumnNumber);
                    } catch (Exception ex) {
                      log.warn(ex);
                    }
                } else {
                    try {
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn()

            }

            // adjust the column widths
            int colCount = 0;
            while (colCount <= colNum) {
                sheet.autoSizeColumn((short) colCount++);
            }

            wb.write(out);
        } catch (Exception e) {
            throw new ExcelGenerationException(e);
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.autoSizeColumn()

      }     
      createCell(workbook, row, counter+1, "Uspesno/Neuspesno", CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER);
      createCell(workbook, row, counter+2, "Komentar", CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER);
     
      for (int i=0; i<counter+3; i++) {
        sheet.autoSizeColumn(i);
      }
    }
     
    try {
      FileOutputStream fileOutput = new FileOutputStream(reportFile + ".xls");
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.autoSizeColumn()

            r1.getCell(i+0).setCellStyle(iPercent);
            r1.getCell(i+1).setCellStyle(d1Percent);
            r1.getCell(i+2).setCellStyle(d2Percent);
        }
        for (int i=0; i<12; i++) {
            s.autoSizeColumn(i);
        }
       
        // Check the 0(.00)% ones
        assertAlmostEquals(980, s.getColumnWidth(0), fontAccuracy);
        assertAlmostEquals(1400, s.getColumnWidth(1), fontAccuracy);
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.autoSizeColumn()

          cell.setCellValue(text);
          cindex++;
        }
      }
       for(int i=0; i<titleList.size(); i++){
                 sheet.autoSizeColumn(i);
       }
     
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.autoSizeColumn()

        //increase row height to accomodate two lines of text
        row.setHeightInPoints((2*sheet.getDefaultRowHeightInPoints()));

        //adjust column width to fit the content
        sheet.autoSizeColumn(2);

        FileOutputStream fileOut = new FileOutputStream("ooxml-newlines.xlsx");
        wb.write(fileOut);
        fileOut.close();
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.autoSizeColumn()

    //设定冻结表头
    s.createFreezePane(0, 2, 0, 2);

    //设定所有Column宽度自动配合内容宽度
    s.autoSizeColumn(0);
    s.autoSizeColumn(1);
    s.autoSizeColumn(2);

    //产生标题
    generateTitle(s);
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.autoSizeColumn()

    //设定冻结表头
    s.createFreezePane(0, 2, 0, 2);

    //设定所有Column宽度自动配合内容宽度
    s.autoSizeColumn(0);
    s.autoSizeColumn(1);
    s.autoSizeColumn(2);

    //产生标题
    generateTitle(s);
    //产生表头
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.autoSizeColumn()

    s.createFreezePane(0, 2, 0, 2);

    //设定所有Column宽度自动配合内容宽度
    s.autoSizeColumn(0);
    s.autoSizeColumn(1);
    s.autoSizeColumn(2);

    //产生标题
    generateTitle(s);
    //产生表头
    generateHeader(s);
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.autoSizeColumn()

                    resultRow.createCell(0).setCellValue(testId);
                    resultRow.createCell(1).setCellValue(result.getDeclaringClass().getSimpleName());
                    resultRow.createCell(2).setCellValue(description);
                    resultRow.createCell(3).setCellValue(time);
                }
                sheet.autoSizeColumn(0);
                sheet.autoSizeColumn(1);
                sheet.autoSizeColumn(2);
                sheet.autoSizeColumn(3);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.