-
Notifications
You must be signed in to change notification settings - Fork 5
Formula Calculation Engine
shoaibkhan-aspose edited this page Jun 20, 2014
·
2 revisions
//Instantiating a Workbook object
Workbook book = new Workbook();
//Obtaining the reference of the newly added worksheet
int sheetIndex = book.getWorksheets().add();
Worksheet worksheet = book.getWorksheets().get(sheetIndex);
Cells cells = worksheet.getCells();
Cell cell = null;
//Adding a value to "A1" cell
cell = cells.get("A1");
cell.setValue(1);
//Adding a value to "A2" cell
cell = cells.get("A2");
cell.setValue(2);
//Adding a value to "A3" cell
cell = cells.get("A3");
cell.setValue(3);
//Adding a SUM formula to "A4" cell
cell = cells.get("A4");
cell.setFormula("=SUM(A1:A3)");
//Calculating the results of formulas
book.calculateFormula();
//Saving the Excel file
book.save("data/AsposeFormulaEngine.xls");
Download Source Code
For further releases and updates, please follow these new repositories:
- Aspose.Words Java for Apache POI
- Aspose.Cells Java for Apache POI
- Aspose.Slides Java for Apache POI
- Aspose.Email Java for Apache POI
- For documentation, please visit Aspose Docs.
- Raise your queries and suggest more examples via Aspose Forums or via new social coding sites.