Formula Generation - Exporting Values ONLY


#1

i am considering purchasing this product but i need to know if i will be able to save an excel file with ONLY the values, not the excel formulas that generated the values.

to be clear, i want to create a template that has formulas in it, put additional values into certain cells, and then save the entire thing as a spreadsheet with VALUES only, no formulas.

is this possible?


#2

Yes. It's possible.

You can try the following code:

Excel excel = new Excel();

excel.Open(templateFile);

excel.CalculateFormula(true);

for(int i = 0; i < excel.Worksheets.Count; i++)

{

Worksheet sheet = excel.WorksheetsIdea [I];

for(int j = 0; j < sheet.Cells.Count; j ++)

{

Cell cell = sheet.Cells[j];

if(cell.IsFormula)

{

cell.PutValue(cell.Value);

}

}

However, there are some limitations:

1. Addin functions, VBA functions are not supported. So if some cells contain these functions, their value will not be updated.

2. Not all Excel built-in functions are supported. You can check the support list at http://www.aspose.com/Products/Aspose.Excel/Api/Aspose.Excel.Excel.CalculateFormula1.html .

If some functions are not supported, their values may not be updated.