Extract text from an HTMLViewer

Is there a way to load HTML code into an HTMLViewer and than extract from it a text version of the rendered code?


see MBS Plugin extensions to HTMLViewer:

there you find for example IETextMBS for Windows with Internet Explorer.

for HTMLViewer using Chromium on Windows:

dim b as ChromiumBrowserMBS = HTMLViewer1.ChromiumBrowserMBS dim f as ChromiumFrameMBS = b.MainFrame dim s as string = f.Text Break // view in debugger


(in mybrowser -> Property -> Source -> Get : you can change outerHTML to innerHTML if needed)

To get just the text version like OP wants, change the Javascript in Axel’s project to:

me.ExecuteJavaScript("window.status = document.body.textContent")

and Mac:

[code] dim w as WebViewMBS = HTMLViewer1.WebViewMBS
dim f as WebFrameMBS = w.mainFrame
dim d as Variant = f.DOMDocument
dim h as DOMHTMLDocumentMBS = d
dim b as DOMHTMLElementMBS = h.body
dim t as string = b.innerText

	MsgBox t[/code]

with MBS Plugins 17.0pr4 or later (soon to come)

Solved with:

dim emailBodyTxt as string = RemoveHTMLTagsMBS(emailBodyHTML)

and than, some lines of code to remove double blank lines and trim the lines.

Thanks to everybody for your suggestions.