the formula in cell

Technical support for Spire.XLS

Moderators: iceblue support, Flash, Manager

the formula in cell

Postby ted » Wed Jan 26, 2011 6:25 am

In Excel worksheet, data is almost generated by formula. I want to get the formulas in cell so that I can edit them to my desired.
My query is how to display the formula that is hidden in cell with Spire.XLS?
Posts: 7
Joined: Tue Dec 21, 2010 9:01 am

Re: the formula in cell

Postby iceblue support » Wed Jan 26, 2011 9:22 am

Thank you for your inquiry!
First we write a formula for a cell, and then we use sheet.Range.Text = sheet.Range.Formula method to write the formula. Following is the code:
Code: Select all
string currentFormula = string.Empty;
currentFormula = "=AVERAGE(Sheet1!$D$3:G$3)";
sheet.Range[1, 2].Formula = currentFormula;
sheet.Range[2, 2].Text = sheet.Range[1, 2].Formula;
e-iceblue support
User avatar
iceblue support
Posts: 244
Joined: Tue Dec 21, 2010 2:56 am

Return to Spire.XLS

Who is online

Users browsing this forum: No registered users and 0 guests