poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 46989] New: Support Array formulas
Date Wed, 08 Apr 2009 00:37:10 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=46989

           Summary: Support Array formulas
           Product: POI
           Version: 3.5-dev
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: trejkaz@trypticon.org


Created an attachment (id=23453)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23453)
hssf-array-ptg.xls

The following test case is in our set of "things which POI cannot do":

    public void testArrayPtg() throws Exception
    {
        File file = new File("hssf-array-ptg.xls");

        HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(new
FileInputStream(file)));
        HSSFSheet sheet = workbook.getSheetAt(0);
        HSSFCell cell;

        // All in one row
        cell = sheet.getRow(0).getCell((short) 0);
        assertEquals("Wrong formula string for numeric 4x1 array", "{1,2,3,4}",
                     cell.getCellFormula());
        assertEquals("Wrong numeric value for numeric 4x1 array", 1.0,
                     cell.getNumericCellValue(), 0.0);

        // All in one column
        cell = sheet.getRow(0).getCell((short) 1);
        assertEquals("Wrong formula string for numeric 1x4 array", "{1;2;3;4}",
                     cell.getCellFormula());
        assertEquals("Wrong numeric value for numeric 1x4 array", 1.0,
                     cell.getNumericCellValue(), 0.0);

        // 2 x 2
        cell = sheet.getRow(0).getCell((short) 2);
        assertEquals("Wrong formula string for numeric 2x2 array", "{1,2;3,4}",
                     cell.getCellFormula());
        assertEquals("Wrong numeric value for numeric 2x2 array", 1.0,
                     cell.getNumericCellValue(), 0.0);

        // Strings
        cell = sheet.getRow(1).getCell((short) 0);
        assertEquals("Wrong formula string for string array",
"{\"a\",\"b\",\"c\"}",
                     cell.getCellFormula());
        assertEquals("Wrong string value for string array", "a",
                     cell.getRichStringCellValue().toString());

        // Booleans
        cell = sheet.getRow(2).getCell((short) 0);
        assertEquals("Wrong formula string for boolean array", "{TRUE,FALSE}",
                     cell.getCellFormula());
        assertTrue("Wrong boolean value for boolean array",
                   cell.getBooleanCellValue());
    }

In POI 3.1 it failed with RecordFormatException.  In POI trunk it appears to
fail with IllegalStateException instead.

This was a test case constructed myself using Excel 2003 to reproduce something
we saw in real user data.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message