How to make line break in CrystalReports?

Hello
I'm developing application in VB.NET
I have crated crystalReport with TextObject "Header".
Now I need to change text in "Header" based on what I get from database.
I also need to break the text in specified places.
So if I have in my database:     "This is my Header \n New line is here"
I need to break line on "\n"
I tried Replace("string", "\n",NewLine) but its not working.
How can I break line in crystalreport?

Best Regards
FooKy
LVL 11
f_o_o_k_yAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jorge PaulinoIT Pro/DeveloperCommented:
Have you tried to use all this:

Chr(10)
Chr(13)
or
VbCrLf

0
mlmccCommented:
When you say replace do you mean you will change the field on the fly or are you replacing it with a formula.

The CHR(10) or chr(13) should work to replace the \n.
Have you tried using the built in HATML display capability?

If you right click the field and click FORMAT FIELD
One of the options on the PARAGRAPH tab is TEXT INTERPRETATION.  Select HTML

mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
f_o_o_k_yAuthor Commented:
Hello,
Sorry for delay but there was a power cut-off in my neighbourhood due to strong winds.

Below I attach code with description of what I'm trying to do.

I also looked at format field -> paragraph tab but there was nothing about text interpretation (maybe because its not full version of CrystalReports but only this what is VS 2005 TeamSuite)
See screenshot.

Best Regards
FooKy
Dim rtxt As CrystalDecisions.CrystalReports.Engine.TextObject = CType(rpt1.ReportDefinition.ReportObjects.Item("TextHeader"), CrystalDecisions.CrystalReports.Engine.TextObject)
 
rtxt.Text = Replace(dr2("header"), "\n", vbNewLine)
'Also tryed 
rtxt.Text = Replace(dr2("header"), "\n", Chr(10) & Chr(13))
rtxt.Text = Replace(dr2("header"), "\n", "<br>")
rtxt.Text = Replace(dr2("header"), "\n", "<br />")
rtxt.Text = Replace(dr2("header"), "\n", vbCrLf)

Open in new window

paragraph.png
0
Jorge PaulinoIT Pro/DeveloperCommented:
When I want to use text with breaks I always use parameter fields. Add a new parameter field and then do this:

Dim strFooter As String = "My text using breaks ..."
Dim rpt As New rptTest()
rpt.SetParameterValue("txtFooter", strFooter) 'txtFooter is the name of the parameter field in the report

jpaulino
0
f_o_o_k_yAuthor Commented:
Thanks.
Both answers were accurate.
First i thought that mlmcc was taking about text object but TEXT INTERPRETATION is only in parameter field.
so I used it and code from jpaulino and replaced \n to

Best Regards
FooKy
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.