Package org.apache.poi.hssf.usermodel

Examples of org.apache.poi.hssf.usermodel.HSSFSheet


    final ByteArrayOutputStream bout = new ByteArrayOutputStream();
    ExcelReportUtil.createXLS(report, bout);

    final HSSFWorkbook wb = new HSSFWorkbook(new ByteArrayInputStream(bout.toByteArray()));
    final HSSFSheet sheetAt = wb.getSheetAt(0);
    final HSSFRow row = sheetAt.getRow(0);
    final HSSFCell cell0 = row.getCell(0);
    assertEquals(Cell.CELL_TYPE_NUMERIC, cell0.getCellType());
    assertEquals("yyyy-MM-dd", cell0.getCellStyle().getDataFormatString());
    final HSSFCell cell1 = row.getCell(1);
    assertEquals(Cell.CELL_TYPE_NUMERIC, cell1.getCellType());
View Full Code Here


    crit.addOrder(order);
    @SuppressWarnings("unchecked")
    List<Prozess> pl = crit.setFirstResult(0).setMaxResults(Integer.MAX_VALUE).list();

    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("Search results");

    HSSFRow title = sheet.createRow(0);
    HSSFCell titleCell1 = title.createCell(0);
    titleCell1.setCellValue(this.filter);
    HSSFCell titleCell2 = title.createCell(1);
    titleCell2.setCellValue("");
    HSSFCell titleCell3 = title.createCell(2);
    titleCell3.setCellValue("");
    HSSFCell titleCell4 = title.createCell(3);
    titleCell4.setCellValue("");
    HSSFCell titleCell5 = title.createCell(4);
    titleCell5.setCellValue("");
    HSSFCell titleCell6 = title.createCell(5);
    titleCell6.setCellValue("");

    HSSFCell titleCell7 = title.createCell(6);
    titleCell7.setCellValue("");
    HSSFCell titleCell8 = title.createCell(7);
    titleCell8.setCellValue("");

    HSSFCell titleCell9 = title.createCell(8);
    titleCell9.setCellValue("");

    HSSFRow row0 = sheet.createRow(1);
    HSSFCell headercell0 = row0.createCell(0);
    headercell0.setCellValue(Helper.getTranslation("title"));
    HSSFCell headercell1 = row0.createCell(1);
    headercell1.setCellValue(Helper.getTranslation("ID"));
    HSSFCell headercell2 = row0.createCell(2);
    headercell2.setCellValue(Helper.getTranslation("Datum"));
    HSSFCell headercell3 = row0.createCell(3);
    headercell3.setCellValue(Helper.getTranslation("CountImages"));
    HSSFCell headercell4 = row0.createCell(4);
    headercell4.setCellValue(Helper.getTranslation("CountMetadata"));
    HSSFCell headercell5 = row0.createCell(5);
    headercell5.setCellValue(Helper.getTranslation("Project"));
    HSSFCell headercell6 = row0.createCell(6);
    headercell6.setCellValue(Helper.getTranslation("Status"));

    HSSFCell headercell7 = row0.createCell(7);
    headercell7.setCellValue(Helper.getTranslation("AltRefNo"));

    HSSFCell headercell8 = row0.createCell(8);
    headercell8.setCellValue(Helper.getTranslation("b-number"));

    int rowcounter = 2;
    for (Prozess p : pl) {
      HSSFRow row = sheet.createRow(rowcounter);
      HSSFCell cell0 = row.createCell(0);
      cell0.setCellValue(p.getTitel());
      HSSFCell cell1 = row.createCell(1);
      cell1.setCellValue(p.getId());
      HSSFCell cell2 = row.createCell(2);
View Full Code Here

    HSSFWorkbook wb = new HSSFWorkbook();

    wb.createSheet("NoQuotesNeeded");
    wb.createSheet("Quotes Needed Here &#$@");

    HSSFSheet sheet = wb.createSheet("Test");
    HSSFRow row = sheet.createRow(0);
    HSSFCell cell;

    cell = row.createCell(0);
    cell.setCellFormula("NoQuotesNeeded!A1");
View Full Code Here

  public void testUnderscore() {
    HSSFWorkbook wb = new HSSFWorkbook();

    wb.createSheet("Cash_Flow");

    HSSFSheet sheet = wb.createSheet("Test");
    HSSFRow row = sheet.createRow(0);
    HSSFCell cell;

    cell = row.createCell(0);
    cell.setCellFormula("Cash_Flow!A1");
  }
View Full Code Here

  public void testExponentialInSheet() {
    HSSFWorkbook wb = new HSSFWorkbook();

    wb.createSheet("Cash_Flow");

    HSSFSheet sheet = wb.createSheet("Test");
    HSSFRow row = sheet.createRow(0);
    HSSFCell cell = row.createCell(0);
    String formula = null;

    cell.setCellFormula("1.3E21/3");
    formula = cell.getCellFormula();
View Full Code Here

  public void testNumbers() {
    HSSFWorkbook wb = new HSSFWorkbook();

    wb.createSheet("Cash_Flow");

    HSSFSheet sheet = wb.createSheet("Test");
    HSSFRow row = sheet.createRow(0);
    HSSFCell cell = row.createCell(0);
    String formula = null;

    // starts from decimal point
View Full Code Here

  public void testRanges() {
    HSSFWorkbook wb = new HSSFWorkbook();

    wb.createSheet("Cash_Flow");

    HSSFSheet sheet = wb.createSheet("Test");
    HSSFRow row = sheet.createRow(0);
    HSSFCell cell = row.createCell(0);
    String formula = null;

    cell.setCellFormula("A1.A2");
    formula = cell.getCellFormula();
View Full Code Here

      throw e;
    }
    assertEquals("test\"ing", sp.getValue());

    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet();
    wb.setSheetName(0, "Sheet1");

    HSSFRow row = sheet.createRow(0);
    HSSFCell cell = row.createCell(0);
    cell.setCellFormula("right(\"test\"\"ing\", 3)");
    String actualCellFormula = cell.getCellFormula();
    if("RIGHT(\"test\"ing\",3)".equals(actualCellFormula)) {
      throw new AssertionFailedError("Identified bug 28754b");
View Full Code Here

  }

  public void testSetFormulaWithRowBeyond32768_Bug44539() {

    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet();
    wb.setSheetName(0, "Sheet1");

    HSSFRow row = sheet.createRow(0);
    HSSFCell cell = row.createCell(0);
    cell.setCellFormula("SUM(A32769:A32770)");
    if("SUM(A-32767:A-32766)".equals(cell.getCellFormula())) {
      fail("Identified bug 44539");
    }
View Full Code Here

    assertEquals("ERROR.TYPE", ((FuncPtg) ptgs[1]).getName());
  }

  public void testNamedRangeThatLooksLikeCell() {
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("Sheet1");
    HSSFName name = wb.createName();
    name.setRefersToFormula("Sheet1!B1");
    name.setNameName("pfy1");

    Ptg[] ptgs;
    try {
      ptgs = HSSFFormulaParser.parse("count(pfy1)", wb);
    } catch (IllegalArgumentException e) {
      if (e.getMessage().equals("Specified colIx (1012) is out of range")) {
        throw new AssertionFailedError("Identified bug 45354");
      }
      throw e;
    }
    confirmTokenClasses(ptgs, NamePtg.class, FuncVarPtg.class);

    HSSFCell cell = sheet.createRow(0).createCell(0);
    cell.setCellFormula("count(pfy1)");
    assertEquals("COUNT(pfy1)", cell.getCellFormula());
    try {
      cell.setCellFormula("count(pf1)");
      throw new AssertionFailedError("Expected formula parse execption");
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.usermodel.HSSFSheet

Copyright © 2018 www.massapicom. 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.