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

Free Support Forum - aspose.com

Copy Formula from a cell to another with updated references without the source cell attribute like locked

I’m using Aspose Cells with .net Core.

I would like to copy a cell formula to another cell and update the cells references in the formula with its new “location”.

If I use the cell.copy it’s working but It’s copy also the cell attributes, like ‘locked’.

Is there way around it? Like when using MS-Excel and you do a “Special Paste Formula Only”


Aspose.Cells follows MS Excel standards and specifications. When you do perform the task in MS Excel manually, it also copies the cell’s attribute (“Locked” attribute is checked in “Protection” tab in “Format Cells…” dialog).

Yes, Aspose.Cells also supports this paste special option but it won’t help either (via MS Excel or Aspose.Cells) for your needs.
Sample code:

Cells cells = workbook.Worksheets[0].Cells;
Range cell_source = cells.CreateRange("B1");
Range d_cell = cells.CreateRange("D1");
PasteOptions options = new PasteOptions();
options.PasteType = PasteType.Formulas;
d_cell.Copy(cell_source, options);
1 Like

Thanks! That’s what I needed!


Good to know that your issue is sorted out now. In the event of further queries or issue, feel free to write us back.

1 Like