/** The reader is chosen from the format token, so any source works. */
private Workbook openFromStream() {
try {
return Workbook.open(new ByteArrayInputStream(readBook(BOOK)), "xlsx");
} catch (java.io.IOException e) {
throw new IllegalStateException("cannot open " + BOOK, e);
}
}
An existing xlsx file is read into the engine from an InputStream or directly from a
byte array. The reader is selected by the format token, so the same call accommodates a file on
disk, an upload and a blob column.
Opening is lazy, and no recalculation occurs until one is requested, which keeps inspection of a
large book inexpensive. The Inspect button traverses the sheets and writes their names and used
extents to a summary sheet, and the final button illustrates what changes once
recalculate has been invoked.