c# - C# VSTO SaveCopyAs 签入的演示文稿/文档
问题描述
我在 C#.Net 中为 MS-Office 创建了一个 VSTO 加载项,它可以将所有幻灯片/页面导出为图像。
但是,如果演示文稿/文档是从远程 SharePoint 站点打开的,并且演示文稿/文档需要在可以编辑之前签出,我将无法导出幻灯片/页面。但是,我不想更改/更新远程文件中的任何内容,我只想将该文件的副本复制到“temp”文件夹中,以便可以将幻灯片/页面导出为图像。
我正在使用以下代码创建演示文稿的临时副本
Presentation vstoPresentation = Globals.ThisAddIn.Application.ActivePresentation;
var filename = vstoPresentation.Name;
var tempPath = System.Environment.GetEnvironmentVariable("temp");
string temp_file = tempPath + "\\" + filename;
vstoPresentation.SaveCopyAs(temp_file);
我收到以下错误
System.Runtime.InteropServices.COMException (0x80048240): Presentation (unknown member) : Invalid request. Presentation cannot be modified.
at Microsoft.Office.Interop.PowerPoint._Presentation.SaveCopyAs(String FileName, PpSaveAsFileType FileFormat, MsoTriState EmbedTrueTypeFonts)
at PowerPointExport.ThisAddIn.ExportImages() in F:\Path\to\project\PowerPointExport\ThisAddIn.cs:line 271
解决方案
目前尚不清楚传递给该SaveCopyAs
方法的实际字符串是什么样的......
作为一种解决方法,您可以尝试使用Presentation.SaveAs方法来保存从未保存过的演示文稿,或者以不同的名称保存以前保存的演示文稿。
推荐阅读
- r - 考虑另一列中的变量,查找同一列中的不匹配
- python - 没有熊猫的排序字典
- javascript - 如何在 AG Grid Vue 中刷新固定的行数据
- android - 尝试调用虚拟方法 'void com.android.server.wm.DisplayContent.moveStack(com.android.server.wm.TaskStack, boolean)'
- angular - 带有 AWS Lambda Angular 8 的 HttpInterceptor
- amazon-web-services - 如何为 Lambda 通过 API 调用创建的 ECS 服务构建 CI CD 管道
- xamarin - 如何更改 Rg.Plugins 弹出模板以用 C# 编码
- java - 将 .csv 文件数据导入显示不完整信息的 java 表
- java - Android画布添加描边和高程
- java - IntelliJ Kotlin - 如何在项目中修复“确保您依赖 Kotlin 标准库”?