导出WebBrowser HTML [英] Export WebBrowser HTML

查看:73
本文介绍了导出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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆