poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doppelhofer Andreas" <Andreas.Doppelho...@salomon.at>
Subject AW: Microsoft Word error after opening previous generated doc file
Date Fri, 22 Jan 2010 09:06:23 GMT
Any idea? 

> -----Ursprüngliche Nachricht-----
> Von: Doppelhofer Andreas [mailto:Andreas.Doppelhofer@salomon.at] 
> Gesendet: Dienstag, 19. Januar 2010 13:49
> An: user@poi.apache.org
> Betreff: Microsoft Word error after opening previous 
> generated doc file
> 
> Hi all,
> Following code creates a new doc file from an existing empty doc file.
> The generation terminates without error, but after opening 
> the new "sample2.doc" file with Microsoft Word (2003 SP3) and 
> trying to 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 
> add/remove... some text.
> 
> What's the error? I'm using poi-bin-3.6-20091214 on Windows. 
> The "empty.doc" file is a doc file without any text or 
> something in it. Just "create new file" and save it.
> 
> Thx dops
> 
> --
> public static void main(String[] args) throws IOException {
> 
>  File file = new File("empty.doc");
>  POIFSFileSystem fs1 = new POIFSFileSystem(new 
> FileInputStream(file));  HWPFDocument doc = new HWPFDocument(fs1);
> 
>  Range range = doc.getRange();
>  CharacterRun run = range.insertAfter("Hello World!");
> 
>  OutputStream out = new FileOutputStream(new 
> File("sample2.doc"));  doc.write(out);  out.flush();  out.close();
> 
> }
> --

-- 


Salomon Automation GmbH - Friesachstrasse 15 - A-8114 Friesach bei Graz
Sitz der Gesellschaft: Friesach bei Graz
UID-NR:ATU28654300 - Firmenbuchnummer: 49324 K
Firmenbuchgericht: Landesgericht für Zivilrechtssachen Graz


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message