Return-Path: Delivered-To: apmail-poi-user-archive@www.apache.org Received: (qmail 5816 invoked from network); 25 Jan 2010 07:58:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Jan 2010 07:58:47 -0000 Received: (qmail 5206 invoked by uid 500); 25 Jan 2010 07:58:47 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 5165 invoked by uid 500); 25 Jan 2010 07:58:47 -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 5155 invoked by uid 99); 25 Jan 2010 07:58:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jan 2010 07:58:47 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [193.186.16.13] (HELO sauxb.salomon.at) (193.186.16.13) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jan 2010 07:58:37 +0000 Received: from servex01.wamas.com (servex01.salomon.at [172.28.2.2]) by sauxb.salomon.at (8.12.10/8.12.10) with ESMTP id o0P7wGaI026607 for ; Mon, 25 Jan 2010 08:58:17 +0100 (MET) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: AW: Microsoft Word error after opening previous generated doc file Date: Mon, 25 Jan 2010 08:58:15 +0100 Message-ID: <18597F2B47F1394A9B309945EC72411202848E5A@servex01.wamas.com> In-Reply-To: <18597F2B47F1394A9B309945EC72411202848E4F@servex01.wamas.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Microsoft Word error after opening previous generated doc file Thread-Index: Acqbb4NwKEFrUfY7Q6+OnM0t9X5k2ACIWdBAAADE2yA= References: <18597F2B47F1394A9B309945EC724112028023FC@servex01.wamas.com> <27273998.post@talk.nabble.com> <18597F2B47F1394A9B309945EC72411202848E4F@servex01.wamas.com> From: "Doppelhofer Andreas" To: "POI Users List" X-Scanned-By: MIMEDefang 2.54 on 172.28.2.13 X-Virus-Checked: Checked by ClamAV on apache.org I tried this sample with 3.2 of poi and it works!!=20 Only this works... > 2) Right click @ explorer -> Create new Word Document... ->=20 > open file and save it (filesize 24kb) > -----Urspr=FCngliche Nachricht----- > Von: Doppelhofer Andreas [mailto:Andreas.Doppelhofer@salomon.at]=20 > Gesendet: Montag, 25. Januar 2010 08:51 > An: POI Users List > Betreff: AW: Microsoft Word error after opening previous=20 > generated doc file >=20 > I used this sample to get started with HWPF but this sample=20 > creates an corrupt doc file. > I tried 2 way's creating an empty.doc (both doesnt work at the end) >=20 > 1) Right click @ explorer -> Create new Word Document..=20 > (filesize 11kb) > Then execute app, after opening the new doc no text in it,=20 > but file seems to be ok.=20 > 2) Right click @ explorer -> Create new Word Document... ->=20 > open file and save it (filesize 24kb) > Then execute app, open new file, text exists in doc=20 > without style info, trying to edit/select something, word "hangs" >=20 > What do i wrong, or is this a bug? I tried this sample with=20 > 3.5 and 3.6 of poi but no difference, both create corrupt files... >=20 > Thx dops >=20 > > -----Urspr=FCngliche Nachricht----- > > Von: MSB [mailto:markbrdsly@tiscali.co.uk] > > Gesendet: Freitag, 22. Januar 2010 15:30 > > An: user@poi.apache.org > > Betreff: Re: Microsoft Word error after opening previous=20 > generated doc=20 > > file > >=20 > >=20 > > Well, one thought is that you are trying to insert a CharacterRun=20 > > rather than a Paragraph object. Have a look at this=20 > example, I seem to=20 > > remember that it worked successfully; > >=20 > > http://faq.javaranch.com/java/CreateWordDocument > >=20 > > Remember Andreas that HWPF is very immature and if you try=20 > to use it=20 > > for anything really complex it may well fail you. For=20 > example, I have=20 > > run into problems setting more than one attribute for a=20 > CharacterRun;=20 > > it is possible to set the text emboldened or underlined but=20 > not both.=20 > > Would you be willing to contribute toward developing HWPF?=20 > If so, then=20 > > visit this page http://poi.apache.org/hwpf/index.html and see about=20 > > becoming involved please. > >=20 > > Yours > >=20 > > Mark B > >=20 > >=20 > > Doppelhofer Andreas wrote: > > >=20 > > > Hi all, > > > Following code creates a new doc file from an existing > > empty doc file. > > > The generation terminates without error, but after=20 > opening the new=20 > > > "sample2.doc" file with Microsoft Word (2003 SP3) and trying to=20 > > > edit/add/remove the text, Microsoft Word ist getting "no > > response" and > > > the only way to close Word is to kill it from Task Manager. > > > I tried to open the file with OpenOffice (3.1) and there > > only the "H" > > > from "Hello World!" is displayed. In OpenOffice i can=20 > add/remove...=20 > > > some text. > > >=20 > > > What's the error? I'm using poi-bin-3.6-20091214 on Windows. The=20 > > > "empty.doc" file is a doc file without any text or=20 > something in it. > > > Just "create new file" and save it. > > >=20 > > > Thx dops > > >=20 > > > -- > > > public static void main(String[] args) throws IOException { > > >=20 > > > File file =3D new File("empty.doc"); > > > POIFSFileSystem fs1 =3D new POIFSFileSystem(new > > FileInputStream(file)); > > > HWPFDocument doc =3D new HWPFDocument(fs1); > > >=20 > > > Range range =3D doc.getRange(); > > > CharacterRun run =3D range.insertAfter("Hello World!"); > > >=20 > > > OutputStream out =3D new FileOutputStream(new=20 > File("sample2.doc"));=20 > > > doc.write(out); out.flush(); out.close(); > > >=20 > > > } > > > -- >=20 > --=20 >=20 >=20 > Salomon Automation GmbH - Friesachstrasse 15 - A-8114=20 > Friesach bei Graz Sitz der Gesellschaft: Friesach bei Graz=20 > UID-NR:ATU28654300 - Firmenbuchnummer: 49324 K > Firmenbuchgericht: Landesgericht f=FCr Zivilrechtssachen Graz >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For=20 > additional commands, e-mail: user-help@poi.apache.org >=20 >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org