Free Support Forum -

Copy Range and Hyperlinks

Hello, I think I have found a problem with Hyperlinks and range copy.

I write an hyperlink in cell.
I copy a range containing this hyperlink

using :
Aspose.Cells.Range targetRange = leadsSheet.Cells.CreateRange(5, newfirstColumn - 1, 10, 4);

Then I add a new hyperlink in the corresponding cell in target sheet.

All in a loop. :

Here how it does :

on the first pass :

1 Hyper link

on the second pass :

3 Hyperlinks (2 are equals)

on the third pass :

6 Hyper links (4 are equals)


I think when it copies range, hyperlink are not well copied, and when adding new hyperlink it does not check if there is already an hyperlink already exists at the same adress.

Here in my loop, at 20 or 21 loop, I Have 66000 hyperlinks…

Please help.




Thanks for your posting and using Aspose.Cells.

I have tested this issue with the following sample code. The code copies the source range A1:A10 containing the hyperlinks to destination range B11:B20 and it copies the hyperlinks successfully.

I have tested this code with the latest version: Aspose.Cells
for .NET v8.5.0.2

I have attached the source excel file used in this code and the output excel file generated by it for your reference.


string filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;

Workbook workbook = new Workbook(filePath);

Worksheet worksheet = workbook.Worksheets[0];

Range srcRange = worksheet.Cells.CreateRange(“A1:A10”);

Range dstRange = worksheet.Cells.CreateRange(“B11:B20”);



Hello, I am trying to reproduce this error in a small project but it is working in this test solution. Here is the code giving me the problem :

if (currentcopyCounter < maxCopyCount)

var sourceRange = this.WorkBook.Worksheets.GetRangeByName(“FirstLeadsRange”);

var newfirstColumn = 3 + (4 * currentcopyCounter);
Aspose.Cells.Range targetRange = leadsSheet.Cells.CreateRange(5, newfirstColumn - 1, 10, 4);
leadsSheet.SetCellValue(newfirstColumn, 6, leadsSheetCode);
//Add a hyperlink to it.
var linkDestination = string.Format("{0}!A1", leadsSheetCode);

int index = leadsSheet.Hyperlinks.Add(
string.Format("{0}6", ConvertToLetter(newfirstColumn + 1)),
leadsSheet.Hyperlinks[index].TextToDisplay = “Show detail”;
leadsSheet.Hyperlinks[index].ScreenTip = “click this link to display source sheet”;

But everything is fine when I do not create hyperlink on the source range before copying it to next range, And creating Hyperlink on source range at the end of loop.


Thanks for your feedback and using Aspose.Cells.

Are you still getting the problem with the latest version: Aspose.Cells
for .NET v8.5.0.2
please give it a try and see how it goes at your end.

If your problem still occurs, then please provide us your sample console application project that should be runnable. The code you provided is not runnable and gives me compile time errors which should not be present so that we could run your code at our end and log it in our database if it is a bug and fix it in our next versions.

Thanks for your cooperation.