Free Support Forum - aspose.com

Copy cell with hyperlinks

I tried to copy a cell which contains a hyperlin to another cell but i loses the link functionality

first i tried
_currentWorksheet.Cells[0, i].Value = _currentWorksheet.Cells[0, i + 1].Value;
but this only copied the value as expected i guess…

then i tried:

_currentWorksheet.Cells[0, i].Copy(_currentWorksheet.Cells[0, i + 1]);

now the formatting stays but not the link functionality…

how should i make a copy of a cell with a hyperlink?

regards

@Pietswieb,

Thanks for your query.

Could you try to use Range.Copy() method for your task. For example, you may create a source range based on the cell. Create destination range. Now copy the source range to destination range. See the sample code segment for your reference:
e.g
Sample code:

    .............
     Range range = cells.CreateRange("A1");
                Range dRange = cells.CreateRange("A10");
                dRange.Copy(range);
    ..........

Let us know if you still find any issue.

yea that worked…

thanks

@Pietswieb,

Good to know that your issue is sorted out by the suggested lines of code. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.