We are editing the custom properties of a document as mentioned in the below 
code,

      FileInputStream fis = new FileInputStream(sourceFile);
        POIFSFileSystem fileSystem = new POIFSFileSystem(fis);
        fis.close();
        DirectoryEntry entry = fileSystem.getRoot();
        
        DocumentEntry siEntry = (DocumentEntry) 
entry.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
        DocumentInputStream dis = new DocumentInputStream(siEntry);
        PropertySet isPropertySet = new PropertySet(dis);
        dis.close();
        SummaryInformation si = new SummaryInformation(isPropertySet);
        
        DocumentEntry dsiEntry = (DocumentEntry) 
entry.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
        DocumentInputStream ddis = new DocumentInputStream(dsiEntry);
        PropertySet disPropertySet = new PropertySet(ddis);
        ddis.close();
        DocumentSummaryInformation dsi = new 
DocumentSummaryInformation(disPropertySet);
        CustomProperties properties = dsi.getCustomProperties();
        if(properties == null) {
            properties = new CustomProperties();
        }
        properties.put("ImgdDocumentOraseq", "47384378");
        dsi.setCustomProperties(properties);
        si.setAuthor("RD");
        si.setComments("78787877");
        si.write(entry, SummaryInformation.DEFAULT_STREAM_NAME);
        dsi.write(entry, DocumentSummaryInformation.DEFAULT_STREAM_NAME);
        FileOutputStream os = new FileOutputStream(sourceFile);
        fileSystem.writeFilesystem(os);
        os.close();

It works fine for .doc, .xls and .ppt files, but i am not able to implement the 
same functionality for .docx, .xlsx and .ppts files.

Please let me know your comments regarding the same.

Thanks & Regards,
Rahul Dev Vardhan
Disclaimer :- This e-mail and any attachment may contain confidential, 
proprietary or legally privileged information. If you are not the original 
intended recipient and have erroneously received this message, you are 
prohibited from using, copying, altering or disclosing the content of this 
message. Please delete it immediately and notify the sender. Newgen Software 
Technologies Ltd (NSTL)  accepts no responsibilities for loss or damage arising 
from the use of the information transmitted by this email including damages 
from virus and further acknowledges that no binding nature of the message shall 
be implied or assumed unless the sender does so expressly with due authority of 
NSTL.


Reply via email to