Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CF01A200C73 for ; Wed, 10 May 2017 09:18:42 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CE18F160BB4; Wed, 10 May 2017 07:18:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 21A59160BA8 for ; Wed, 10 May 2017 09:18:41 +0200 (CEST) Received: (qmail 21756 invoked by uid 500); 10 May 2017 07:18:41 -0000 Mailing-List: contact user-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Users List" Delivered-To: mailing list user@poi.apache.org Received: (qmail 21745 invoked by uid 99); 10 May 2017 07:18:41 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 May 2017 07:18:41 +0000 Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id E824F1A00A2 for ; Wed, 10 May 2017 07:18:40 +0000 (UTC) Received: by mail-oi0-f50.google.com with SMTP id l18so26119290oig.2 for ; Wed, 10 May 2017 00:18:40 -0700 (PDT) X-Gm-Message-State: AODbwcC/BBAcY88oI7lXnMfMGaWlA/GfG8jhMFJiIswBtP+eSJkV+9kW 50YuNcrFcCuUZdE293gSyx4S8Jk6TQ== X-Received: by 10.157.42.111 with SMTP id t102mr1716252ota.123.1494400720188; Wed, 10 May 2017 00:18:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.11.241 with HTTP; Wed, 10 May 2017 00:17:59 -0700 (PDT) In-Reply-To: References: From: "Javen O'Neal" Date: Wed, 10 May 2017 00:17:59 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Java (Apache POI) : How to retrieve comment/annotation and associated highlighted text from Microsoft Word? To: POI Users List Content-Type: text/plain; charset=UTF-8 archived-at: Wed, 10 May 2017 07:18:43 -0000 Ramani, Please see my responses from your previous email on the dev@poi.apache.org mailing list. Make sure you're subscribed to a mailing list before sending a message to it so that your messages don't get dropped by the moderator system and so that you can receive the responses. https://lists.apache.org/thread.html/3e048af8e7c8adaa0d234913b061adbfbd5896e2cba71b78031ec3ac@%3Cdev.poi.apache.org%3E On Wed, May 10, 2017 at 12:06 AM, Ramani Routray wrote: > I have a Microsoft word (.docx) file and trying to retrieve the comments and > it's associated highlighted text. Can you pls help. > > Attaching picture of the sample word document and the java code for > extracting the comments. [ A file with a line "My name is John". The word > "John" is highlighted with a comment "Noun" ] > > I am able to extract the comments (Noun, Adjective). I would like to extract > the highlighted text associated with the comment from the word document > "Noun" (Noun = John, Adjective = great) > > > FileInputStream fis = new FileInputStream(new File(msWordFilePath)); > XWPFDocument adoc = new XWPFDocument(fis); > XWPFWordExtractor xwe = new XWPFWordExtractor(adoc); > XWPFComment[] comments = adoc.getComments(); > > > for(int idx=0; idx < comments.length; idx++) > { > MSWordAnnotation annot = new MSWordAnnotation(); > annot.setAnnotationName(comments[idx].getId()); > annot.setAnnotationValue(comments[idx].getText()); > aList.add(annot); > > > } > > > regards, > Ramani > > > --------------------------------------------------------------------- > 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