那就用回textbox 显示.
textbox 加样式:<asp:textbox cssclass="content" ....content
{
border: 0px;
OVERFLOW-Y: visible;
font-size: 12px;
width: 600px;
line-height: 150%;
font-family: 'ÐÂËÎÌå', Verdana;
height: 40px;
background-color: transparent;
cursor:default;
}
textbox 加样式:<asp:textbox cssclass="content" ....content
{
border: 0px;
OVERFLOW-Y: visible;
font-size: 12px;
width: 600px;
line-height: 150%;
font-family: 'ÐÂËÎÌå', Verdana;
height: 40px;
background-color: transparent;
cursor:default;
}
{
strContent=strContent.Replace("&","&");
strContent=strContent.Replace("'","''");
strContent=strContent.Replace("<","<");
strContent=strContent.Replace(">",">");
strContent=strContent.Replace("chr(60)","<");
strContent=strContent.Replace("chr(37)",">");
strContent=strContent.Replace("\"",""");
strContent=strContent.Replace(";",";");
strContent=strContent.Replace("\r\n","<br>");
strContent=strContent.Replace(" "," ");
return strContent;
}
或者显示在Span、Label中,把回车换行符换成html的换行标签
比如文件标题要显示在中间还有就是文件中可能有连接或表格之类的HTML语句,如果把空格换掉就不行了。
this.Controls.Add(new LiteralControl("<FONT SIZE=2 color=#000066><B>"+myReader.GetString(1).ToString()+"</B></FONT>"));
{
str=str.Replace(" "," ");//处理空格
str=str.Replace("<","<");//处理小于号
str=str.Replace(">",">");//处理大于号
str=str.Replace("\n","<br>");//处理换行
return str;
}
private string formatString_too(string str)
{
str=str.Replace(" "," ");//处理空格
str=str.Replace("<","<");//处理小于号
str=str.Replace(">",">");//处理大于号
str=str.Replace("<br>","\n");//处理换行
return str;
}