You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Daniel Noll <da...@nuix.com.au> on 2006/03/28 07:32:17 UTC
UnsupportedOperationException thrown from formula code (due to percentage
in formula)
I was getting an unexpected UnsupportedOperationException thrown when
creating a workbook from a certain document.
Digging through a debugger I eventually tracked it down to being thrown
from Ptg.java, line 330:
//retval = new UnknownPtg();
throw new java.lang.UnsupportedOperationException(
Integer.toHexString(( int ) id) + " (" + ( int ) id + ")");
What I want to know is why that code which is commented out wasn't left
in. It seems bad to throw an exception just because some kind of
formula isn't understood, so I'm tempted to change it back, but is there
a risk if I revert that code back to the original?
I suppose the other alternative is implementing a Ptg class for ID 0x14.
This appears to be the formula element used when you have a percentage
in a cell formula (e.g. =D4 * 9%).
Daniel
--
Daniel Noll
Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia Ph: +61 2 9280 0699
Web: http://www.nuix.com.au/ Fax: +61 2 9212 6902
This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: UnsupportedOperationException thrown from formula code (due to percentage in formula)
Posted by Avik Sengupta <av...@itellix.com>.
Unlike records, whose header contains the record size, a PTG's size has to be
inferred from what kind of a ptg it is. therefore, if we do not understand a
ptg, we cannot process the subsequent stream. The commented out code is
therefore completely incorrect, and will result in a scrambled output in some
way.
the best way to solve this is therefore to implement the ptg that is missing.
If it is the percentage ptg, should be simple to implement.
Regards
-
Avik
On Tuesday 28 March 2006 11:02, Daniel Noll wrote:
> I was getting an unexpected UnsupportedOperationException thrown when
> creating a workbook from a certain document.
>
> Digging through a debugger I eventually tracked it down to being thrown
> from Ptg.java, line 330:
>
> //retval = new UnknownPtg();
> throw new java.lang.UnsupportedOperationException(
> Integer.toHexString(( int ) id) + " (" + ( int ) id + ")");
>
> What I want to know is why that code which is commented out wasn't left
> in. It seems bad to throw an exception just because some kind of
> formula isn't understood, so I'm tempted to change it back, but is there
> a risk if I revert that code back to the original?
>
> I suppose the other alternative is implementing a Ptg class for ID 0x14.
> This appears to be the formula element used when you have a percentage
> in a cell formula (e.g. =D4 * 9%).
>
> Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/