Return-Path: X-Original-To: apmail-poi-user-archive@www.apache.org Delivered-To: apmail-poi-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5D6279E75 for ; Wed, 20 Jun 2012 13:13:03 +0000 (UTC) Received: (qmail 87904 invoked by uid 500); 20 Jun 2012 13:13:02 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 87872 invoked by uid 500); 20 Jun 2012 13:13:02 -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 87863 invoked by uid 99); 20 Jun 2012 13:13:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jun 2012 13:13:02 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of pdsalgado@gmail.com designates 209.85.220.174 as permitted sender) Received: from [209.85.220.174] (HELO mail-vc0-f174.google.com) (209.85.220.174) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jun 2012 13:12:56 +0000 Received: by vcbf11 with SMTP id f11so5017819vcb.33 for ; Wed, 20 Jun 2012 06:12:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=jq0whQMlOzI/J1Rc5k5cA16iwb5IH1HCStSlM4HxL7Q=; b=wwYRUeZ4z7ol9e80VEOUIgS0uSeXjQVpiq2S8KHuu09egsMdTPrkhxUoUps1EirQui /zbJ0C6z1aolzXu+s6ZoTso5/4sjtuf/FVK97xP/Xc7Hko/o4jYi9AXR7E1VsMS/JKs8 efjMGspzCqZETHcf0PO3qz/tsX6PJVlWrNNsvCP0dg0Y1xwgWFjYwfJsij3zb8ZeoEk8 G4/0DeuSHRBxCvSstcKcHtFceUdFQJxDtftdpZSmeyE+S+j07mR+D7FYAGEfI4+LqqTO zYgpapGhh3uMiJLxHl+Ub6jHEpjY6vQX8kvG3+Rm2RHOh18hhGLQk5fvo5k0xVMdUgis OwZA== MIME-Version: 1.0 Received: by 10.52.69.237 with SMTP id h13mr9581945vdu.82.1340197955732; Wed, 20 Jun 2012 06:12:35 -0700 (PDT) Received: by 10.52.64.134 with HTTP; Wed, 20 Jun 2012 06:12:35 -0700 (PDT) Date: Wed, 20 Jun 2012 10:12:35 -0300 Message-ID: Subject: How to insert footer to doc file From: "Pablo D. Salgado" To: user@poi.apache.org Content-Type: multipart/alternative; boundary=20cf307c9fbc14854504c2e7271d X-Virus-Checked: Checked by ClamAV on apache.org --20cf307c9fbc14854504c2e7271d Content-Type: text/plain; charset=ISO-8859-1 Hello, I'm Pablo, this is my first question here. I need to add a text to a footer section on an existing .doc file. (I have no experience on POI with doc files) I tried the following code: POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("sample.doc")); HWPFDocument doc = new HWPFDocument(fs); WordExtractor we = new WordExtractor(doc); HeaderStories headerStories = new HeaderStories(doc); Range rangeO = headerStories.getOddFooterSubrange(); rangeO.insertAfter("Footer text from POI"); FileOutputStream newdoc = new FileOutputStream("output.doc"); doc.write(newdoc); newdoc.close(); But the text "Footer text from POI" is not inserted on the footer section, it is inserted on the end of the document body. I'm using POI 3.8 and I'm opening the output.doc using Office 2010 on Windows machine. Thank you in advance, Regards, Pablo --20cf307c9fbc14854504c2e7271d--