在winform应用程序中查看附件C# [英] View attachment in winform application C#

查看:87
本文介绍了在winform应用程序中查看附件C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查看存储在sql数据库中的附加文档。附件可以是任何类型的单词,excel,pdf,图像文件或邮件。如何在winform应用程序中完成?提前致谢。



我尝试了什么:



我可以使用Interop命名空间下载/查看excel和word但是如何实现邮件附件,pdf和其他文件?

I am trying to View the attached documents which are stored in sql database. The attachments can be of any type word,excel,pdf,image file or mail. How it can be done in winform application? Thanks in advance.

What I have tried:

I could download/view excel and word using Interop namespace but how can I achieve it for mail attachment,pdf and other files?

推荐答案

正如Richard所说,你可以创建或获取每种文档类型的文档查看器。如果您只有几种文档格式,这可能是一个合适的解决方案。然而,当你需要更多的格式时,这确实会变得笨重。



此外,还有许多商业套餐可以观看大片原始格式的数量 - 其中一种可能适合您的目的,如果您准备支付它。



或者,您可以使用该文档的本机应用程序来打印 将文档转换为XPS文件,然后使用 DocumentViewer类 [ ^ ]查看新的再现。我们做了类似于我们的ECM系统,虽然有点老了,并使用PDF作为演绎。这些天的XPS是一个更简单的前景,但仍然需要做一些工作。
As Richard said, you can create or get a document viewer for each document type. If there are only a few document formats you have, this may be a suitable solution. However, as you cater for more formats, this does have a tendency to become bulky.

Also, there are a number of commercial packages around that enable viewing of a large number of native formats - one of these may suit your purposes, if you are prepared to pay for it.

Alternatively, you could use the document's native application to "print" a rendition of the document to an XPS file, then use the DocumentViewer class[^] to view the new rendition. We did similar to that in our ECM system, although were a bit more old-school, and used PDF as the rendition. XPS these days is a simpler prospect, but still a bit of work involved.


这篇关于在winform应用程序中查看附件C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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