I'm new to Crystal Reports and I'm wondering if it can print/display html.
I have a column in my database that holds the HTML, and I want the data in this column to be in the detail of the report keeping the HTML format.
So far, I've got the IFieldObject for the column dragged onto the report, and set the "TextFormat" option to "crHTMLText". I've also right-clicked the object, went to the paragraph tab, and set the "Text Interpretation" option to "HTML Text".
But when I preview the report, it looks like it is actually stripping out the HTML. It does apply simple HTML formatting for things like bolding, italicizing, and underlining. But HTML tables and bulleted lists lose all their formatting.
Reza Nassabeh www.professionalcsharp.com Don't forget to click Mark as Answer on the post that helped. That way future readers will know which post solved the issue.
I'm not doing anything with css. The HTML from the database that I'm attempting to display is simple and looks like this:
Here's some text formatting:
<b>This should be bold</b>, <u>This should be underlined</u>, <i>This should be italicized</i>.
<br><br>
Here's a table:
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td>column 1</td>
<td>column 2</td>
<td>column 3</td>
</tr>
<tr>
<td>value 1</td>
<td>value 2</td>
<td>value 3</td>
</tr>
<tr>
<td>value 1</td>
<td>value 2</td>
<td>value 3</td>
</tr>
</table>
<br><br>
Here's an ordered list:
<ol>
<li>Item in list</li>
<li>Item in list</li>
<li>Item in list</li>
<li>Item in list</li>
</ol>
But when the above HTML is displayed in the report, only the bolding, underlining, and italicizing are applied. It's like the rest of the HTML tags are stripped out. The content inside the HTML table and ordered list are still displayed, but it's all jumbled
together with no alignment, borders, indenting, bullet points, numbering etc. So the output of the report using the above html looks like this:
Here's some text formatting: This should be bold, This should be underlined, This should be italicized.
Here's a table:
column 1column 2column 3
value 1value 2value 3
value 1value 2value 3
Here's an ordered list:
Item in list
Item in list
Item in list
Item in list
I am trying to do a similar thing in that I am creating a text field formula and would like to embed the html in the formula field. I find that 1) not all of the html tags are being properly executed, and 2) if I have a chr(10) while html is activated,
it does not work. Also if I the field with leading blanks e.g. " Text starts here", and html is active, it ignores the leading blanks, and everything is displayed starting at the left hand margin.
Nope, I never got a clear answer on how to do this, so I eventually abandoned using Crystal Reports.....it seems like it should support this, and does have some html capability, but since it seems to ignore most html tags besides simple formatting, it's
kinda useless.
I am only adding this reply for future reference, in case others are asking the same question.
It appears that Crystal Reports only supports a small subset of HTML tags and attributes.
The supported 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 attributes are:
align
face
size
color
style
font-family
font-size
font-style
font-weight
Without looking at it too closely, I think I can answer your question.
Create a formula field for the text fields for which you want to utilize the html. Place your html tags (bold, underline, etc) around the fields utilizing double quotes. When it is properly tagged via html, here is how you make it display:
right click on the object.
choose "format field"
go to paragragh. Select the drop down in "Text Interpretation". Choose "HTML Text". Crystal Reports will now acknowledge all of your HTML tags that you utilized to format your text. Hope that helps, although I realize that this is an old thread (but
maybe it will help somebody else).
But I have problems with formatting.
How can I fix the size of text to match the rest of my report?
HTML box comes from a input field where the size can vary depending on what the user selects.
redwing19
Member
400 Points
180 Posts
Possible to display HTML with Crystal Reports?
Jan 22, 2008 10:03 PM|LINK
I'm new to Crystal Reports and I'm wondering if it can print/display html.
I have a column in my database that holds the HTML, and I want the data in this column to be in the detail of the report keeping the HTML format.
So far, I've got the IFieldObject for the column dragged onto the report, and set the "TextFormat" option to "crHTMLText". I've also right-clicked the object, went to the paragraph tab, and set the "Text Interpretation" option to "HTML Text".
But when I preview the report, it looks like it is actually stripping out the HTML. It does apply simple HTML formatting for things like bolding, italicizing, and underlining. But HTML tables and bulleted lists lose all their formatting.
What's going on? Can I not do this?
r_nassabeh
Contributor
3106 Points
505 Posts
Re: Possible to display HTML with Crystal Reports?
Jan 23, 2008 07:08 AM|LINK
Talking about formatting, are you using CSS, if yes dont forget to set the CssFileName property of the report viewer. You can also take a look at http://msdn2.microsoft.com/en-us/library/ms225493(VS.80).aspx
www.professionalcsharp.com
Don't forget to click Mark as Answer on the post that helped. That way future readers will know which post solved the issue.
redwing19
Member
400 Points
180 Posts
Re: Possible to display HTML with Crystal Reports?
Jan 23, 2008 05:51 PM|LINK
I'm not doing anything with css. The HTML from the database that I'm attempting to display is simple and looks like this:
Here's some text formatting:
<b>This should be bold</b>, <u>This should be underlined</u>, <i>This should be italicized</i>.
<br><br>
Here's a table:
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td>column 1</td>
<td>column 2</td>
<td>column 3</td>
</tr>
<tr>
<td>value 1</td>
<td>value 2</td>
<td>value 3</td>
</tr>
<tr>
<td>value 1</td>
<td>value 2</td>
<td>value 3</td>
</tr>
</table>
<br><br>
Here's an ordered list:
<ol>
<li>Item in list</li>
<li>Item in list</li>
<li>Item in list</li>
<li>Item in list</li>
</ol>
But when the above HTML is displayed in the report, only the bolding, underlining, and italicizing are applied. It's like the rest of the HTML tags are stripped out. The content inside the HTML table and ordered list are still displayed, but it's all jumbled together with no alignment, borders, indenting, bullet points, numbering etc. So the output of the report using the above html looks like this:
Here's some text formatting:
This should be bold, This should be underlined, This should be italicized.
Here's a table:
column 1column 2column 3
value 1value 2value 3
value 1value 2value 3
Here's an ordered list:
Item in list
Item in list
Item in list
Item in list
redwing19
Member
400 Points
180 Posts
Re: Possible to display HTML with Crystal Reports?
Jan 28, 2008 05:30 PM|LINK
Bumping this in hopes someone can help....
Swadhin
Member
12 Points
3 Posts
Re: Possible to display HTML with Crystal Reports?
Feb 28, 2008 04:44 AM|LINK
Hi,
Hope following link will help you.
http://vbcity.com/forums/topic.asp?tid=107792
Thanks,
Swadhin.
lsg0622
Member
2 Points
1 Post
Re: Possible to display HTML with Crystal Reports?
Jun 20, 2008 06:38 PM|LINK
I am trying to do a similar thing in that I am creating a text field formula and would like to embed the html in the formula field. I find that 1) not all of the html tags are being properly executed, and 2) if I have a chr(10) while html is activated, it does not work. Also if I the field with leading blanks e.g. " Text starts here", and html is active, it ignores the leading blanks, and everything is displayed starting at the left hand margin.
Were you able to resolve the problem?
redwing19
Member
400 Points
180 Posts
Re: Possible to display HTML with Crystal Reports?
Jun 30, 2008 05:37 PM|LINK
Nope, I never got a clear answer on how to do this, so I eventually abandoned using Crystal Reports.....it seems like it should support this, and does have some html capability, but since it seems to ignore most html tags besides simple formatting, it's kinda useless.
cliffpartrid...
Member
11 Points
7 Posts
Re: Possible to display HTML with Crystal Reports?
Aug 26, 2009 12:40 PM|LINK
I am only adding this reply for future reference, in case others are asking the same question.
It appears that Crystal Reports only supports a small subset of HTML tags and attributes.
The supported 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 attributes are:
align
face
size
color
style
font-family
font-size
font-style
font-weight
noelman
Member
2 Points
1 Post
Re: Possible to display HTML with Crystal Reports?
Mar 04, 2010 06:12 PM|LINK
Without looking at it too closely, I think I can answer your question.
Create a formula field for the text fields for which you want to utilize the html. Place your html tags (bold, underline, etc) around the fields utilizing double quotes. When it is properly tagged via html, here is how you make it display:
right click on the object.
choose "format field"
go to paragragh. Select the drop down in "Text Interpretation". Choose "HTML Text". Crystal Reports will now acknowledge all of your HTML tags that you utilized to format your text. Hope that helps, although I realize that this is an old thread (but maybe it will help somebody else).
Noel
Svammi
Member
2 Points
1 Post
Re: Possible to display HTML with Crystal Reports?
Mar 06, 2010 05:36 PM|LINK
The above also works fine for me.
But I have problems with formatting. How can I fix the size of text to match the rest of my report? HTML box comes from a input field where the size can vary depending on what the user selects.