poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hashem <hashem.bakt...@gmail.com>
Subject Re: How to read the value of bookmarks? (docx)
Date Thu, 30 Aug 2012 17:49:17 GMT
I am utilizing this new code, just found that the replace method needs a
small change to keep the node's style. After we make sure nextNode is not a
bookmarkEnd we push it to stack, so push should be done in "else stmt" not
before "if stmt". 
 


        while (bookmarkStartID != bookmarkEndID) {
            nextNode = nextNode.getNextSibling();
            //This line should be commented ---> nodeStack.push(nextNode);
            // and the else after if should be uncommented!

            if (nextNode.getNodeName().contains(Bookmark.BOOKMARK_END_TAG))
{
                try {
                    bookmarkEndID = Integer.parseInt(
                            nextNode.getAttributes().getNamedItem(
                            Bookmark.BOOKMARK_ID_ATTR_NAME).getNodeValue());
                } catch (NumberFormatException nfe) {
                    bookmarkEndID = bookmarkStartID;
                }
            }
            else {
                nodeStack.push(nextNode);
            }
        } 



-----
Regards,
Hashem
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-read-the-value-of-bookmarks-docx-tp5710184p5710816.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


Mime
View raw message