Free Support Forum -

Precendents calcul

Hi Aspose Team,

I have to generate a book with above 300 visibles sheets and a lot more non-visible sheets with calcul datas.

I wanted to know if it were possible to overwite cell’s formula with calculated value.

Generally, my calculs are =SUM(sheetN!A1:B1) or =sheetN!A1+sheetN!B1

Thanks you


Yes, I think you may try replace the formulas with their calculated values, see the sample code below:

Workbook workbook = new Workbook(@“e:\test\delrc\Sample.xlsx”);
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
int rows = cells.MaxDataRow;
int numberOfColumns = cells.MaxDataColumn;


//To Replace the sheet’s Cells Formulas with their calculated values.
for (int i = 0; i <= rows; i++)
for (int j = 0; j <= numberOfColumns; j++)
if (cells[i, j].IsFormula)
cells[i, j].PutValue(cells[i, j].StringValue, true);



Thank you.

Thank you, I’m gonna test it.