Hi I need to replace all hyperlinks in the slides of the powerpoint. for example if the URL starts with www.abc.123.com
then it should be www.xyz.123.com
I am able to do it for the files with .ppt extension using the code
Aspose.Slides.Link.SetExternalHyperlink(newURl)
but for my files with pptx and pptm extension I am able to fetch the URL by using the code
portion.PortionFormat.HLinkClick.ExternalUrl, but I am not able set it as the ExternalUrl is a readonly property.
Please let me know how can it be done for the the PPTX and PPTM files. I am creating the ppt object by using the following code.
PresentationEx ppt = new PresentationEx(s)
Hi Anshuman,
Thank you for your interest in Aspose.Slides.
I have observed your comments and like to request you to please try using following sample code on your end and then share your kind feedback with us. Also, I have attached the source and generated presentation for your kind reference.
Presentation pres = new Presentation(@"D:\hyperlink.pptx");
List<String> HypLinks = new List<String>();
//Get an Array of TextFrame objects from the first slide
ITextFrame[] textFramesSlideOne = Aspose.Slides.Util.SlideUtil.GetAllTextBoxes(pres.Slides[0]);
//Loop through the Array of TextFrames
for (int i = 0; i < textFramesSlideOne.Length; i++)
//Loop through paragraphs in current TextFrame
foreach (Paragraph para in textFramesSlideOne[i].Paragraphs)
//Loop through portions in the current Paragraph
foreach (Portion port in para.Portions)
{
if (port.PortionFormat.AsIHyperlinkContainer.HyperlinkClick != null)
{
HypLinks.Add(port.PortionFormat.AsIHyperlinkContainer.HyperlinkClick.ExternalUrl);
port.PortionFormat.HyperlinkManager.SetExternalHyperlinkClick("customURL.com");
port.Text = "customtext";
}
}
pres.Save("D:\\hyperlinkURL.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
I hope this will be helpful. Please share if I may help you further in this regard.
Best Regards,