[jboss-jira] [JBoss JIRA] (DROOLS-556) Merged cells referencing other cells not parsed correctly in decision tables

Winfried Umbrath (JIRA) issues at jboss.org
Wed Jul 16 05:34:29 EDT 2014


     [ https://issues.jboss.org/browse/DROOLS-556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Winfried Umbrath updated DROOLS-556:
------------------------------------

    Description: 
To reproduce:

- in a decision table merge 2 cells with each other
- in the merged cell create a reference to another cell e.g. "=D21"

Result:
The value of the merged cell is parsed as "D21"

Expected result:
The value of the merged cell should be the same as the referenced one

The bug is in ExcelParser.processSheet. A quick fix is replacing 
{code:java}
Cell topLeft = sheet.getRow( merged.getFirstRow() ).getCell( merged.getFirstColumn() );
                    newCell( listeners,
                             i,
                             cellNum,
                             formatter.formatCellValue( topLeft ),
                             topLeft.getColumnIndex() );
{code}

with
{code:java}
if(topLeft.getCellType() == Cell.CELL_TYPE_FORMULA) {
                        newCell( listeners,
                             i,
                             cellNum,
                             formatter.formatCellValue( topLeft, formulaEvaluator ),
                             topLeft.getColumnIndex() );
                    } else {
                        newCell( listeners,
                             i,
                             cellNum,
                             formatter.formatCellValue( topLeft ),
                             topLeft.getColumnIndex() );
                    }
{code}

There are probably some more cases missing as numeric referenced values seem to still not be parsed properly.

  was:
To reproduce:

- in a decision table merge 2 cells with each other
- in the merged cell create a reference to another cell e.g. "=D21"

Result:
The value of the merged cell is parsed as "D21"

Expected result:
The value of the merged cell should be the same as the referenced one

The bug is in ExcelParser.processSheet. A quick fix is replacing 

Cell topLeft = sheet.getRow( merged.getFirstRow() ).getCell( merged.getFirstColumn() );
                    newCell( listeners,
                             i,
                             cellNum,
                             formatter.formatCellValue( topLeft ),
                             topLeft.getColumnIndex() );


with

if(topLeft.getCellType() == Cell.CELL_TYPE_FORMULA) {
                        newCell( listeners,
                             i,
                             cellNum,
                             formatter.formatCellValue( topLeft, formulaEvaluator ),
                             topLeft.getColumnIndex() );
                    } else {
                        newCell( listeners,
                             i,
                             cellNum,
                             formatter.formatCellValue( topLeft ),
                             topLeft.getColumnIndex() );
                    }


There are probably some more cases missing as numeric referenced values seem to still not be parsed properly.



> Merged cells referencing other cells not parsed correctly in decision tables
> ----------------------------------------------------------------------------
>
>                 Key: DROOLS-556
>                 URL: https://issues.jboss.org/browse/DROOLS-556
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 6.0.1.Final, 6.1.0.CR2
>            Reporter: Winfried Umbrath
>            Assignee: Mark Proctor
>
> To reproduce:
> - in a decision table merge 2 cells with each other
> - in the merged cell create a reference to another cell e.g. "=D21"
> Result:
> The value of the merged cell is parsed as "D21"
> Expected result:
> The value of the merged cell should be the same as the referenced one
> The bug is in ExcelParser.processSheet. A quick fix is replacing 
> {code:java}
> Cell topLeft = sheet.getRow( merged.getFirstRow() ).getCell( merged.getFirstColumn() );
>                     newCell( listeners,
>                              i,
>                              cellNum,
>                              formatter.formatCellValue( topLeft ),
>                              topLeft.getColumnIndex() );
> {code}
> with
> {code:java}
> if(topLeft.getCellType() == Cell.CELL_TYPE_FORMULA) {
>                         newCell( listeners,
>                              i,
>                              cellNum,
>                              formatter.formatCellValue( topLeft, formulaEvaluator ),
>                              topLeft.getColumnIndex() );
>                     } else {
>                         newCell( listeners,
>                              i,
>                              cellNum,
>                              formatter.formatCellValue( topLeft ),
>                              topLeft.getColumnIndex() );
>                     }
> {code}
> There are probably some more cases missing as numeric referenced values seem to still not be parsed properly.



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jboss-jira mailing list