I have the following code to read the custom properties of an XLS file
(pre-Office 2007):
// Open the Excel file
//
FileInputStream xlsFileStream = new FileInputStream(listFile[i]);
HSSFWorkbook wb = new HSSFWorkbook(xlsFileStream);
ExcelExtractor txex1 = new ExcelExtractor(wb);
// Extract the custom properties from the workbook
//
DocumentSummaryInformation dsi = txex1.getDocSummaryInformation();
CustomProperties properties = dsi.getCustomProperties();
if (properties != null)
{
Object prop = properties.get("My Property");
if (prop != null)
{
myProperty = prop.toString();
}
}
But now I need to enhance this to read the same properties from an XLSM
file (Office 2007+)
// Open the Excel file
//
FileInputStream xlsFileStream = new FileInputStream(listFile[i]);
XSSFWorkbook wb = new XSSFWorkbook(xlsFileStream);
XSSFExcelExtractor txex1 = new XSSFExcelExtractor(wb);
// Extract the custom properties from the workbook
//
DocumentSummaryInformation dsi = txex1.getDocSummaryInformation();
CustomProperties properties = dsi.getCustomProperties();
if (properties != null)
{
Object prop = properties.get("My Property");
if (prop != null)
{
myProperty = prop.toString();
}
}
But the XSSLExcelExtractor does not have a method to retrieve the Document
Summary info. Am I missing something fundamental about the differences in
the pre-2007 and post 2007 office files?