none
c#操作ppt添加图片超链接 RRS feed

全部回复

  • Shape pic = slide.Shapes.AddPicture(@"C:\Users\Public\Pictures\Sample Pictures\koala.jpg", Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, shape.Left, shape.Top, shape.Width, shape.Height);

    pic.ActionSettings[PpMouseActivation.ppMouseClick].Hyperlink.Address =@"http://www.google.com/";

     


    2017年5月6日 9:13
  • 可以考虑第三方工具 Aspose Slider

    github上有很多例子


    专注于.NET ERP/CRM开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms

    2017年5月8日 0:20
  • 你可以使用Spire.Presentation来添加图片超链接

    using Spire.Presentation;
    using System.Drawing;
    
    namespace ImageHyperlink
    {
        class Program
        {
            static void Main(string[] args)
            {
                Presentation ppt = new Presentation();
    
                string imagePath = @"C:\Users\Administrator\Desktop\image.png";
                RectangleF rect = new RectangleF(50, 100, 600, 245);
                IShape imageShape= ppt.Slides[0].Shapes.AppendEmbedImage(ShapeType.Rectangle, imagePath, rect);    
                imageShape.Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;
                ClickHyperlink hyperlink = new ClickHyperlink("http://www.google.com");
                imageShape.Click = hyperlink;
    
                ppt.SaveToFile("Image_Hyperlink.pptx", FileFormat.Pptx2013);
            }
        }
    }

    2017年6月16日 9:25