poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Burch <apa...@gagravarr.org>
Subject Re: Reading (not writing) conditional states: possible?
Date Wed, 24 Feb 2016 22:42:58 GMT
On Wed, 24 Feb 2016, Blake Watson wrote:
> So, there's lots of examples on how to write out conditional stuff to 
> Excel files.

If you look at the unit tests, you'll see quite a few examples of reading 
conditional formatting too

> But I've got an Excel workbook with some conditional cells in it already,
> and I want to know how to format those cells.

Ah. That's not reading, that's evaluating! The state isn't written in the 
file, unlike with formulas, the application just has to calculate it on 
the fly

> Do I have to go through all the conditions that might apply and do it that
> way?

Yup! Sadly. You'll need to take account of priorites too, in case several 
apply.

I think that Vaadin might have some code to do some of this. I've been 
unable to get in touch anyone from the project to ask about contributing 
it back though[1] :(

Ideally we would have code in POI that would evaluate it. We already have 
code that can handle colours in data format strings (eg 
"[red]#,###.##;[green]-#,###.##") and tell you what colour the cell would 
be from that. That code would likely need to be generalised then 
conditional formatting support added. There's a few TODOs in the code to 
give an idea of the starting point.

Nick

[1] I've tried emailing the person listed in the Javadocs as being the 
author of the vaadin conditional formatting stuff, but never got any sort 
of reply

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


Mime
View raw message