tags:

views:

206

answers:

1

Hi to every one.

i got requirement like,i created Excel sheet using POI.In that excel i have row one and row two,each row containg three cells with different value,like row two contains same.

how can i add the r0c0+r1c0+r2c0 value into a anothe cell.

is there any API for that.

if any come across the solution please help me.

A: 

With POI, you can use formulas in cells exactly like you would type then in Excel:

Row row4 = sheet.createRow(4);
Cell cell = row.createCell(1);

String cellsFrom_A1_to_A3 = "A1:A3";
cell.setCellFormula("SUM("+cellsFrom_A1_to_A3+")");

Cell cell2 = row.createCell(2);
cell2.setCellFormula("A1+A2");
True Soft