With TWebbrowser it is easy to navigate URL's and files on your local disk using the Navigate method.
As discussed in this blogpost TWebbrowser implements a IHTMLDocument2 interface object which can be used to edit the document in WYSIWYG way.
Saving the changes can be done in a few different ways, I will discuss a few here below:
1. Using the innerHTML property
You could retreive the raw HTML from the browser through the WebBrowser.OleObject.Document.documentElement.innerHTML property and then save it to disk.
If you want only the text from the document, and not the HTML, you could use the WebBrowser.OleObject.Document.documentElement.innerText method.
Saving to disk could be easily done using a TStringList object.
2. Through the IPersistFile interface
Although the above method works, there is a much more elegant way to achieve this.
IHTMLDocument implements an interface called IPersistFile which is an common interface for loading and saving objects.
Save the current loaded webpage using the IPersistFiles as follows:
(WebBrowser.Document as IPersistFile).Save('c:\inetpub\wwwroot\MyWebsite\index.html', True);
Besides Save, IPersistFile offers a method for loading files (Load) and a method to find out if the current loaded page is changed compared to when it was last saved. (IsDirty)
For more information on IPersistFile visit the msdn website here.
According this page IPersistFile is new in the .NET Framework 2.0.
Programming blogs containing .NET, C#, LINQ, Objective-C and Delphi experiences
Subscribe to:
Post Comments (Atom)
Use an image as your UIBarButtonItem
Using an image as your UIBarButtonItem in your navigationcontroller bar can only be achieved by using a common UIButton as the BarButtonItem...
-
In ASP.NET it is easy to set the prefered authentication method in the web.config file. For external websites this is set mostly to Forms ...
-
Using an image as your UIBarButtonItem in your navigationcontroller bar can only be achieved by using a common UIButton as the BarButtonItem...
-
How to get, for example, all the hyperlinks from a webpage, which is loaded in your iPhone app using the UIWebView control? (Xcode's web...
1 comment:
Good day! I simply want to give a huge thumbs up for the good data you might have right here on this post. I can be coming back to your blog for more soon. casino slots
Post a Comment