Free Support Forum -

Aspose.Cells extending formulas

Hello there,

I have a question regarding the formulas in Aspose.Cells. In Microsft Excel if we place a formula in a cell, we can then drag it to the adjacent ones and the formula will adapt it self to the new ranges automatically (unless we use the tag $ but that’s not relevant for now). I was wondering if there is a way to do this in Aspose.Cells. I.e., I have a worksheet with a row containing the default formulas for a specific table. Programatically, I want to insert rows in that table, preserving those formulas in each new row but in such a way that they can adapt to their new ranges.

I hope I made myself clear…

Is there a way to do this?


Hi Cruz,

Thanks for considering Aspose.

Well, Yes, Aspose.Cells component works much like the same way as Excel does. When you insert, delete, copy rows/columns or insert ranges of cells, the formulas will be updated with their new ranges accordingly.

Following are some methods of Aspose.Cells.Cells class which can be used for your requirement:

For inserting rows/columns you may use -> Cells.InsertRow(s) / InsertColumn

For deleting rows/columns, please try -> Cells.DeleteRow(s)/DeleteColumn

For copying rows/columns, kindly use -> Cells.CopyRow/CopyColumn

For inserting Ranges, use -> Cells.InsertRange

Thank you.

Thanks for the reply Amjad.

That was not really my question, but I already answered myself. :slight_smile: I was trying to do something that not even Excel does, so never mind my question :wink:

Thanks again