You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Rainer Klute <kl...@rainer-klute.de> on 2003/05/30 11:07:12 UTC

Re: HPSF (Was: Re: HDF)

>I just need to make a valid Word Document. Is it necessary that I should
>make & write the Summary & Doc Summary information streams also?

I don't know if you really need it. It depends on what Word does 
if you are trying to open a document which does not have a 
summary information stream. To minimize work you could try if 
you can get away without it, but don't be disappointed if that 
doesn't work.


>>But if you just want to create a valid M$
>>Word document and don't care about the contents of the summary
>>information stream, you could copy one from an existing Word
>>document using POIFS' functionality.
>
>How can I do this using POIFS functionality??

Here's a rough outline:

1. Read the bytes of a summary information stream from an 
existing Word document. You need the classes of the 
org.apache.poi.poifs.eventfilesystem package. Create a 
POIFSReader and register a POIFSReaderListener to be triggered 
on the file "\005SummaryInformation". In the processPOIFSReaderEv
ent method of the latter read all bytes from that stream. You 
don't need HPSF to do so since you are not interested in the 
meaning of the stream's contents.

2. Create your output file (POI filesystem). This is done with 
classes from the org.apache.poi.poifs.filesystem package.

2.1. Create a POIFSDocument instance.

2.2. Call the createDocument method of your POIFSDocument 
passing it an input stream containing the bytes you have read as 
described above.

2.3. Call createDocument for each other entry you need in the 
POI filesystem, especially the contents of the Word document.

2.4. Call POIFSDocument.writeFilesystem write the whole POI 
filesystem to disk.

Best regards
Rainer Klute

                           Rainer Klute IT-Consulting GmbH
  Dipl.-Inform.
  Rainer Klute             E-Mail:  klute@rainer-klute.de
  Körner Grund 24          Telefon: +49 172 2324824
D-44143 Dortmund           Telefax: +49 231 5349423