We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Cells: Impossible to clear formula associated to a ListColumn object

I have the need to clear the CalculatedColumnFormula associated with some of the ListColumns belonging to an Excel ListObject.

It doesn’t seem to be there a method or a property I could use to accomplish this task.
Could you please tell me if there is a way to do so?
Here is a portion of code showing how I was thinking to use such feature:


Hi,


There is no such APIs in Aspose.Cells where you could directly clear your desired formula for the ListObject/ table. Well, you may try to use Find or Search options provided by Aspose.Cells for your desired task to look into the formula cells only, see the sample code below for your reference:
e.g
Sample code:


//We need to find the cell with Subtotal formula in column I

string strToFind = “=your formula string goes here”;


Cell foundCell = null;


FindOptions opts = new FindOptions();

opts.LookAtType = LookAtType.Contains;

opts.LookInType = LookInType.Formulas;


//Search the cell in the cells, you may also specify your desired range only to look for the formula


do

{

foundCell = worksheet.Cells.Find(strToFind, foundCell, opts);


if (foundCell == null)

break;


//Your code goes here.


} while (true);


Also, see the document for your complete reference here:
http://www.aspose.com/docs/display/cellsnet/Find+or+Search+Data

Hope, this helps a bit.

Thank you.

Thanks for the quick response,

I undestand your suggestion but I’m really interested in clearing just the CustomColumnFormula from the ListColumn object.
Alternatively I tried (assuming that the cells referred by each ListColumn are well known in my code), to clear the cells themselves from their values and formulae but still, when i resize the ListObject DataRange, formulae appear again.
By inspecting the excel document form inside its xml, I can see that my cells are actually without formulae (as I’ve cleared them successfully) and that the only formulae left are the ones stored in the CalculatedColumnFormula tag of ListColumn objects.
Isn’t it a bug?
Thanks in advance for the help!
Hi,

vdimarti:
.....but still, when i resize the ListObject DataRange, formulae appear again.
By inspecting the excel document form inside its xml, I can see that my cells are actually without formulae (as I've cleared them successfully) and that the only formulae left are the ones stored in the CalculatedColumnFormula tag of ListColumn objects.
Isn't it a bug?

Aspose.Cells works the same way as MS Excel does, so you may try to evaluate your issue on your end and manually perform the task (e.g clearing formulated cells etc.) and do the re-sizing of ListObject to check how it goes. If you still think it is an issue with Aspose.Cells and MS Excel behaves differently, kindly create a simple console demo application (runnable), zip it and post us here to show the issue, we will check it soon. Also attach your template Excel files if you have any.

Thank you.