VB.Net: Programmatically previewing any system supported document type
-
Hi guys, Is there a way/control for previewing any document supported by the a windows system from vb.net?:-> thanks:->
Hi, the Process.Start() method lets you open a document, using the application that got associated to the file's extension. It is equivalent to double-clicking a file in Windows Explorer; so al of this happens outside your app. the WebBrowser class lets you open a number of document types (mtml, doc, ppt, xls, ...) inside your app. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
Hi guys, Is there a way/control for previewing any document supported by the a windows system from vb.net?:-> thanks:->
If you're talking about how you see it in Explorer, where you single-click on a file, say a JPG, and you see a smalle preview in the Explorer window, then no there isn't. You'd have to write a parser, and renderer, for every document type you want to support. That's just not feasible.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Hi, the Process.Start() method lets you open a document, using the application that got associated to the file's extension. It is equivalent to double-clicking a file in Windows Explorer; so al of this happens outside your app. the WebBrowser class lets you open a number of document types (mtml, doc, ppt, xls, ...) inside your app. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
Hi, The WebBrowser control is actually doing what I want, thanks. For PDF, picture formats etc its working fine i.e. it opens the file and displays it within the browser control, but when it comes to office documents, I get a File Download dialog box which then goes on to start the office application and open the document there or downloads the file to disk. Is there a way around this so that even office type documents are loaded but their applications are embedded within the WebBrowser control? Thanks,
-
If you're talking about how you see it in Explorer, where you single-click on a file, say a JPG, and you see a smalle preview in the Explorer window, then no there isn't. You'd have to write a parser, and renderer, for every document type you want to support. That's just not feasible.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007Hi Dave Thanks for your response, however i think u should take a look at this link: http://www.gamedev.net/community/forums/mod/journal/journal.asp?jn=266903&cmonth=11&cyear=2005 Its possible to have thumbnails, also using the WebControl allows u to open most documents effortlessly. Just: WebControl1.Navigate("c:\book.pdf") Thanks
-
Hi, The WebBrowser control is actually doing what I want, thanks. For PDF, picture formats etc its working fine i.e. it opens the file and displays it within the browser control, but when it comes to office documents, I get a File Download dialog box which then goes on to start the office application and open the document there or downloads the file to disk. Is there a way around this so that even office type documents are loaded but their applications are embedded within the WebBrowser control? Thanks,
Hi, Seems like yours is a web app, not a Windows app; I dont know for these. I have been using shdocvw.dll (the precursor of WebBorwser) since .NET 1.1 in Win app, and it shows office documents without dialogs. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
Hi Dave Thanks for your response, however i think u should take a look at this link: http://www.gamedev.net/community/forums/mod/journal/journal.asp?jn=266903&cmonth=11&cyear=2005 Its possible to have thumbnails, also using the WebControl allows u to open most documents effortlessly. Just: WebControl1.Navigate("c:\book.pdf") Thanks
Yeah, but for that to work, you have to have something installed that knows what a PDF is and how to render it, like Adobe Acrobat Reader. Without it, the web browser control doesn't know a damn thing about the PDF and can't render it. The same goes for Excel files, Word documents, AutoCad drawings, ...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007