use of org.apache.poi.ooxml.POIXMLProperties in project ecms by exoplatform.
the class ApachePOIMetadataPlugin method updateMetadata.
/**
* {@inheritDoc}
*/
@Override
public InputStream updateMetadata(String extension, InputStream source, Date created, String creator, String language) throws IOException, DocumentExtensionNotSupportedException {
File tempFile = File.createTempFile("editor-document", ".tmp");
try (POIXMLDocument document = getDocument(source, extension);
FileOutputStream fos = new FileOutputStream(tempFile)) {
updateDocLanguage(document, extension, language);
POIXMLProperties props = document.getProperties();
POIXMLProperties.CoreProperties coreProps = props.getCoreProperties();
coreProps.setCreator(creator);
coreProps.getUnderlyingProperties().setLanguageProperty(language);
coreProps.setCreated(metadataFormat.format(created));
document.write(fos);
}
return new DeleteOnCloseFileInputStream(tempFile);
}
Aggregations