Reportpax Labels Questions
How do I eliminate blank lines when printing labels?
Here is a quick tip on eliminating blank lines when printing labels. To give you an example of this, let's say you are printing an Address Line 1 and an Address Line 2 on your labels. However some records do not have an Address Line 2 and you do not want to have the blank line printed for those labels (similar to the picture below where the first record does not have a company so a blank line is printed):

To fix this, you just need to add some custom code to fit your needs:
1) Bring up the report in VS and click Report -> Report Properties menu item
2) Click the Code tab and paste this code at the bottom:
function FieldThenNewLine(field)
if field = "" then
return ""
else
return field & chr(13) & chr(10)
end if
end function
3) Now you must edit the Label expression to something like this:
=
Code.FieldThenNewLine(Fields!ContactName.Value) &
Code.FieldThenNewLine(Fields!CompanyName.Value) &
Code.FieldThenNewLine(Fields!Address.Value) &
Code.FieldThenNewLine(Fields!City.Value & ", " &
Fields!Region.Value & " " & Fields!PostalCode.Value) &
Code.FieldThenNewLine(Fields!Phone.Value)
Now a new line will only print if the field is not blank.
Last update: 2007-12-11 15:41
Author: ReportPax Support
Revision: 1.1
Print this record
Send to a friend
Show this as PDF file
Export as XML-File
You can comment on this entry
