Windows API的code包缩略图给人PDF的preVIEW拇指而不是Word或Excel [英] Windows API Code Pack Thumbnail gives preview thumb of pdf but not Word or Excel

查看:283
本文介绍了Windows API的code包缩略图给人PDF的preVIEW拇指而不是Word或Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是微软的API code包,有一个处理程序使用以下code

I am using the Microsoft API Code Pack and have a handler using the following code

    string filename = "C:\\Hello.pdf";

    ShellFile shellFile = ShellFile.FromFilePath(filename);
    Bitmap bitmap = shellFile.Thumbnail.ExtraLargeBitmap;

    context.Response.ContentType = "image/jpeg";
    bitmap.Save(context.Response.OutputStream, ImageFormat.Jpeg);

这工作正常生产用于PDF文档的preVIEW式的缩略图,但是当我用Word或Excel尝试它,我得到了通用的缩略图文件类型,而不是文件的微型图像(这是什么我在找)。

This works fine to produce a "preview" style thumbnail for pdf documents, but when I try it with Word or Excel I get the generic thumbnail for the filetype instead of a mini image of the document (which is what I'm looking for).

任何人有这样的想法?它可以使用此API来完成?

Anyone have ideas on this? Can it be done using this API?

推荐答案

由于大卫说,并不是所有的Office文档被保存的缩略图。它是在文件本身的性质。在Office 2010中,你可以看到在另存为对话框中的复选框。在旧版本的Office可以在文档属性中找到它。

As David said, not all Office documents are saved with a thumbnail. It's a property on the document itself. In Office 2010 you can see the checkbox on the Save As dialog box. In older versions of Office you can find it in the document properties.

在Office文档中保存缩略图,在code你会工作。

Once the Office document is saved with a thumbnail, the code you have will work.

这篇关于Windows API的code包缩略图给人PDF的preVIEW拇指而不是Word或Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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