use of eu.ggnet.lucidcalc.SFormula in project dwoss by gg-net.
the class SFormulaTest method testFormulaError.
@Test
public void testFormulaError() {
SFormula[] formulas = { new SFormula(33, "+", 22, "//"), new SFormula(33, "+", 2, "/", 0), new SFormula(33, "+", 22, "/", Double.NaN), new SFormula(33, "+", 22), new SFormula(33, "+", 22) };
STable newTable = new STable();
newTable.add(new STableColumn("TestFormula", 10));
newTable.setModel(new STableModelList<>(formulas));
SBlock block = new SBlock();
block.add(new SFormula("SUMME(", newTable.getCellFirstRow(0), ":", newTable.getCellLastRow(0), ")"));
CCalcDocument cdoc = new TempCalcDocument();
cdoc.add(new CSheet("Sheet1", newTable, block));
File f = LucidCalc.createWriter(LucidCalc.Backend.XLS).write(cdoc);
f.delete();
// System.out.println(f.toURI());
// No assert needed. If Anything goes wrong in the write process, an exception would be thrown.
}
use of eu.ggnet.lucidcalc.SFormula in project dwoss by gg-net.
the class ReturnsExporter method createReturnsSummary.
/**
* Create the Summary Block at the End.
* <p/>
* @param table The Stable where all the data exist.
* @param startingDate the startnig date of the Report.
* @param endingDate the ending date of the Report.
* @return a SResult Block with the Summary.
*/
static ReturnsExporter.SResult createReturnsSummary(STable table, int amount) {
ReturnsExporter.SResult r = new ReturnsExporter.SResult();
r.block = new SBlock();
r.block.setFormat(new CFormat(CFormat.FontStyle.BOLD, Color.BLACK, Color.YELLOW, CFormat.HorizontalAlignment.RIGHT, new CBorder(Color.BLACK)));
r.sum1 = new SCell(new SFormula("SUMME(", amount, "*", 10, ")"), EURO);
r.sum2 = new SCell(amount);
r.block.add(r.sum1, r.sum2);
return r;
}
Aggregations