Hi,

I have a requirement to create a Document by replacing the bookmarks with
text. I am trying to acheive this by creating a new document and i am trying
to keep the same paragraphs in new document like this.

docDoc = new XWPFDocument(new FileInputStream(f));
            result = new XWPFDocument(new FileInputStream(n));
            List<XWPFParagraph> paragraphs = docDoc.getParagraphs();
            Map bookmarkValues = new HashMap();
            List<XWPFParagraph> targetParaGraph = new
ArrayList<XWPFParagraph>();
            for (int i = 0; i < paragraphs.size(); i++) {
                try {

                    XWPFParagraph tempPara = result.createParagraph();
                    int paraIndex  = result.getPosOfParagraph(tempPara);
                    result.setParagraph(paragraphs.get(i), paraIndex);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }


Then, i found that XWPFParagraph doesnt implement equals method.

Can we have any equals method or clone method to acheieve this. If i can
take this task then i will.

And i am doing it in a wrong way, please correct me.

And guide me if there is any alternate way.

I kept this post in Developer list because i want to contribute to both code
and documentation to poi DOC family.

Reply via email to