Bug 63761

Summary: Custom metadata properties of XLS and DOC files are not deleted.
Product: POI Reporter: drejcab
Component: HPSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: regression    
Priority: P2    
Version: 4.0.x-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Office 97 file with custom properties

Description drejcab 2019-09-22 20:39:06 UTC
Created attachment 36791 [details]
Office 97 file with custom properties

For Office 97 files, it allows you to add custom properties but does not allow you to delete all custom properties.

Attached code to remove all custom properties:

InputStream is = new FileInputStream(new File("C:\test\CustomProperties.doc"));
POIFSFileSystem poifs = new POIFSFileSystem(is);
is.close();

DirectoryEntry dir = poifs.getRoot();
HPSFPropertiesOnlyDocument dis = new HPSFPropertiesOnlyDocument(poifs);
DocumentSummaryInformation dsi = dis.getDocumentSummaryInformation();

//Remove all Custom Properties
dsi.setCustomProperties(new CustomProperties());

dsi.write(dir, DocumentSummaryInformation.DEFAULT_STREAM_NAME);
si.write(dir, SummaryInformation.DEFAULT_STREAM_NAME);

OutputStream out = new FileOutputStream("C:\test\CustomProperties_2.doc");
poifs.writeFilesystem(out);
out.close();

In version 3.15 it worked correctly.
I need this functionality before moving on to version 4.10
Comment 1 Andreas Beeker 2019-09-22 21:34:45 UTC
Does DocumentSummaryInformation.removeCustomProperties() work for your usecase?
Comment 2 drejcab 2019-09-23 17:05:41 UTC
(In reply to Andreas Beeker from comment #1)
> Does DocumentSummaryInformation.removeCustomProperties() work for your
> usecase?

ok, DocumentSummaryInformation.removeCustomProperties () works correctly.

Regards,