Пример #1
0
 public override void InsertLink(String path, String titulo)
 {
     PowerPoint.Selection selection = presentation.Application.ActiveWindow.Selection;
     PowerPoint.Hyperlink hyperlink = selection.TextRange.ActionSettings[Microsoft.Office.Interop.PowerPoint.PpMouseActivation.ppMouseClick].Hyperlink;
     hyperlink.Address       = path;
     hyperlink.TextToDisplay = titulo;
 }
Пример #2
0
        private int GetCurrentPage()
        {
            // 获得当前选中的幻灯片
            PPT.Slide slide;
            try
            {
                try
                {
                    // 在普通视图下这种方式可以获得当前选中的幻灯片对象
                    // 然而在阅读模式下,这种方式会出现异常
                    slide = objSlides[objApp.ActiveWindow.Selection.SlideRange.SlideNumber];
                }
                catch
                {
                    // 在阅读模式下出现异常时,通过下面的方式来获得当前选中的幻灯片对象
                    slide = objApp.SlideShowWindows[1].View.Slide;
                }
                int slideindex      = slide.SlideIndex;
                int slidenum        = slide.SlideNumber;
                int currentPosition = objPresSet.SlideShowWindow.View.CurrentShowPosition;
                pageCurrent = slideindex;

                if (pageCurrent == 0)
                {
                    pageCurrent = 1;
                }

                //开始读取每一个数据块
                {
                    urls          = "";
                    pptHyperlinks = slide.Hyperlinks;
                    try
                    {
                        for (int i = 1; i <= pptHyperlinks.Count; i++)
                        {
                            PPT.Hyperlink link = pptHyperlinks[i];
                            string        text = link.TextToDisplay.Replace("#", "").Replace("|", "");
                            string        url  = link.Address.Replace("#", "").Replace(";", "");
                            //link.Address = "www.test.com";
                            //link.TextToDisplay = "test";
                            urls += (urls.Length > 0?"|":"") + text;//+ i +"#"+      + "#" + url
                            Log.Info(urls);
                        }
                    }
                    catch (Exception e)
                    {
                        Log.Info(e.Message);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error("GetCurrentPage excepton: " + e.Message);
            }
            return(pageCurrent);
        }