I am developing with C# application to create a PowerPoint presentation.
I am using the OpenXML SDK 2.0 and MS Office PP 2007.
I am able to clone my slides from my template and add a new shape on it.
But now i want to add a Hyperlink to my shape.
How can i do this?
I found this: tutorial but i need to add those hyperlinks at runtime.
I already tried this.
SlidePart currentSlidePart = CloneSlidePart(presentationPart, slidePart);
Slide s = currentSlidePart.Slide;
currentSlidePart.AddHyperlinkRelationship(new System.Uri("myuri", System.UriKind.Absolute), true, "rId2");
Then i called the method to create the shape:
s.CommonSlideData.ShapeTree.Append(generateTextShape("some content", shape));
And this is the method:
public static Shape generateTextShape(String input, ShapePosition shapePosition)
{
Shape shape1 = new Shape();
...
D.HyperlinkOnClick hyperlinkOnClick1 = new D.HyperlinkOnClick() { Id = "rId2" };
nonVisualDrawingProperties1.Append(hyperlinkOnClick1);
...
return shape1;
}
Right now, nothing happens.. What i am doing wrong, any suggestions?
(The class ShapePosition is just for x,y,width,height of a shape)
Best regards!