Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Correct Line spacing in a Text Object

Status
Not open for further replies.

rellymr

Programmer
Jul 15, 2003
3
GB
I am attempting to set the contents of a text object in crystal reports to contain the same text (including spacing) as is contained in a C# text box on a form.

I had to avoid parameters to do this because of size constraints.

Unfortunately the spacing is the problem.

The text object on the crystal report does not recognise the new line character. Not \r or \n or \r\n.

My code to transfer the text boxes contents across is as follows. Although I don't think that its the problem.

All help would be VERY much appreciated

c#

body = bodyForm.LetterBody;
//body = body.Replace("\n",Convert.ToChar(13).ToString());

FreeStyleLetter freerpt = new FreeStyleLetter();
freerpt.SetDataSource(freeds);
//Get all the sections in the report
Sections reportSections = freerpt.ReportDefinition.Sections;

foreach(Section section in reportSections) {
//Get all the report objects from each section
ReportObjects reportObjects = section.ReportObjects;

//Loop through each report object
foreach(ReportObject reportObject in reportObjects) {

if (reportObject.Name.Equals("Body")) {

try { ((TextObject)reportObject).Text = body;
}
catch(Exception ex) { MessageBox.Show(ex.ToString());
} }
}
}
ReportViewer rv=new ReportViewer(freerpt);
 
Isn't \r\n unix?

Anyway, the equivalent of \n in C# is Chr(13) in Crystal.

Naith
 
I have tried the CHAR(13) it is \r.

Your right \r\n is in unix.

Unfortunately this doesn't work either

Thanks for the suggestion anyway
 
I didn't say Char(13). That's a datatype and attribute.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top