如何访问“保存缩略图”通过 Interop 实现 Excel 的功能?
我正在使用 C# 和 .NET 4.0 开发 Excel 加载项。在 Excel 中,“另存为”对话框中有一项功能,用于将预览缩略图与文档一起保存。如何在代码中访问此功能?另外,保存后如何访问预览图像(我认为它是位图)?
目前,我的 Excel 加载项按如下方式复制文档:
Globals.ThisAddIn.Application.ActiveWorkbook.SaveCopyAs("tempwbcopy");
然后将文档复制到服务器并删除临时文件。基本上我还想制作缩略图,将其发布到服务器,并删除临时文件。
I'm working on an Excel add-in using C# and .NET 4.0. In Excel there's a feature in the Save-As dialog for saving a preview thumbnail along with the document. How can I access this feature in code? Also, how do I access the preview image (I think it's a bitmap) once it has been saved?
Currently my Excel add-in makes a copy of the document as follows:
Globals.ThisAddIn.Application.ActiveWorkbook.SaveCopyAs("tempwbcopy");
It then copies the document to a server and erases the temp file. Basically I'd like to also make the thumbail image, post it to the server, and erase the temp file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道如何以编程方式访问“保存缩略图”功能,但如果您有一个带有缩略图的 Excel 文件并且想要提取图像,您可以使用以下代码(使用 OpenXml 2.0 API):
因为这不是 Excel自动化你也可以在服务器端进行。
I don't know how to access the Save Thumbnail feature programatically, but if you have a Excel file with a thumbnail and want to extract the image you could use the following code (using the OpenXml 2.0 API):
Since this isn't Excel automation you could do this server side as well.