Previewing documents (Word, Excel, PDF, text file, etc) within C# WinForms?

吃可爱长大的小学妹 提交于 2020-02-04 01:06:53

问题


I am developing a C# WinForms application, and I would like to be able to "preview" various document types within it. That is, when a user selects a filename from a list, it shows below, within the same form, a preview of the selected file. It's a lot like they way Outlook allows you to preview a selected message without double-clicking.

Is there any way to take just a filename and create a control dynamically within my WinForms application that shows the contents of that file?


回答1:


If you want to provide a preview/readonly version of the file types, an idea might be to implement PDF viewing first, this primarily involves converting PDF pages to images and then creating a view for those. Once you have that done (using GhostScript or other commercial components) you can then work on converting other formats to PDF, and use the PDF viewing option, you can probably do most office documents through word automation and text based files could be displayed directly (possibly using a rich text editor for formatted text)

HTH



来源:https://stackoverflow.com/questions/12386701/previewing-documents-word-excel-pdf-text-file-etc-within-c-sharp-winforms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!