Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / December 2004

Tip: Looking for answers? Try searching our database.

Get text from Web Browser control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
_B - 28 Dec 2004 02:21 GMT
Is there any way to 'scrape' the ascii text from an
AxSHDocView:AxWebBrowser control?

IOW, I'd like to get the text as it is displayed by the browser.
Somewhat like selecting all text in IE and doing a capture to
clipboard (^A,^C).

It seems like there should be a way to simulate sending control-A,
control-C key input to the browser control.
Cor Ligthert - 28 Dec 2004 09:35 GMT
There is not much text in a HTML page.

All between the <HTML>begin and end tag is called innertext and including
that it is called outertext.

However that is probably not what you are after.
When you want the HTML innertext you can use MSHTML to get that.

However keep in mind that that is the complete web page (for outertext
without in newer situation the first line) including all tags. What is text
is not easy to determinate, because it is all what is written between an
begin and an end tag (not inside a tag), while it can as well be done using
JavaScript.

mshtml
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/hosting/host
ing.asp


I hope this helps a little bit.

Cor
_B - 28 Dec 2004 22:27 GMT
[re capturing text in a browser window]

>All between the <HTML>begin and end tag is called innertext and including
>that it is called outertext.
>
>However that is probably not what you are after.
>When you want the HTML innertext you can use MSHTML to get that.

I confess that I haven't gone after the innertext yet cause I need
some whitespace stuff that's probably relegated to outer text, like
<nbsp> etc.   If I could do the equivalent of sending in a ^A^C
(select-all, capture), I'd be home free.  I thought there would
probably be a simple way to do that.  I haven't seen that done before
though, so it's probably not easy.

Thanks for your reply, Cor.
Mark Bennion - 29 Dec 2004 04:55 GMT
First time on this site (didn't even know it existed!)...  My question has
similarities to the latest post.  I was going to pose a new question, but
something wasn't working.  Ultimately I will want to copy text from an HTML
window, just as the latest post posed.  But before that, I want to figure out
how to display a menu bar on my HTML window.  My user is quite happy with my
solution of using MSHTML and the function ShowHTML() to display records from
an Access database containing HTML.  But it is also desired to print or copy
the data in the window.  It has been quite some tiome since I wrote the
application so my memory is hazy.  But I remember spending quite some time in
futility trying to figure out how to also have a menu with my ShowHTML
window.  I am using C++ in Visual Studio.net.
Thanks,
  Mark

> [re capturing text in a browser window]
>
[quoted text clipped - 12 lines]
>
> Thanks for your reply, Cor.
Jeff Gaines - 29 Dec 2004 09:33 GMT
> [re capturing text in a browser window]
>
[quoted text clipped - 12 lines]
>
> Thanks for your reply, Cor.

I use the following to copy text from the DHTML edit control to a
RichEdit control if it's any use:

private void JConvertHTM2RTF(string strFQSource)
{
object obfile = new object();
object ob = new object();

obfile = strFQSource;
axDHTMLEdit1.NewDocument();
axDHTMLEdit1.LoadDocument(ref obfile, ref ob);

rtfDest.Text = "";
axDHTMLEdit1.Focus();
SendKeys.SendWait("^a^c");
rtfDest.Focus();
SendKeys.SendWait("^a^v");
}
       

Signature

Jeff Gaines
Posted with XanaNews 1.17.1.2 http://www.wilsonc.demon.co.uk/delphi.htm


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.