C#VSTO PowerPoint加载项另存为PDF [英] C# VSTO PowerPoint Add-In Save As PDF

查看:79
本文介绍了C#VSTO PowerPoint加载项另存为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在关闭PowerPoint之前保存我的演示文稿,但是作为PDF格式。我如何在
ThisAddIn_Shutdown中使用ppSaveAsPDF?


谢谢

解决方案

您好,


ThisAddIn_Shutdown
事件o
在即将卸载加载项时发生。


我建议您处理
Application.PresentationBeforeClose活动
&
使用Presentation.ExportAsFixedFormat方法
保存为PDF。


例如

 private void ThisAddIn_Startup(object sender,System.EventArgs e)
{
PPT.Application app = Globals.ThisAddIn.Application;
app.PresentationBeforeClose + = App_PresentationBeforeClose;
}

private void App_PresentationBeforeClose(PPT.Presentation Pres,ref bool Cancel)
{
PPT.Application app = Globals.ThisAddIn.Application;
PPT.Presentation pre = app.ActivePresentation;
pre.ExportAsFixedFormat(@" C:\Users\Admin \Desktop\Test.pdf",PPT.PpFixedFormatType.ppFixedFormatTypePDF);
}

问候,


Celeste



Hi, i want to save my presention before i close PowerPoint but as a PDF. How do i use ppSaveAsPDF in ThisAddIn_Shutdown?

thanks

解决方案

Hello,

ThisAddIn_Shutdown event occurs when the add-in is about to be unloaded.

I suggest you handle Application.PresentationBeforeClose Event and use Presentation.ExportAsFixedFormat Method to save as PDF.

E.g.

private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            PPT.Application app = Globals.ThisAddIn.Application;
            app.PresentationBeforeClose += App_PresentationBeforeClose;
        }

        private void App_PresentationBeforeClose(PPT.Presentation Pres, ref bool Cancel)
        {
            PPT.Application app = Globals.ThisAddIn.Application;
            PPT.Presentation pre = app.ActivePresentation;
            pre.ExportAsFixedFormat(@"C:\Users\Admin\Desktop\Test.pdf", PPT.PpFixedFormatType.ppFixedFormatTypePDF);
        }

Regards,

Celeste


这篇关于C#VSTO PowerPoint加载项另存为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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