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 699D0200C73 for ; Wed, 10 May 2017 09:06:45 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6898F160BB4; Wed, 10 May 2017 07:06:45 +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 88552160BA8 for ; Wed, 10 May 2017 09:06:44 +0200 (CEST) Received: (qmail 99066 invoked by uid 500); 10 May 2017 07:06:43 -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 99054 invoked by uid 99); 10 May 2017 07:06:43 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 May 2017 07:06:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id AC63A1812EA for ; Wed, 10 May 2017 07:06:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.632 X-Spam-Level: X-Spam-Status: No, score=-0.632 tagged_above=-999 required=6.31 tests=[DC_IMAGE_SPAM_HTML=0.141, DC_IMAGE_SPAM_TEXT=0.123, DC_PNG_UNO_LARGO=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.796, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id bHUAtGtLO3I5 for ; Wed, 10 May 2017 07:06:40 +0000 (UTC) Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com [209.85.128.175]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 1AAC55F642 for ; Wed, 10 May 2017 07:06:40 +0000 (UTC) Received: by mail-wr0-f175.google.com with SMTP id l9so30032553wre.1 for ; Wed, 10 May 2017 00:06:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=BWpAK+ciweyvgAizvBgTbEOXdddsCkl4c4KDvYgQ3kY=; b=XQCIlV+wflSHR8z3OmzoGparMKnY+SmEoSnXUQxCkj+W/sBa9fVkXC8lnz8UNYR+De y8t/+fLsBvah3I37TyKpRbU3yvn7RRWsunhT9cqsYl3hdkMrysTlzW0RZfhxScrk/sDx zlngc1c40TMC+Z+7Jud3oyiij/AHd2vhIBdbI6hXYa/4RCq2AMmdMWw74O7QHMYkbZ1/ N2iuRtGHBaeHsLPeCYumSf6K3P8dfAQi4GZlc1Y2pnCRSfFHFOSTQ+AEHz2mJxTxjaiw zbXG5CObnJcYpu9slaIxmJPy25Da8M3+Vkt8HOoYMoWneHxporSTR98VMr/15HcajbuZ mZdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=BWpAK+ciweyvgAizvBgTbEOXdddsCkl4c4KDvYgQ3kY=; b=kPEIbFmfc54e5c5SEl7cI5B/+l87xObvBOx0IwFnu3j4NBIbxVpTQlnIDWD/L/NZYB QpJKE1z2eUdgBkvj2BTOcM246qgoTjshe9NgXx3IvKq3TRJst6ANC7PuhKS3s5HtZIXu qOlwN0W3us7cnhZF1GFf2/AtyEjQr0UTPzVp7QsDYN/lb6Rbk72UohAZg2GyFGhQ4OQd J373uAqSMrfNqWX9slB+BIJ4nK7l6D2Run1eIff0x6pztrF6T7/Uc2A/jjuzn26BLLga Qq0fBKGnH5HMYApaCfKKhEQeirb1GCJHgl/LnD98OwE8ho6pv0fft+9QfqTj8GiotyPf 2Sug== X-Gm-Message-State: AODbwcAUP7A6UnDk37xk1Z759WNih7YT+6OwBasd1bMcCISKrpQJSr9C W0cDGwOoSpI+dZeEuF3ovHjIlSVvnXOt X-Received: by 10.80.141.18 with SMTP id s18mr2993798eds.75.1494399999664; Wed, 10 May 2017 00:06:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.151.50 with HTTP; Wed, 10 May 2017 00:06:39 -0700 (PDT) From: Ramani Routray Date: Wed, 10 May 2017 00:06:39 -0700 Message-ID: Subject: Java (Apache POI) : How to retrieve comment/annotation and associated highlighted text from Microsoft Word? To: user@poi.apache.org Content-Type: multipart/mixed; boundary=94eb2c1a903421ff2f054f261d72 archived-at: Wed, 10 May 2017 07:06:45 -0000 --94eb2c1a903421ff2f054f261d72 Content-Type: multipart/alternative; boundary=94eb2c1a903421ff2b054f261d70 --94eb2c1a903421ff2b054f261d70 Content-Type: text/plain; charset=UTF-8 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 --94eb2c1a903421ff2b054f261d70 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I have a Microsoft word (.docx) file and trying to re= trieve the comments and it's associated highlighted text. Can you pls h= elp.

Attaching picture of the sample word document and the java code for=20 extracting the comments. [ A file with a line "My name is John". = The=20 word "John" is highlighted with a comment "Noun" ]

I am able to extract the comments (Noun, Adjective). I would like to=20 extract the highlighted text associated with the comment from the word docu= ment "Noun" (Noun =3D John,=20 Adjective =3D great)


FileInputStream fis =3D <=
span class=3D"gmail-kwd">new FileInputStream(new File(msWordFilePath));=

    XWPFDocument adoc =3D new XWPFDocument(fis);
    XWPFWordExtractor xwe =3D new XWPFWordExtractor(adoc);
    XWPFComment[] comments =3D adoc.getComments();


    for(<=
/span>int idx=3D0<=
span class=3D"gmail-pun">; idx < comments=
.length; idx++)
    {
        MSWordAnnotation annot =3D new MSWordAnnotation();
        annot.setAnnotationName(comments[idx].getId());
        annot.setAnnotationValue(comments[idx].getText());
        aList.add(=
annot);


    }

regards,
Ramani
--94eb2c1a903421ff2b054f261d70-- --94eb2c1a903421ff2f054f261d72 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org --94eb2c1a903421ff2f054f261d72--