I'm getting:
java.io.IOException: Invalid header signature; read
0x000201060000FFFE, expected 0xE11AB1A1E011CFD0
when trying to add some custom properties to an Excel document using apache POI HPSF.
I'm completely sure the file is Excel OLE2 (not HTML, XML or something else that Excel doesn't complain about).
This is a relevant part of my code:
try {
final POIFSFileSystem poifs = new POIFSFileSystem(event.getStream());
final DirectoryEntry dir = poifs.getRoot();
final DocumentEntry dsiEntry = (DocumentEntry)
dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
final DocumentInputStream dis = new DocumentInputStream(dsiEntry);
final PropertySet props = new PropertySet(dis);
dis.close();
dsi = new DocumentSummaryInformation(props);
}
catch (Exception ex) {
throw new RuntimeException
("Cannot create POI SummaryInformation for event: " + event +
", path:" + event.getPath() +
", name:" + event.getPath() +
", cause:" + ex);
}
I get the same error when trying with word and power point files (also OLE2).
I'm completely out of ideas so any help/pointers are greatly appreciated :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…