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

Free Support Forum - aspose.com

SetExternalHyperlinkClick does not change the link

Hi

I wrote the following code in order to replace every link in the presentation to “http://google.com”, it seems that the SetExternalHyperlinkClick replace only the first link with the new one but not the second one in the presentation:

string url = “http://google.com”;
Presentation presentation = new Presentation(@“C:\Users\tali\Desktop\http.pptx”);
var hyperLinksCollection = presentation.HyperlinkQueries.GetAnyHyperlinks();
foreach (IHyperlinkContainer link in hyperLinksCollection)
{
if (link.HyperlinkClick != null)
{
if (link.HyperlinkClick.ExternalUrl != null)
{
link.HyperlinkManager.SetExternalHyperlinkClick(url);
}
}
if (link.HyperlinkMouseOver != null)
{
if (link.HyperlinkMouseOver.ExternalUrl != null)
{
link.HyperlinkManager.SetExternalHyperlinkMouseOver(url);
}
}
}
foreach (var slide in presentation.Slides)
{
foreach (var shape in slide.Shapes)
{
ITable table = shape as ITable;
if (table != null)
{
int cols = table.Columns.Count;
int rows = table.Rows.Count;
for (int i = 0; i < cols; i++)
for (int j = 0; j < rows; j++)
{
var hyperLinksShapesCollection = table[i,j].TextFrame.HyperlinkQueries.GetAnyHyperlinks();
foreach (IHyperlinkContainer link in hyperLinksShapesCollection)
{
if (link.HyperlinkClick != null)
{
if (link.HyperlinkClick.ExternalUrl != null)
{
link.HyperlinkManager.SetExternalHyperlinkClick(url);
}
}
if (link.HyperlinkMouseOver != null)
{
if (link.HyperlinkMouseOver.ExternalUrl != null)
{
link.HyperlinkManager.SetExternalHyperlinkMouseOver(url);
}
}
}
}
}
}
}

presentation.Save(@“C:\Users\tali\Desktop\http1111.pptx”, SaveFormat.Pptx);


Please advise.

Hi Oren,


Can you please share which Aspose.Slides version you are using on your end, so that we can help you out.

Best Regards,

Version 16.9.0.0

Waiting to your solution.

Thanks
Oren

Hi Oren,


Can you please use Aspose.Slides latest version on your end. Please share feedback with us if there is still an issue.

Best Regards,

Hi

The issue is still there. Please try the code I sent you .

Thanks

Hi Oren,

I have worked with the sample code and source presentation shared by you. I have been able to generate the presentation successfully with both hyperlinks getting changed in saved presentation. For your kind reference, I have attached the generated presentation. Can you please check the attached presentation on your end and share any issue in it. If there is still an issue then please share the snapshot displaying the issue so that we may get to know what actually is issue on your end.

Many Thanks,

Hi

I checked the presentation you sent and it does not work either. In my code I am changing every link to google.com. In the generated presentation, please try to click on the www.yahoo.com text. It takes you to www.yahoo.com and not to google.com. If you click on www.ynet.co.il it takes you to www.google.com. It is onlt working on the title and not on the body.

Please see attached image.

Thanks


Hi Oren,

I have observed the issue shared by you and have been able to observe the issue specified. An issue with ID SLIDESNET-38212 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESNET-38212) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.