cancel
Showing results for 
Search instead for 
Did you mean: 

Line Feed Char printing as a Square[]

Former Member
0 Kudos

I have a Function field called @Property Address.

It contains the following where ChrW(10) = New Line character:

WhilePrintingRecords;

StringVar PropertyAddress;

PropertyAddress:= " ";

If {?HotelAddress1} <> "" then

PropertyAddress:= PropertyAddress & {?HotelAddress1} ;

If {?HotelAddress2} <> "" then

PropertyAddress:= PropertyAddress & ChrW(10) & {?HotelAddress2} ;

If {?HotelCity} <> "" then

PropertyAddress:= PropertyAddress & ChrW(10) & {?HotelCity} & ", " & {?HotelState} & " " & {?HotelZip};

If {@PropertyPhones} <> "" then

PropertyAddress:= PropertyAddress & ChrW(10) & {@PropertyPhones} ;

If {@WebEmail} <> "" then

PropertyAddress:= PropertyAddress & Chr(10) & {@WebEmail} ;

Trim(PropertyAddress)

When previewing report in CR2008 Viewer it looks great. I get the address block renedered nicely.

When I print to printer I get a Sqaure representing the LF on every line.

How can I get this to stop rendering the sqaure???

Fixed spelling - Edited by: InnMate on Sep 18, 2009 7:07 PM

Accepted Solutions (1)

Accepted Solutions (1)

ted_ueda
Employee
Employee
0 Kudos

Is this a "Java Development - Crystal Reports" question? I see no Java here.

Sincerely,

Ted Ueda

Former Member
0 Kudos

We are using CR4E v2 -and the viewer is 12.0.0.

i.e. we are using Java Eclipse. I thought this might be relevant to anwering the question.

The Problem is as stated "Line Feed Character is printing as a Square[]" when using this viewer to print report.

The same report in development environment prints without the Square.

ted_ueda
Employee
Employee
0 Kudos

For next time, you'll need to specify product and version and actual viewer, since we have so many.

So export to PDF - do you see the boxes?

If so, copy the characters and paste to MS Word or some other word processor, and try changing the font to something universal like Arial Unicode. What do you see? Still the empty box?

Boxes mean that the character under the encoding scheme was understood, but the font has no glyph representation for it (as opposed to "?", which means that the character enconding value doesn't correspond to an actual character).

Sincerely,

Ted Ueda

Former Member
0 Kudos

The boxes appear in PDF as well.

The only time I they do not print is when I run the report out of the development environment.

The character is a Linefeed character - it should have no printable representation.

I have also changed the code from CnrW(10) to ChrW(13) i.e. Carriaiage Return and I have the same issue. Again this should have no visible character representation.

I took your advice and pasted the character in Word and again I get a box no matter what font I use

Do you have any suggestions on how am i suppossed to add a CRLF to a string and have it render as Blank?.

Note this report is a report upgraded from v8.5 the only change was to make the formula chrW(10) instead of Chr(10).

It rendered fine in 8.5

ted_ueda
Employee
Employee
0 Kudos

I don't see that on mine - expectation is that linefeeds are ignored.

If what you want to have is breaking of lines, you can try:


thisstring & "<br>" & thatstring

and when you display, turn on HTML Text Representation for the field.

Sincerely,

Ted Ueda

Former Member
0 Kudos

IIncase you did not understand - This displays correctly in the viewer window but not when physically printed or saved to PDF

I cannot even code the suggested string in the function as you specified it.

I get error when trying to save it.

This is obviously a viewer isssue as the report prints fine from development environment.

The crappy viewer just does not know the difference between print control characters and Unicode text characters.

Also I upgraded to the latest viewer and thew problem still persists.

former_member450831
Discoverer
0 Kudos

I have the same problem in my reports. I have a Function Field contains a function like : formula="text1" & ChrW(10) & ChrW(13) & "text2". While previewing report using the viewer, everything is ok. But if I try to create pdf using Virtual Printer

(e.g. Bullzip) using the following code: reportClientDocument.getPrintOutputController().printReport(printReportOptions); I get two squares on the end of line.

Im using Virtual Printer because PrintOutputController.export doesn't work correctly for justified text with formatted fonts.

Former Member
0 Kudos

Try using Chr(13) instead of ChrW(10) and ChrW(13)

Thats what I use in my address blocks and I dont have any problems.

Also I would strongly suggest declaring your variable as a Local Stringvar, if you use it on multiple pages, your memory

usage can get quick big.


Local Stringvar Address;

Address := "";

IF  Not(IsNull({PROP.PR_ADD1})) then Address := {PROP.PR_ADD1};
IF  Not(IsNull({PROP.PR_ADD2})) then Address := Address + Chr(13) + {PROP.PR_ADD2};
IF  Not(IsNull({PROP.PR_ADD3})) then Address := Address + Chr(13) + {PROP.PR_ADD3};
IF  Not(IsNull({PROP.PR_ADD4})) then Address := Address + Chr(13) + {PROP.PR_ADD4};
IF  Not(IsNull({PROP.PR_ADD5})) then Address := Address + Chr(13) + {PROP.PR_ADD5};
IF  Not(IsNull({PROP.PR_ADD6})) then Address := Address + Chr(13) + {PROP.PR_ADD6};
IF  Not(IsNull({PROP.PR_POST})) then Address := Address + Chr(13) + {PROP.PR_POST};

while (InStr(1,Address,Chr(13)) = 1) Do (
	Address := Mid(Address,2)
);

Address;

Answers (0)