以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  HTML编辑器 录入时 转多一种普通的格式出来  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88574)

--  作者:ljh29206
--  发布时间:2016/8/5 9:53:00
--  HTML编辑器 录入时 转多一种普通的格式出来
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&replyID=280520&ID=43943&skin=1

以上帖子的 HTML 的 内容写入数据库

请教

请问 如何  写入 这个 HTML 的内容  的时候

把 相关的 文本 提取出来



例如   在 html 里面写入

<
但是房间空间
打发
爱上对方身份 
>

自动提取  字符

但是房间空间
打发
爱上对方身份 

(原因:outlook 里面  邮件能够识别 HTML格式,但是日历里面 只能识别  普通文本, 通过foxtable 导入 outlook日程,只能用 普通格式)
[此贴子已经被作者于2016/8/5 9:55:25编辑过]

--  作者:大红袍
--  发布时间:2016/8/5 10:24:00
--  

参考代码

 

Dim str As String = "<p>123456789</p><p>123456789</p><p>123456789</p>"
Dim web As new Windows.forms.Webbrowser
web.DocumentText = str
msgbox(2)
msgbox(web.document.all(0).innerText)


--  作者:客人
--  发布时间:2016/8/6 14:12:00
--  
aa

Dim str As String = "<p>123456789</p><p>123456789</p><p>123456789</p>"
Dim web As new Windows.forms.Webbrowser
web.DocumentText = str

MessageBox.Show(2)

Output.Show(web.document.all(0).innerText)


袍哥


为什么 去掉 msgbox(2) 这个代码


下边的就报报错!


假如我只提取值 不  msgbox 出来


该怎么做


--  作者:ljh29206
--  发布时间:2016/8/6 14:30:00
--  

Dim str As String = "<p>123456789</p><p>123456789</p><p>123456789</p>"
Dim web As new Windows.forms.Webbrowser
web.DocumentText = str

MessageBox.Show(2)

Output.Show(web.document.all(0).innerText)


袍哥


为什么 去掉 msgbox(2) 这个代码


下边的就报报错!


假如我只提取值 不  msgbox 出来


该怎么做


MessageBox.Show(2) 的意义是什么?


--  作者:Hyphen
--  发布时间:2016/8/6 15:32:00
--  
打开\\kindeditor\\e.html

把其中代码
window.external.RequestContent(editor.html());

改为

window.external.RequestContent(editor.text());

--  作者:ljh29206
--  发布时间:2016/8/6 21:01:00
--  
老师再问下,如何对已经生成html格式的文本转换?
--  作者:大红袍
--  发布时间:2016/8/7 12:49:00
--  

Dim str As String = "<p>123456789</p><p>123456789</p><p>123456789</p>"
Dim web As new Windows.forms.Webbrowser
web.DocumentText = str

Do until web.document.all.count > 0
    Application.DoEvents
Loop

Output.Show(web.document.all(0).innerText)


--  作者:ljh29206
--  发布时间:2016/8/9 13:53:00
--  
ok了 谢谢。

请教下

Dim web As new Windows.forms.Webbrowser   这个的作用是什么呢?

窗体中 没看到添加到这个控件。

Do until web.document.all.count > 0
    Application.DoEvents
Loop

为什么 要 加入这个呢?
作用是什么哇?


--  作者:Hyphen
--  发布时间:2016/8/9 14:34:00
--  
类似等待页面加载完成
--  作者:大红袍
--  发布时间:2016/8/9 14:39:00
--  

 new 一个 webbrowser,目的是把你html转换成Text,因为它的方法比较方便。

 

 你也可以自己替换的,用正则表达式,如

 

Dim html As String = "<p>123456789</p><p>123456789</p><p>123456789</p>"

Dim objRegEx As System.Text.RegularExpressions.Regex
Return objRegEx.Replace(HTML, "<[^>]*>", "")