Lots of hyperlinks make saving really slow


#1

Hi,

We’re evaluating Aspose.Excel for use in our web application.

as an example, i have a table with about 7000 rows and about 5 or 6 columns, 2 of which are Urls. I’d like to make these URLs clickable, hwoever, when I use Hyperlinks.Add() on each cell, it makes saving the file extremely slow (>20 sec).

If i don’t add hyperlinks, saving takes only a second or so.

Is there a different way I should be doing this? 20 seconds is unacceptable for a 3-4MB file.

Thanks,
Rob


#2

Hi Rob,

Could you please post your sample code here? I use the following test code and it only takes about 6-7 seconds.

DateTime start = DateTime.Now;

Excel excel = new Excel();
Worksheet sheet = excel.Worksheets[0];

for(int i = 0; i < 7000; i ++)
{
for(int j = 0; j < 3; j ++)
{
sheet.Hyperlinks.Add(i, j, 1, 1, "www.aspose" + i.ToString() + ".com");
}
}
excel.Save("d:\\book1.xls");

DateTime end = DateTime.Now;
TimeSpan span = end - start;

Console.WriteLine(span.TotalSeconds);


#3

Hi Laurence, here it is. I just timed this it took 24 seconds.
I’m not using a template.

I have basically the same code as you do…i’m not sure what could be the trouble.
Any ideas?

Thanks for your help!
Rob


// File is an Aspose.Excel object
Worksheet w = File.Worksheets[File.Worksheets.Add()];

for (int i = 0; i < 7000; i++)

{

for (int j = 0; j < 3; j++)

{

w.Hyperlinks.Add(i, j, 1, 1, “http://www.mytesturl.com?param1=” + i + “&param2=” + j);

}

}

File.Save(@“c:\test2.xls”);

#4

Hi Laurence,

I’d just like to add that your sample runs fine in about 8 seconds on my machine.

I just tried using your sample directly but changing only the line

w.Hyperlinks.Add(i, j, 1, 1, “http://www.mytesturl.com?param1=” + i + “&param2=” + j);

to make the url a little longer. that’s when the time jumps to 24 seconds!


very strange Smile


#5

Please try v3.3 at www.aspose.com/downloads. It doubled the speed at least.