Bug 63761 - Custom metadata properties of XLS and DOC files are not deleted.
Summary: Custom metadata properties of XLS and DOC files are not deleted.
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HPSF (show other bugs)
Version: 4.0.x-dev
Hardware: PC All
: P2 regression (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-22 20:39 UTC by drejcab
Modified: 2019-09-23 17:05 UTC (History)
0 users



Attachments
Office 97 file with custom properties (26.00 KB, application/msword)
2019-09-22 20:39 UTC, drejcab
Details

Note You need to log in before you can comment on or make changes to this bug.
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,