我写入数据库的时候是从word上复制然后粘贴上去的,然后在页面上是用label控件读出来的,可是写入的时候,是有带word格式的,在用label读取的时候,label是空的,所以我想过滤那些格式,不知道怎么做,请各位前辈帮帮忙,看如何过滤下word格式在label上显示出来
解决方案 »
- 关于checkbox选中的问题
- ASP.NET 水晶报表 填充到DataSet的问题
- 感觉用.net做东西很崩溃...
- 格式化GridView1中一列,使其按照指定格式显示
- 在服务器端怎么判断引发当前submit的控件呢?
- 问大家个问题,只有这点分了,只怪以前散的太快嘿嘿!
- .Add(""+txtAddress.Text+"")和.Add(txtAddress.Text)有区别吗?
- 求asp.net验证及dataGrid控件用法
- asp:button在客户端按下时,怎先弹出“是/否”对话框,用户选择“是”再提交?
- 招贤,有使用.NET写过项目的优先
- gridview问题
- 水晶报表无法变成“ strongly-typed“报表
function word(string X)
{
读取X
字符串处理函数 \n 替换 <br\> 其它类同
retrun X
}各式去掉:
function word(string X)
{
读取X
字符串处理函数 \n 替换 空格 其它类同
retrun X
}
BBB
CCC转换成AAABBBCCC,替换格式符号就可以了。
private string CleanWordHtml(string html)
{
StringCollection sc = new StringCollection();
// get rid of unnecessary tag spans (comments and title)
sc.Add(@"<!--(\w|\W)+?-->");
sc.Add(@"<title>(\w|\W)+?</title>");
// Get rid of classes and styles
sc.Add(@"\s?class=\w+");
sc.Add(@"\s+style='[^']+'");
// Get rid of unnecessary tags
//sc.Add(@"<(meta|link|/?o:|/?style|/?div|/?st\d|/?head|/?html|body|/?body|/?span|!\[)[^>]*?>");
sc.Add(@"<(meta|link|/?o:|/?style|/?font|/?strong|/?st\d|/?head|/?html|body|/?body|/?span|!\[)[^>]*?>");
// Get rid of empty paragraph tags
sc.Add(@"(<[^>]+>)+ (</\w+>)+");
// remove bizarre v: element attached to <img> tag
sc.Add(@"\s+v:\w+=""[^""]+""");
// remove extra lines
sc.Add(@"(\n\r){2,}");
foreach (string s in sc)
{
html = Regex.Replace(html, s, "", RegexOptions.IgnoreCase);
}
return html;
}