At 11:40 19.01.2007, Rainer Klute wrote:
>hasiasat schrieb:
>> Error getting property set with name â£DocumentSummaryInformation
>> java.io.FileNotFoundException: no such entry:
>> "â£DocumentSummaryInformation"
>> Error getting property set with name â£SummaryInformation
>> java.io.FileNotFoundException: no such entry: "â£SummaryInformation"
>>
>
>The property sets DocumentSummaryInformation and SummaryInformation do
>not belong to the Word document as such. You have to create them using
>POI's HPSF component, see <http://jakarta.apache.org/poi/hpsf/> for
>details. I don't know whether HWPF has any functionalities to
>encapsulate the HPSF stuff for you.
HWPFDocument is a subclass of POIDocument. That has readProperties() and
writeProperties(...). readProperties() is called already, but upon a write
the writeProperties is missing. To fix it add a line at the end of the
function HWPFDocument.write(...) as shown below:
public void write(OutputStream out) throws IOException
{
...
// spit out the Word document.
POIFSFileSystem pfs = new POIFSFileSystem();
pfs.createDocument(new ByteArrayInputStream(mainBuf), "WordDocument");
pfs.createDocument(new ByteArrayInputStream(tableBuf), "1Table");
pfs.createDocument(new ByteArrayInputStream(dataBuf), "Data");
// write the properties:
writeProperties(pfs); // <-- insert this
pfs.writeFilesystem(out);
}
That should do it.
Best wishes,
Rainer
--
Rainer Schwarze
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/