简体   繁体   English

将文件保存在内存中,而不是物理路径

[英]save a file in memory instead of a physical path

I am trying to use Office Interop assembly to export a PowerPoint slide to an image. 我正在尝试使用Office Interop程序集将PowerPoint幻灯片导出到图像。 The SaveAs() , SaveCopyAs() , and Export() methods all accept a physical path as the output folder. SaveAs()SaveCopyAs()Export()方法都接受物理路径作为输出文件夹。

I want to put it in memory for further processing instead of creating a bunch of images on disks that I have to clear them later. 我想将其放入内存中以进行进一步处理,而不是在磁盘上创建一堆映像,以后我必须将其清除。

How can I export a slide and hold it in the memory temporarily instead of saving it in a physical folder? 如何导出幻灯片并将其临时保存在内存中,而不是将其保存在物理文件夹中?

Calling the Slide's .Copy method will put the slide on the clipboard in a number of formats, including PNG, GIF, JPG, DIB, BMP and metafile/enhanced metafile. 调用幻灯片的.Copy方法会将幻灯片以多种格式放在剪贴板上,包括PNG,GIF,JPG,DIB,BMP和图元文件/增强型图元文件。

It should be possible to access the format you want from there. 应该可以从那里访问所需的格式。

There is no way of writing an Office Apps files straight to memory. 无法将Office Apps文件直接写入内存。 You can look at Open XML SDK for Office, but i think, it will be easier if you just save the image to a file and load it through memorystream. 您可以查看适用于Office的Open XML SDK,但我认为,如果仅将图像保存到文件并通过memorystream加载它,将会更加容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM