You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Jochen Wiedmann <jo...@gmail.com> on 2011/04/19 16:11:26 UTC

Conditional format handling: Formula doesn't change between cells

Hi,

I am currently trying to create an Excel file with conditional
handling. In order to achieve my purpose, I started creating a piece
of code, that reads an existing Excel file and prints out what it
finds. My code writes, in particular:

  CellRange: org.apache.poi.ss.util.CellRangeAddress [D4:O32]
  formula1 = AND($B1<=A$3,$C1>=A$3)
  formula2 = null
  comparisonOperation = 0
  conditionType = 2

As a next step I wrote a piece of code, which creates a sheet with a
conditional format by invoking

  HSSFSheetConditionalFormatting.createConditionalFormattingRule(String)

passing the argument "AND($B1<=A$3,$C1>=A$3)".

When I inspect the created Excel file, then I notice an important
difference to my original file:

- The file created with POI shows the formula "AND($B1<=A$3,$C1>=A$3)"
for any cell.
- The original file adjusts the formula, depending on the cell. For
example, it shows "AND($B4<=D$3,$C4>=D$3)" in cell "D4".

Any ideas what I might be doing wrong?


Thanks in advance,

Jochen




-- 
I Am What I Am And That's All What I Yam (Popeye)

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


Re: Conditional format handling: Formula doesn't change between cells

Posted by Jochen Wiedmann <jo...@gmail.com>.
I have now filed Bug 51089 in order to attach files which allow to
reproduce the issue.

See https://issues.apache.org/bugzilla/show_bug.cgi?id=51089

On Tue, Apr 19, 2011 at 4:11 PM, Jochen Wiedmann
<jo...@gmail.com> wrote:
> Hi,
>
> I am currently trying to create an Excel file with conditional
> handling. In order to achieve my purpose, I started creating a piece
> of code, that reads an existing Excel file and prints out what it
> finds. My code writes, in particular:
>
>  CellRange: org.apache.poi.ss.util.CellRangeAddress [D4:O32]
>  formula1 = AND($B1<=A$3,$C1>=A$3)
>  formula2 = null
>  comparisonOperation = 0
>  conditionType = 2
>
> As a next step I wrote a piece of code, which creates a sheet with a
> conditional format by invoking
>
>  HSSFSheetConditionalFormatting.createConditionalFormattingRule(String)
>
> passing the argument "AND($B1<=A$3,$C1>=A$3)".
>
> When I inspect the created Excel file, then I notice an important
> difference to my original file:
>
> - The file created with POI shows the formula "AND($B1<=A$3,$C1>=A$3)"
> for any cell.
> - The original file adjusts the formula, depending on the cell. For
> example, it shows "AND($B4<=D$3,$C4>=D$3)" in cell "D4".
>
> Any ideas what I might be doing wrong?
>
>
> Thanks in advance,
>
> Jochen
>
>
>
>
> --
> I Am What I Am And That's All What I Yam (Popeye)
>



-- 
I Am What I Am And That's All What I Yam (Popeye)

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