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!
Today I found out that all the office documents with the behaviour as described above in our system (A) originates from another system (B). I reviewed their source code and found out that they add a section with id D5CDD505-2E9C-101B-9397-08002B2CF9AE to the document in a way that for some documents creates the behaviour as described above. So, this is imho no bug in POI, it's a bug in the application where the document has been altered/created. Do you still want me to create an issue in bugzilla? I will ask the project team for system (B) to fix their implementation. FYI: Word automatically repairs the document and add section 0 to the document if it doesn't exist. thanks for your help regards Christer
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
