5

I'm developing a windows forms project in c#. For now I can preview .PDF files with WebBrowser tool in ToolBox but that doesn't preview .DOC or .DOCX; instead it opens up a prompt ask either you want to save it or open in just like IE does. Now what I want is simply a preview of a .DOC or .DOCX. I tried this with Office.Interop assemblies but didn't help. I checked tens of websites and found one but iink was broken and also there were only reading from a .DOC nohing else. Is there any tool or way to implement this?

Thank you.

svick
  • 236,525
  • 50
  • 385
  • 514
neocorp
  • 569
  • 7
  • 20
  • Can you be sure word will be installed or do you want a solution independent of word? (i.e. do you want to embed a word pane to view the file or do you need to parse and render it yourself?) – Rup Oct 17 '11 at 00:21
  • As I said above, I'm now using .PDF with webBrowser tool in VS; it works perfectly, but it doesn't render .DOC or .DOCX. Well, I may embed a word pane to my form which I don't know how to do; anything possible, I'm ready to try... – neocorp Oct 17 '11 at 06:55
  • For what you are trying to do, this is normal behavior. Since webbrowser can render pdf but no MSOFFICE files. I think, actually i'm sure, you'll need a plugin/lib to do this. I don't know wich one but try google. Something like [this](http://www.syncfusion.com/products/user-interface-edition/windows-forms?_kk=WinForms&_kt=7c265863-a1ee-4461-8edf-473f4d42f77f&gclid=CK7rqaqX76sCFUEY4QodD1Oeew) – Frederiek Oct 17 '11 at 07:21
  • It has already been asked. [Link](http://stackoverflow.com/questions/511046/how-to-display-pdf-or-words-doc-docx-inside-winforms-window) Link was dead on the page but [this works](http://codinglight.blogspot.com/2008/10/simple-docbrowser-control.html) – Frederiek Oct 17 '11 at 07:23
  • Yes, link was broken on the page but this looks like what I need; thank you Frederiek! – neocorp Oct 17 '11 at 08:01
  • I wanna give you a reputation, could you post the link as an Answer or how should I do this? – neocorp Oct 17 '11 at 08:05

2 Answers2

1

This guy has a PreviewHandler for Winforms. Works like a charm!

Marian Nasry
  • 821
  • 9
  • 22
dreojs16
  • 109
  • 12
1

Word Control for .NET is good article, even it seems dated but it's still work with MS Word 2010 and .NET 4.0

Ekk
  • 5,627
  • 19
  • 27