JCalc > Tutorial > Calculate a cell, range or sheet

The following example shows you how to recalculate only a single cell, a range or one worksheet instead of the whole workbook. Pass a reference to CalcSession.calculate, or pass the Worksheet object itself.

The reference is one or more comma separated areas. All of these are valid:

An area with no sheet name refers to the first worksheet, unless a sheet of that name exists.

Whatever the referenced formulas depend on is calculated too, across sheets, and written back. Cells that depend on them are not: they keep their cached values. A targeted run therefore answers "what are these cells worth" rather than refreshing the whole workbook before a save — use calculate(workbook) for that. The calculated cell count, failed cell count and volatile cells of the result describe the calculated cells only.

The same overloads exist for OpenDocument spreadsheets: pass a com.independentsoft.office.odf.Spreadsheet and a reference, or a com.independentsoft.office.odf.Table.

Need help? Ask our developers: