Opening Word (.docx) files on a Windows Form C# - c#

I'm trying to make my program have the ability to display a Microsoft Word file on a form but not having any luck in doing so. I want to be able to open the file and display it on the form as a Read-Only. So basically just display it's contents. Various users on the web have recommended displaying files in the WebBrowser control (under toolbox). I have tried this but failed to get it working. My end goal is to be able to annotate on top of the web browser (or something of similar manner) and subsequently save the annotations along with the opened file.
I'm not that experienced in the C# language too so any help on how to achieve my problem would be greatly appreciated.

You need a DOCX viewer control. My company recently gave away our multi-format WinForms viewer control as a free product - XtremeDocumentStudio .NET Free. It can display DOCX and is available on NuGet. It does not require a Web Browser control for embedding an online viewer or Word software installed locally.
http://www.nuget.org/packages/XtremeDocumentStudio.NETFree/

There are some good links that might help you.
First, you will find a closely related or similar question here
And in that conversation someone posted the following link which is about how to build a user control for displaying Word documents in a webbrowser control.
I also found another article here about how to integrate Excel in a Windows Form application using WebBrowser. But Excel is used as an example and you may be able to adapt it to Word.

Related

Displaying PDF on WebBrowser Control not working

I Have a test.pdf and I want to display it inside in my form.
My code is very simple:
public Form1()
{
InitializeComponent();
this.wbPdf.Navigate(#"file:///<fullpath>\test.pdf#toolbar=0");
}
and it's not working. It's showing me a white page with an "X".
But if I do instead this:
this.wbPdf.Navigate(#"file:///<fullpath>\test.pdf#toolbar=0", true);
the IE opened and it showed my pdf. Of course, I tried to use false in the second parameter and it's not working.
Also, if I tried to do something like
this.wbPdf.Navigate(#"http://www.google.com");
it showed me google, so I think there isn't any problem of configuration of Web Browser Control
Any ideas? I'm not will be able to have Acrobat Reader installed, so using ActiveX components is not an option (also, this project is in x64 and I've read that this component is not working very well in x64).
I want to display the pdf only for viewing inside the form, not in another window.
AFAIK, the web browser control in WinForms relies on the default PDF reader (usually Acrobat Reader) for displaying PDF files. If you need to display PDF files without requiring any other piece of software to be installed, then you will probably need to use a PDF rendering library in your application. Some examples of PDF rendering libraries:
MuPDF A GPL/Commercial viewer with a .net wrapper, you need a commercial license for use on commercial closed-source applications.
Amyuni PDF Creator .Net Commercial library for editing or displaying PDF files. Disclaimer: I currently work as a developer of the library.
Another option would be to create a local HTML5 page that renders the PDF file using the project pdf.js, then embeed that page on your web browser control. But this will only work on Windows systems with IE 9.0 or above.

Word viewer in asp web application

I've to create one asp web application page for show .docx file( with exact alignment text,images, table etc) and also table of content(like tree view of that document). I would like to ask, Is there any open source ActiveX control or plugin or something else to achieve the specific task . I already done it in windows form application but now want to do it asp web form . i used dsoframer control in windows application . please make me to achieve that.
Please look into following article,
Link
There is support to render a .docx file as HTML - I can't speak to how accurately it renders in the webpage verse desktop version of Word. Still, there is a tutorial here:
http://blog.maartenballiauw.be/post/2008/01/11/Preview-Word-files-%28docx%29-in-HTML-using-ASPNET-OpenXML-and-LINQ-to-XML.aspx

WatiN not responding to API calls

some I'm back with a very perplexing problem. I have written some classes using WatiN and the Interop libraries in .NET in order to open a separate Excel application, read a few URLs from some of the cells, and then use this list to have my IE browser navigate to these relevant websites and then capture screen shots. However, after opening an Excel application using the Microsoft.Office.Interop.Excel library APIs, my IE instance that was previously instantiated no longer will navigate to web pages or take focus on the screen in order to properly capture the full web pages. It is still working however because it will capture really short but wide blank white images. Has anyone else encountered similar problems with WatiN and other applications being run at the same time?
While this may not be the answer for your question, there is one suggestion that I have. Have you considered reading Excel file without opening an instance of Excel using the Interop API?

View MS Word as HTML in a browser

Hi
Am developing a small search engine kind of application. It searches for contents in word documents. I need to implement a "view as html" option as in gmail. When I click the link to the doc, it should open as a html page in a new browser. Is there any way to achieve this?
I was able to open the word doc in an iframe, but that does not suit my purpose.
My application uses Asp.Net and C#. Any help would be appreciated.
Regards
Vignesh
The easy, slow, memory-intensive, unscalable, unscalable (needs to be said twice) way of doing it would be to use the office COM API to load the file and save it as html (or text actually since all you want to do is a search on it), but I really doubt you can pull this off in even a moderately used web site.
Throwing that aside, you're left with open source parsers or using the IFilter interface to do it. I found an example of the latter: http://www.neowin.net/forum/topic/316480-reading-text-from-ms-word-files-in-c

C# / Windows Forms - Display a PowerPoint slide-show without Office installed?

I know I can display a Powerpoint presentation within my own form (see here), but I'm wondering whether there is a way to get rid of Microsoft Office as a requirement?
I guess basically what I'm asking for is a library which will display Powerpoint slide-shows without my users having to install MS Office on every machine. They do not need to CREATE slide-shows, just display them. Does such a library exist? I have searched all over the place and I'm always referred back to the MS Interop / ActiveX stuff.
Any help is appreciated!
Tom
Try this: PowerPoint Viewer 2007. Also see this thread about embedding a Powerpoint Viewer 2007 instance on a VB.NET form
I believe you can accomplish this with Aspose.Slides. It can open up an PPT file you have, then I think you could save each sheet to a image. Finally, you could show the images in your app.

Categories