How to find the path of WebBrowser.ShowSaveAsDialog() - c#

The WebBrowser control has a method named ShowSaveAsDialog() which can save a loaded document into a file. I want to find out the path of the saved file and open it. How can I find such a path or an alternative way to save an html file loaded by WebBrowser control.

It seems you want to save everything to a web archive (.mht) file. I can't see that anyone has got that working via the WebBrowser control.
However, there are alternatives for doing this programatically. Jeff Atwood posted an article on CodeProject: Convert any URL to a MHTML archive using native .NET code but it's in VB.NET. Incidentally, Jeff is one of the co-founders of this site and is Stack Overflow Valued Associate #00001!
Someone has kindly ported Jeff's code to C# and that can be found on Google Code here: url2mhtml
Also see this question: generate .mht file programmatically

Related

Show PowerPoint in Web

How to show a PowerPoint file in web using C#? I want to get file from a URL then do some ways to show this PowerPoint in HTML.
I do not want to use drive in my project.
Help me ! Thanks
I was looking for a simple way to do this as well recently and found this answer by #wclear:
just to update this question - as there is a new way to embed
Powerpoints in a web page. If you have an account on OneDrive, do the
following using Powerpoint Online (accessing Powerpoint via the
browser) to embed a Powerpoint:
Click 'File', then 'Share', then 'Embed' Click the 'Generate' button to generate HTML
code to be embedded
Copy the 'Embed Code' and paste it in the HTML of a website

Opening Word (.docx) files on a Windows Form 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.

Render ShapeFile/DBF with HTML5/Javascript

I have a .dbf and .shp files, I can rendering in my browser using Html5 and javascript
Exist a lib c#/javascript for rendering the files?
Opensource or commercial...
Thanks
I found this javascript lib for abstracting the .dbf file, which might be helpful but I have never used it before. Still you would most likely need to write some C# code yourself. Here is a question and another that will help guide you on down that with path for .dbf file.

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

Programmatically save an MHT without dialog

Is it possible to save a file of any type bypassing the 'save as' dialog? using the WebBrowser Class
WebBrowser.ShowSaveAsDialog();
Is the loaded content in a WebBrowser control serializable so it can be saved and retrieved (for redisplay)?
Given that you have full access to the DOM and can therefore read any contents that the WebBrowser is displaying the answer must be yes.
Using the tree of DOM nodes read the contents of the WebBrowser into the C# world
Write to the file using normal .NET file access
However if you just wish to download a webpage and save it to disk there are better ways then using the WebBrowser control, have a look at the WebClient class
I see this is an old question, but I'm just going to update with a possible alternative.
Please take a look in this CodeProject article.

Categories