Beskow, Christer schrieb:
> I'm using POIFS to read and write CustomProperties to the 
> DocumentSummaryInformation.
> Some word documents only contain a section with formatId 
> D5CDD505-2E9C-101B-9397-08002B2CF9AE, which is the second id in 
> SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID. 
> When I try to create an instance of DocumentSummaryInformation , method 
> isDocumentSummaryInformation in PropertySet returns false, as it only 
> compares the formatId of the section with the first id. This results in a 
> org.apache.poi.hpsf.UnexpectedPropertySetTypeException: Not a 
> org.apache.poi.hpsf.DocumentSummaryInformation.
>
>
> Is it safe to alter the code so that isDocumentSummaryInformation() also 
> returns true if the id is D5CDD505-2E9C-101B-9397-08002B2CF9AE instead of 
> D5CDD502-2E9C-101B-9397-08002B2CF9AE?
>   

Hm, good question! Regarding to the official documentation from
Microsoft at
<http://msdn.microsoft.com/en-us/library/aa379840(VS.85).aspx> and
especially the remarks about 'The DocumentSummaryInformation and
UserDefined property set', I'd say that the second section cannot exist
without the first section. Therefore my first answer is: No, it is not
safe to alter the code as you described.

On the other hand, it might be a good idea to make HPSF more
fault-tolerant so that it accepts a DocumentSummaryInformation property
set that only consists of the second section and inserts an empty first
section while reading the property set.

Please file an extension request under
<https://issues.apache.org/bugzilla/> and provide a sample document with
only the second section!

Best regards
Rainer Klute

                           Rainer Klute IT-Consulting
  Dipl.-Inform.
  Rainer Klute             E-Mail: [EMAIL PROTECTED]
  Körner Grund 24          Phone:  +49 231 5349423
D-44143 Dortmund           Mobile: +49 172 2324824

OpenPGP fingerprint: E4E4386515EE0BED5C162FBB5343461584B5A42E


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to