Click here to Skip to main content
15,882,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
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>


And .cs File like :

C#
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;
}


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

Thanks in Advance
Posted
Updated 20-Feb-15 22:41pm
v2

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900