You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Dominik Stadler <do...@gmx.at> on 2015/01/02 22:39:20 UTC

Re: Xmlvalueoutofbounds exception while reading a value

Hi,

do you have a sample document that you can share?

Thanks... Dominik.

On Wed, Dec 31, 2014 at 12:27 PM, Perundevi <as...@gmail.com> wrote:
> Hi,
>
> If i read the value of page width like,
>
> document.getDocument().getBody().getSectPr().getPgSz().getW()
>
> It throws the XmlValueOutOfBounds Exception if the value is
>
> <w:pgSz w:w="12240.000" w:h="15840.000"/>
>
> How can i resolve this?
>
>
>
> --
> View this message in context: http://apache-poi.1045710.n5.nabble.com/Xmlvalueoutofbounds-exception-while-reading-a-value-tp5717541.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>

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


Re: Xmlvalueoutofbounds exception while reading a value

Posted by Dominik Stadler <do...@gmx.at>.
Sorry, seems this got lost in the emails.

The problem seems to be the "." in the width in the document. The spec says
this is an Integer, so the parsing functionality that POI generates out of
the specification applies a new BigInteger(s) on the value of the "W"
element, which fails with a NumberFormatException because it contains
decimal digits.

Unfortunately Word seems to handle this gracefully, although it is defined
differently in the Spec.

A workaround for now should be to get the document created without the
".000", I don't see an easy fix in POI as this happens deep inside the
XML-Parsing functionality provided by XmlBeans and generated code...

Another workaround could be to use the method
doc.getDocument().getBody().getSectPr().getPgSz().xgetW().getDomNode().getNodeValue()
instead which will take the XML-Fragment directly and extract the
string-value which you then can parse yourself.

Dominik.

On Thu, Feb 11, 2016 at 1:28 PM, Perundevi <as...@gmail.com> wrote:

> Any update on this?
>
>
>
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/Xmlvalueoutofbounds-exception-while-reading-a-value-tp5717541p5721923.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: Xmlvalueoutofbounds exception while reading a value

Posted by Perundevi <as...@gmail.com>.
Any update on this?



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Xmlvalueoutofbounds-exception-while-reading-a-value-tp5717541p5721923.html
Sent from the POI - User mailing list archive at Nabble.com.

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


Re: Xmlvalueoutofbounds exception while reading a value

Posted by Perundevi <as...@gmail.com>.
1418411574392.docx
<http://apache-poi.1045710.n5.nabble.com/file/n5717928/1418411574392.docx>  



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Xmlvalueoutofbounds-exception-while-reading-a-value-tp5717541p5717928.html
Sent from the POI - User mailing list archive at Nabble.com.

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