如何在水晶报表中显示HTML格式数据 [英] How to Display HTML formatting data in crystal report

查看:75
本文介绍了如何在水晶报表中显示HTML格式数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

i stored html data in to table and while i displaying these records to crystal report is shows a plain text instead of formatted text.. I used ajaxcontroll toolkit to get the html data. my code is like below:


<pre lang="HTML"><body>
    <form id="form1" runat="server">
    <div>
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
        <asp:TextBox runat="server" ID="txt" Height="500px" Width="1000px"></asp:TextBox><br />
        <asp:HtmlEditorExtender ID="HtmlEditorExtender1" TargetControlID="txt" ClientIDMode="AutoID"

            DisplaySourceTab="false" EnableSanitization="false" runat="server">
        </asp:HtmlEditorExtender>
        <br />
        <asp:Button runat="server" ID="btn" Text="Submit" OnClick="btn_Click" /><br />
        <asp:Label runat="server" ID="lbl"></asp:Label>
    </div>
    <br />
    <br />
    <CR:CrystalReportViewer ID="CrystalReportViewer1"  runat="server" AutoDataBind="true" />
    </form>
</body>





和.cs文件类似:





And .cs File like :

protected void btn_Click(object sender, EventArgs e)
{
    lbl.Text = txt.Text;//.Content;
    DataTable dt = new DataTable();
    dt.Columns.Add("Data", typeof(string));
    dt.Rows.Add(txt.Text);
    dt.TableName = "DataTable1";

    ReportDocument cryRpt = new ReportDocument();
    cryRpt.Load(Server.MapPath("~/Report/CrystalReport.rpt"));
    cryRpt.SetDataSource(dt);
    CrystalReportViewer1.ReportSource = cryRpt;
}







I set the Text Interpretation property to HTML Text of data field in crystal report... But still it displayed plain text..

Thanks in Advance

推荐答案

根据我过去的经验,Crystal Reports不支持所有HTML标记/属性。请检查您用于存储的标签并在Crystal中显示HTML。



支持的HTML标签是:



html



身体



div(导致段落休息)



tr(仅导致a段落;不保留表格的列结构)



span



font



p(导致段落休息)



br(导致段落休息)



h1(导致段落中断,使字体变粗,两次默认大小)



h2(导致段落中断,使字体变为粗体&1.5倍默认大小)



h3(导致段落中断,使字体粗体和9/8默认大小)



h4(导致段落中断,使字体变粗)



h5(导致段落中断,使字体变为粗体和5/6默认尺寸)



h6(导致段落,使字体变粗,5/8默认大小)



中心



大(字体大小增加2点)



小(字体大小减少2点)如果是8分或更大)



b



i


s



strike


$ b $



支持的HTML属性为:



align



face



尺寸



颜色



风格



font-family



font-size



字体风格



字体重量



ul(项目符号列表)



ol(有序列表)



li(标签定义用于两种列表类型的列表项:ul和ol。 )



支持的HTML属性是:



强(粗体)



另外,有一点需要注意的是,根据Crystal Reports的版本,支持的标签列表可能会有所不同。



希望这有帮助,

谢谢
From my past experience, Crystal Reports does not support all HTML Tags/attributes. Please check the tags your are using to store and display the HTML in Crystal.

The supported HTML tags are:

html

body

div (causes a paragraph break)

tr (causes only a paragraph break; does not preserve column structure of a table)

span

font

p (causes a paragraph break)

br (causes a paragraph break)

h1 (causes a paragraph break, makes the font bold & twice default size)

h2 (causes a paragraph break, makes the font bold & 1.5 times default size)

h3 (causes a paragraph break, makes the font bold & 9/8 default size)

h4 (causes a paragraph break, makes the font bold)

h5 (causes a paragraph break, makes the font bold & 5/6 default size)

h6 (causes a paragraph break, makes the font bold & 5/8 default size)

center

big (increases font size by 2 points)

small (decreases font size by 2 points if it's 8 points or larger)

b

i

s

strike

u

The supported HTML attributes are:

align

face

size

color

style

font-family

font-size

font-style

font-weight

ul ( bulleted list )

ol ( ordered list )

li ( tag defining a list item used for both list type: ul and ol. )

The supported HTML attributes are:

strong ( bold )

Also, one thing to mention that, based on the version of Crystal Reports the list of the tags supported could vary.

Hope that helps,
Thanks


这篇关于如何在水晶报表中显示HTML格式数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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