导出WebBrowser HTML [英] Export WebBrowser HTML
问题描述
我有一个
Web浏览器控件 (在其中我的 表单 中)
从应用程序的 load HTML页面
资源 .
HTML页面 用作 模板 和 ,
通过代码 ,我要 到 插入
通过一些数据将转换为 和其他 数据
该 WebBrowser.Document.GetElementById
功能 ( " TD101 "" ) .
InnerText = " 确定 " 功能.
我想 访问整个页面的内容 ,但是
使用 WebBrowser.DocumentText
功能 来 仅 模板HTML
我没有 字符串 插入 .
相反,使用 WebBrowser.Document.Body.InnerHtml
功能 我可以看到 带有 的页面
正确 输入的值 ,但由于 我可以
不返回页面的 头 ,
我丢失了 所有CSS 代码 .
是否有 功能 可以让我
访问 所有 HTML 控件的内容 ?
谢谢大家.
I have a
WebBrowser control in a form in which I
load an HTML page from the application's
resources.
The HTML page serves as a template and,
through code, I'm going to insert
into it some strings and other data via
the WebBrowser.Document.GetElementById
function ("TD101").
InnerText = "OK" function.
I would like to access the content of entire page, but
using the WebBrowser.DocumentText
function comes only the template HTML
with no strings inserted by me.
Instead, using the WebBrowser.Document.Body.InnerHtml
function I can see the page with the
correct values entered but since I can
not return the head of the page,
I lose all the CSS code.
Is there any function that will let me
access ALL of the HTML contents of the control?
Thank you all.
推荐答案
也许提取< head> DocumentText 中的区域?也尝试一下:
Maybe extract the <head> area from DocumentText? Try this too:
Option Strict Off
. . .
Dim d As Object = WebBrowser1.Document.DomDocument
Dim h As Object = d.Head
Dim s As String = h.OuterHTML
这篇关于导出WebBrowser HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!