/**
* The server side. Styles, number formats, formulas and a calculated total
* are all applied by Axyra, with no involvement from the browser.
*/
private Workbook axyraBuilds() {
Workbook wb = Workbook.create();
Sheet sheet = wb.createSheet("Shared");
sheet.range("A1:C1").setValues(new CellValue[][] { {
CellValue.text("Item"), CellValue.text("Qty"), CellValue.text("Amount") } });
sheet.range("A1:C1").setStyle(CellStyle.builder()
.bold().fontColor(Color.WHITE)
.fill(Color.rgb(0x1F, 0x4E, 0x79)).build());
String[] items = { "Widget", "Gadget", "Sprocket", "Flange" };
double[] qty = { 12, 4, 30, 7 };
double[] amount = { 239.88, 178.00, 66.00, 56.35 };
for (int i = 0; i < items.length; i++) {
sheet.cell(i + 1, 0).setValue(CellValue.text(items[i]));
sheet.setNumber(i + 1, 1, qty[i]);
sheet.setNumber(i + 1, 2, amount[i]);
}
sheet.cell(5, 0).setValue(CellValue.text("Total"));
sheet.cell(5, 2).setFormula("SUM(C2:C5)");
sheet.range("A6:C6").setStyle(CellStyle.builder().bold().build());
sheet.range(1, 2, 5, 2).setStyle(CellStyle.builder()
.numberFormat("#,##0.00")
.allBorders(BorderStyle.HAIR, Color.rgb(0xBF, 0xBF, 0xBF)).build());
sheet.cell(8, 0).setValue(CellValue.text(
"Built by Axyra on the server. The browser is only rendering it."));
sheet.setColumnWidth(0, 18);
sheet.setColumnWidth(2, 14);
wb.recalculate();
return wb;
}Keikai Spreadsheet is an interactive spreadsheet UI for the browser. Axyra Sheets is a headless spreadsheet engine for the server. The two interoperate through xlsx: Axyra constructs and calculates a workbook, transfers it as bytes, and Keikai renders and edits it. Every other page in this application already relies on that arrangement; here the boundary between them is the subject.
The second button drives Keikai's own API against the book on screen, writing into cells that Axyra produced. The total remains an Axyra formula and Keikai recalculates it, demonstrating two independent engines agreeing on the semantics of the sheet.
The third button completes the round trip. Keikai exports the edited book, Axyra opens the bytes and records what it now reads, so the browser-side edit can be observed arriving back on the server. The fourth reports which features the file carries between the two engines. The file is the contract: what the Excel format can represent is what crosses the boundary.
The Axyra developer reference documents the server-side API, and Axyra vs Keikai compares the two products and sets out which one a given requirement calls for.