https://issues.apache.org/bugzilla/show_bug.cgi?id=52912

             Bug #: 52912
           Summary: the custom properties write to documents visible from
                    Windows Explorer – but do not display in Office.
           Product: POI
           Version: 3.8-dev
          Platform: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: HPSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified


Created attachment 28468
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28468
sample document and screen shot related to this issue

When adding custom properties to a Microsoft Office Word 97 - 2003 document,
the properties are not displayed within office Word but visible with the
Windows Explorer. Custom means the properties displayed on the "Custom" tab in
the documents properties.

This used to be working perfectly in poi3.8.beta4. the issue is happening after
upgrading to poi3.8.beta5.

Here is the piece of code we are using to adding custom properties,
File doc1 = new File("test.dpc");
        POIFSFileSystem poifs = new POIFSFileSystem(new FileInputStream(doc1));
        DirectoryEntry dir = poifs.getRoot();
        DocumentEntry siEntry = (DocumentEntry)
dir.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
        DocumentEntry dsiEntry = (DocumentEntry)
dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);

        DocumentInputStream dis = new DocumentInputStream(siEntry);
        PropertySet ps = new PropertySet(dis);
        SummaryInformation si = new SummaryInformation(ps);
        dis = new DocumentInputStream(dsiEntry);
        ps = new PropertySet(dis);
        DocumentSummaryInformation dsi = new    DocumentSummaryInformation(ps);
        CustomProperties customProperties = dsi.getCustomProperties();
        if (customProperties == null)
            customProperties = new CustomProperties();
        customProperties.put("doc_repo_id", "123456789");

        // Save as our custom properties
        dsi.setCustomProperties(customProperties);
        si.write(dir, siEntry.getName());
        dsi.write(dir, dsiEntry.getName());

        File output = new File("C:\\tempoutput.doc");
        OutputStream out = new FileOutputStream(output);
        poifs.writeFilesystem(out);
        out.close();

Attached "Test write custom properties.doc", 
"properties invisible from office.PNG" and "properties visible from Windows
Explorer.PNG" to show this issue.

Same issue for excel document too refer to "Test write custom properties2.xls".

It seems the issue applies to all Microsoft Office Word 97 - 2003 document
only.
We tested Word format docx which is Office 2007 and Office 2010 and it worked.

Read more:
http://www.differencebetween.com/difference-between-doc-and-vs-docx-in-microsoft-word/#ixzz1p8xFycgr


This issue is critical because our office component is heavily using custom
properties to integrate with other application.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to