When changing a hyperlink it is not changed until the text is changed. See code below and the attached very simple PowerPoint file. When only the link is changed, it is not actually changed. The text needs to be changed as well (open bug2.pptx and edit hyperlink to see).
I need to be able to change the link without having to change the link text. Can you give me a workaround until you have a bug fix ready?
I need to be able to change the link without having to change the link text. Can you give me a workaround until you have a bug fix ready?
public static void Bug()
{
var path = @"c:\temp\bug.pptx";
var doc = new Presentation(path);
var shape = doc.Slides[0].Shapes[0];
ITextFrame textFrame = ((AutoShape)shape).TextFrame;
var portion = textFrame.Paragraphs[0].Portions[0];
portion.PortionFormat.HyperlinkManager.SetExternalHyperlinkClick(@"www.bing.com");
//uncomment the following line to have the link change take effect
// portion.Text += " ";
path = path.Replace(@"bug", @"bug2");
doc.Save(path, SaveFormat.Pptx);
}