简体   繁体   English

如何在C#中从doc docx创建缩略图?

[英]How create thumbnail from doc docx in c#?

Hello I would like to create thumbnail from doc docx, actually I use library Leadtools but I have this error : 您好,我想从doc docx创建缩略图,实际上我使用的是Leadleads库,但出现此错误:

ExceptionFilter Leadtools.RasterException: Invalid file format at Leadtools.Codecs.RasterCodecs.CheckExceptions(Int32 code) at Leadtools.Codecs.RasterCodecs.DoLoad(LoadParams loadParams) at Leadtools.Codecs.RasterCodecs.Load(String fileName, Int32 width, Int32 height, Int32 bitsPerPixel, RasterSizeFlags flags, CodecsLoadByteOrder order) ExceptionFilter Leadtools.RasterException:Leadtools.Codecs.RasterCodecs.DoLoad(LoadParams loadParams)处Leadtools.Codecs.RasterCodecs.CheckExceptions(Int32代码)处的文件格式无效(String fileName,Int32宽度,Int32高度, Int32 bitsPerPixel,RasterSizeFlags标志,CodecsLoadByteOrder顺序)

I would like to use an another lib for create the thumbnail. 我想使用另一个库来创建缩略图。

LeadTools is an image processing library so will fail to process non-image formats like DOCX. LeadTools是图像处理库,因此将无法处理DOCX之类的非图像格式。

The ability to read the Windows created thumbnail for other files is covered in the existing article; 现有文章介绍了读取Windows为其他文件创建的缩略图的功能;

C#/ASP.NET - Get thumbnail from PDF/DOC files which references the Microsoft documentation here https://msdn.microsoft.com/en-us/library/aa289172.aspx that explains how to get the image. C#/ ASP.NET-从PDF / DOC文件中获取缩略图,缩略图参考Microsoft文档, 网址为https://msdn.microsoft.com/zh-cn/library/aa289172.aspx ,该文档解释了如何获取图像。 The Microsoft doc explains how to do this in SharePoint but the example is in VB.net so should be easy to follow. Microsoft文档解释了如何在SharePoint中执行此操作,但是该示例在VB.net中,因此应易于遵循。

The phrase about LEADTOOLS being "an image processing library so will fail to process non-image formats like DOCX" is not entirely true. 关于LEADTOOLS是“图像处理库,因此将无法处理非DOCX之类的非图像格式”的说法并不完全正确。 With some formats such as Word, Excel, PowerPoint and PDF files (among others), the toolkit can convert them to images but only if a Document Imaging toolkit is used. 对于某些格式,例如Word,Excel,PowerPoint和PDF文件(以及其他格式),该工具包可以将它们转换为图像,但前提是使用了Document Imaging工具包。 Entry-level Imaging Pro cannot load such formats. 入门级Imaging Pro无法加载此类格式。 Also, if the appropriate format codec assembly is missing from the project, you will get "RasterException: Invalid file format". 另外,如果项目中缺少适当的格式编解码器程序集,您将收到“ RasterException:无效的文件格式”。

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

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