如何激活演示文稿? [英] How to activate a presentation?

查看:155
本文介绍了如何激活演示文稿?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI Friends,

我们可以激活一个单词文档,如:

HI Friends,

We can activate a word document like :

targetDoc.Activate();



Powerpoint文档激活的API是什么?我尝试了一些但没有结果:



What is the API for Powerpoint document activation? I tried some of this but no result:

foreach (PPT.Presentation pp in ppApp.Presentations)
{
    if (pp.Name == TargetFileName)
    {
        pp.Application.Activate();
    }
}



[edit]标记,大括号缩进-OriginalGriff [/edit]



[edit]Tags, braces indent - OriginalGriff[/edit]

推荐答案

Guys,
我试过了,它也可以....

Guys,
i tried this, it will also work ....

string selePPT = comboBox1.SelectedItem.ToString();
            string before = ppApp.ActiveWindow.Caption;
            string after = "";
            foreach (PPT.DocumentWindow pp in ppApp.Windows)
            {
                if (pp.Caption == selePPT)
                {
                    pp.Activate();
                    after = ppApp.ActiveWindow.Caption;
                    MessageBox.Show(before + "  " + after);
                }
            }


prasad,

请执行以下操作:

Hi prasad,

Do this:

for(int i=1; i <= ppApp.Presentation.Count; i++)
{
 if(ppApp.Presentations[i].Name == TargetFileName)
 {
  ppApp.Presentations[i].Windows[i].Activate();
 }
}



如果只想使用foreach,则使用整数i;

int i = 0;



If you want to use the foreach only, then use an integer i;

int i = 0;

foreach (PPT.Presentation pp in ppApp.Presentations)
                          { 
                              i = i + 1;
                              if (pp.Name == TargetFileName)
                              {
                                  pp.Windows(i).Activate();
                              }
                          }




希望能有所帮助. :)




Hope it helped. :)


这篇关于如何激活演示文稿?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆