I'm trying to find a way to get the Author of the Excel file that is uploaded. Once the Upload button is clicked, all I can see is the 'byte[] contents' and I'm confused to find a way to find the author of the uploaded file. I was getting the NoPropertySetStreamException when I run the below code.
public static Map<String, Boolean> validateFileSize(MultipartActionRequest request,
List<String> appCaseId) {
if (PortletFileUpload.isMultipartContent(request)) {
Map<String, List<MultipartFile>> multipartFiles;
multipartFiles = request.getMultiFileMap();
if (multipartFiles != null && !multipartFiles.isEmpty()) {
for ( List<MultipartFile> multipartFilesList : multipartFiles.values()) {
for ( MultipartFile item : multipartFilesList) {
byte[] contents;
try {
contents = item.getBytes();
try {
SummaryInformation si = (SummaryInformation)
PropertySetFactory.create(item.getInputStream());
si.getLastAuthor();
} catch (NoPropertySetStreamException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MarkUnsupportedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException ioe) {
}