Method main with 1 argument just run straight biffview against given
file
with 2 arguments where the second argument is "on" - run biffviewer
with hex dumps of records
with 2 arguments where the second argument is "bfd" just run a big fat
hex dump of the file...don't worry about biffviewing it at all
Define the system property poi.deserialize.escher
to turn on
deserialization of escher records.
try {
System.setProperty("poi.deserialize.escher", "true");
if (args.length == 0)
{
System.out.println( "Biff viewer needs a filename" );
}
else
{
BiffViewer viewer = new BiffViewer(args);
if ((args.length > 1) && args[1].equals("on")) {
viewer.setDump(true);
}
if ((args.length > 1) && args[1].equals("bfd")) {
POIFSFileSystem fs =
new POIFSFileSystem(new FileInputStream(args[0]));
InputStream stream =
fs.createDocumentInputStream("Workbook");
int size = stream.available();
byte[] data = new byte[size];
stream.read(data);
HexDump.dump(data, 0, System.out, 0);
} else {
viewer.run();
}
}
} catch (Exception e) {
e.printStackTrace();
}