nc = new Number(0,3, 12);
ws.addCell(nc);
ws.setColumnView(2, 20);
WritableCellFormat wcf = new WritableCellFormat();
wcf.setAlignment(Alignment.RIGHT);
wcf.setWrap(true);
CellView cv = new CellView();
cv.setSize(25 * 256);
cv.setFormat(wcf);
ws.setColumnView(3, cv);
// Add in the formulas
Formula f = null;
Label l = null;
f = new Formula(2,0, "A1+A2");
ws.addCell(f);
l = new Label(3, 0, "a1+a2");
ws.addCell(l);
f = new Formula(2,1, "A2 * 3");
ws.addCell(f);
l = new Label(3,1, "A2 * 3");
ws.addCell(l);
f = new Formula(2,2, "A2+A1/2.5");
ws.addCell(f);
l = new Label(3,2, "A2+A1/2.5");
ws.addCell(l);
f = new Formula(2,3, "3+(a1+a2)/2.5");
ws.addCell(f);
l = new Label(3,3, "3+(a1+a2)/2.5");
ws.addCell(l);
f = new Formula(2,4, "(a1+a2)/2.5");
ws.addCell(f);
l = new Label(3,4, "(a1+a2)/2.5");
ws.addCell(l);
f = new Formula(2,5, "15+((a1+a2)/2.5)*17");
ws.addCell(f);
l = new Label(3,5, "15+((a1+a2)/2.5)*17");
ws.addCell(l);
f = new Formula(2, 6, "SUM(a1:a4)");
ws.addCell(f);
l = new Label(3, 6, "SUM(a1:a4)");
ws.addCell(l);
f = new Formula(2, 7, "SUM(a1:a4)/4");
ws.addCell(f);
l = new Label(3, 7, "SUM(a1:a4)/4");
ws.addCell(l);
f = new Formula(2, 8, "AVERAGE(A1:A4)");
ws.addCell(f);
l = new Label(3, 8, "AVERAGE(a1:a4)");
ws.addCell(l);
f = new Formula(2, 9, "MIN(5,4,1,2,3)");
ws.addCell(f);
l = new Label(3, 9, "MIN(5,4,1,2,3)");
ws.addCell(l);
f = new Formula(2, 10, "ROUND(3.14159265, 3)");
ws.addCell(f);
l = new Label(3, 10, "ROUND(3.14159265, 3)");
ws.addCell(l);
f = new Formula(2, 11, "MAX(SUM(A1:A2), A1*A2, POWER(A1, 2))");
ws.addCell(f);
l = new Label(3, 11, "MAX(SUM(A1:A2), A1*A2, POWER(A1, 2))");
ws.addCell(l);
f = new Formula(2,12, "IF(A2>A1, \"A2 bigger\", \"A1 bigger\")");
ws.addCell(f);
l = new Label(3,12, "IF(A2>A1, \"A2 bigger\", \"A1 bigger\")");
ws.addCell(l);
f = new Formula(2,13, "IF(A2<=A1, \"A2 smaller\", \"A1 smaller\")");
ws.addCell(f);
l = new Label(3,13, "IF(A2<=A1, \"A2 smaller\", \"A1 smaller\")");
ws.addCell(l);
f = new Formula(2,14, "IF(A3<=10, \"<= 10\")");
ws.addCell(f);
l = new Label(3,14, "IF(A3<=10, \"<= 10\")");
ws.addCell(l);
f = new Formula(2, 15, "SUM(1,2,3,4,5)");
ws.addCell(f);
l = new Label(3, 15, "SUM(1,2,3,4,5)");
ws.addCell(l);
f = new Formula(2, 16, "HYPERLINK(\"http://www.andykhan.com/jexcelapi\", \"JExcelApi Home Page\")");
ws.addCell(f);
l = new Label(3, 16, "HYPERLINK(\"http://www.andykhan.com/jexcelapi\", \"JExcelApi Home Page\")");
ws.addCell(l);
f = new Formula(2, 17, "3*4+5");
ws.addCell(f);
l = new Label(3, 17, "3*4+5");
ws.addCell(l);
f = new Formula(2, 18, "\"Plain text formula\"");
ws.addCell(f);
l = new Label(3, 18, "Plain text formula");
ws.addCell(l);
f = new Formula(2, 19, "SUM(a1,a2,-a3,a4)");
ws.addCell(f);
l = new Label(3, 19, "SUM(a1,a2,-a3,a4)");
ws.addCell(l);
f = new Formula(2, 20, "2*-(a1+a2)");
ws.addCell(f);
l = new Label(3, 20, "2*-(a1+a2)");
ws.addCell(l);
f = new Formula(2, 21, "'Number Formats'!B1/2");
ws.addCell(f);
l = new Label(3, 21, "'Number Formats'!B1/2");
ws.addCell(l);
f = new Formula(2, 22, "IF(F22=0, 0, F21/F22)");
ws.addCell(f);
l = new Label(3, 22, "IF(F22=0, 0, F21/F22)");
ws.addCell(l);
f = new Formula(2, 23, "RAND()");
ws.addCell(f);
l = new Label(3, 23, "RAND()");
ws.addCell(l);
StringBuffer buf = new StringBuffer();
buf.append("'");
buf.append(workbook.getSheet(0).getName());
buf.append("'!");
buf.append(CellReferenceHelper.getCellReference(9, 18));
buf.append("*25");
f = new Formula(2, 24, buf.toString());
ws.addCell(f);
l = new Label(3, 24, buf.toString());
ws.addCell(l);
wcf = new WritableCellFormat(DateFormats.DEFAULT);
f = new Formula(2, 25, "NOW()", wcf);
ws.addCell(f);
l = new Label(3, 25, "NOW()");
ws.addCell(l);