Well, i have resolved this isssue, but i'm sure that there are an easy way to 
get Watermak.

        XWPFHeader firstPageHeader = hfPolicy.getDefaultHeader();
        List<XWPFParagraph> listParagraph = firstPageHeader.getListParagraph();
        for(XWPFParagraph p:listParagraph){
                List<CTSdtRun> sdtList = p.getCTP().getSdtList();
                for (CTSdtRun std: sdtList ){
            List<CTR> rList = std.getSdtContent().getRList();
                    for (CTR r: rList ){
                        List<CTPicture> pictList = r.getPictList();
                        for (CTPicture pic: pictList ){
                            NodeList childNodes = 
pic.getDomNode().getChildNodes();
                                for (int node=0; node < childNodes.getLength(); 
node++){
                                                Node item = 
childNodes.item(node);
                                    if (item.getNodeName().equals("v:shape") ){
                                            NamedNodeMap attributes = 
item.getAttributes();
                                            if 
(attributes.getNamedItem("id").getNodeValue().contains("PowerPlusWaterMark")){
                                                    NodeList childNodes1 = 
item.getChildNodes();
                                                for (int node1=0; node1 < 
childNodes1.getLength(); node1++){
                                                        Node item2 = 
childNodes1.item(node1);
                                                        if 
(item2.getNodeName().equals("v:textpath") ){
                                        NamedNodeMap attributes2 = 
item2.getAttributes();
                                            
                                        System.out.println("Watermak: 
"+attributes2.getNamedItem("string").getNodeValue());
                                            
                                    }
                                }
                                
                            }
                                
                        }
                    }
                }
            }
                
        }
    }
  

-----Mensaje original-----
De: Rodríguez Ortega, Alejandro [mailto:[email protected]] 
Enviado el: miércoles, 22 de julio de 2015 10:40
Para: POI Users List
Asunto: [POI] Read Watermark from XWPFDocument

Hi, I' m using POI api in order to read docx, xlsx and pptx files from 
students, with the intention of correct it. I never write in this files I only 
read it.

I have some question about specific topics:

I have seen  in  XWPFHeaderFooterPolicy the createWatermak method, Are there 
some way to retrieve the watermark from XWPFDocument?

I have been looking in 
http://opensourcejavaphp.net/java/poi/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java.html

And also I have tried extract methods from: 
http://www.massapi.com/source/manual/OLAT-6_3_3-PUBLIC-20100823/olat3/webapp/WEB-INF/src/org/olat/search/service/document/file/WordOOXMLDocument.java.html#104

But without any positive result. Any suggestion will be welcome.

Regards!

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to