Bug 36111 - HPFS does not properly write custom properties to documents
Summary: HPFS does not properly write custom properties to documents
Status: RESOLVED LATER
Alias: None
Product: POI
Classification: Unclassified
Component: HPSF (show other bugs)
Version: 3.0-dev
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-10 10:12 UTC by Sven Billen
Modified: 2006-02-03 15:03 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Billen 2005-08-10 10:12:17 UTC
When adding custom properties to a MS Word 2000 document, the properties are not
displayed within Word nor the Windows Explorer. Custom means the properties
displayed on the "Custom" tab in the documents properties.

Comparing properties created with MS Word to HPFS with the
ReadCustomPropertySets demo results in some differences shown below.

HPFS created properties:

Property set stream "\DocumentSummaryInformation":
(Section 0 does not differ)

 Section 1:
      Format ID: 00000000 D5 CD D5 02 2E 9C 10 1B 93 97 08 00 2B 2C F9 AE
............+,..

      No. of properties: 3
      Property ID: 0, type: 0, value: {2=info}
      Property ID: 1, type: 2, value: 1252
      Property ID: 2, type: 30, value: Hello World


MS Word created properties:

Property set stream "\DocumentSummaryInformation":

   Section 1:
      Format ID: 00000000 D5 CD D5 05 2E 9C 10 1B 93 97 08 00 2B 2C F9 AE
............+,..

      No. of properties: 4
      Property ID: 0, type: 0, value: {2=info}
      Property ID: 1, type: 2, value: 65001
      Property ID: -2147483648, type: 19, value: [B@b6ece5
      Property ID: 2, type: 30, value: Hello World

This only occurs if the document has never had any custom properties before.

Sample documents can be found under

http://www.mathematik.uni-marburg.de/~billen/hpfsSample.zip

For more information see the thread "Problem adding custom information to
documents" on the POI users mailinglist.
Comment 1 Daniel Andefors 2005-08-10 17:41:17 UTC
The Format ID of the second section is wrong.
Comment 2 Sven Billen 2005-08-12 09:23:50 UTC
(In reply to comment #1)
> The Format ID of the second section is wrong.

This ID is created by MS Word. Therefore it should not be wrong.
What would be the right ID for that section?
Comment 3 Daniel Andefors 2005-08-12 14:13:24 UTC
What I meant was that the Format ID of the second section within the
DocumentSummaryInformation property set stream in the file edited with HPSF is
wrong. I'm not sure exactly how you are using the HPSF API but if you can fix
your code to use the correct Format ID for this section I'm sure your trouble
will go away.
Comment 4 Sven Billen 2005-08-15 09:39:30 UTC
hmm ... I've set the ID to SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID. I just
took a look at the source of org.apache.poi.hpsf.wellknown.SectionIDMap and saw
that DOCUMENT_SUMMARY_INFORMATION_ID has the wrong value. I changed
DOCUMENT_SUMMARY_INFORMATION_ID[3] to 0x05 and everything worked fine.
Thanks for that hint.
Comment 5 Rainer Klute 2006-02-04 00:03:06 UTC
I added the format ID of the second DocumentSummaryInformation stream to
org.apache.poi.hpsf.wellknown.SectionIDMap in a way that
DOCUMENT_SUMMARY_INFORMATION_ID is no longer a byte[] but a byte[][] instead
with DOCUMENT_SUMMARY_INFORMATION_ID[0] being the format ID of the first section
and DOCUMENT_SUMMARY_INFORMATION_ID[1] being the format ID of the second section.

Beware that this is an incompatible change and will break applications that use
DOCUMENT_SUMMARY_INFORMATION_ID. All uses of DOCUMENT_SUMMARY_INFORMATION_ID
must be replaced my DOCUMENT_SUMMARY_INFORMATION_ID[0].

However, I won't submit this change not right now but together with some more
changes I have on my schedule.