I am using Q1 2011 version of Telerik Reporting.
Scenario:
I am using User Functions to build an address (and some other key information) for Shipping information (contained in 2 subreports) that are used in an Order Detail report.
Here is the code for the User Function that builds the Ship To information:
The Issue:
When this information is displayed in the Web Report Viewer, I see all of the information; however, there should be an empty line between the last line of the address and the "Carrier". In the Web Report Viewer, this does not occur. In addition, when you print the report (or export to PDF -- the same thing), the empty line occurs between the last line of the address and the "Carrier" (which matches the user function) BUT the Ship Dt goes misssing.
See the attached files UserFunctionAddress_In_Viewer.jpg and UserFunctionAddress_As_PDF.jpg. Check out the Ship To Address information about 1/2 way across the image to see what I am talking about.
I went back through the main report and subreport and checked height settings for textbox report controls, sections, etc. In addition, I confirmed that the textbox control has CanGrow=True. All settings appear to be set correctly. Certainly, the web report viewer agrees since the user can visually see all the information...but the export to PDF drops some information (in this case the Ship Dt).
Learnings:
Scenario:
I am using User Functions to build an address (and some other key information) for Shipping information (contained in 2 subreports) that are used in an Order Detail report.
Here is the code for the User Function that builds the Ship To information:
Public
Shared
Function
GetShipToInfo(
ByVal
Name
As
Object
,
ByVal
Addr1
As
Object
,
ByVal
Addr2
As
Object
,
ByVal
City
As
Object
,
ByVal
State
As
Object
,
ByVal
PostalCode
As
Object
,
ByVal
Country
As
Object
,
ByVal
Carrier
As
Object
,
ByVal
ShipDate
As
Object
)
As
String
Dim
address
As
String
=
""
If
Not
IsDBNull(Name)
AndAlso
Name IsNot
Nothing
Then
address &= Name.ToString.Trim & vbCr
End
If
If
Not
IsDBNull(Addr1)
AndAlso
Addr1 IsNot
Nothing
Then
address &= Addr1.ToString.Trim & vbCr
End
If
If
Not
IsDBNull(Addr2)
AndAlso
Addr2 IsNot
Nothing
AndAlso
Addr2.ToString.Trim.Length > 0
Then
address &= Addr2.ToString.Trim & vbCr
End
If
If
Not
IsDBNull(City)
AndAlso
City IsNot
Nothing
Then
address &= City.ToString.Trim
End
If
If
Not
IsDBNull(State)
AndAlso
State IsNot
Nothing
Then
address &=
", "
& State.ToString.Trim
End
If
If
Not
IsDBNull(PostalCode)
AndAlso
PostalCode IsNot
Nothing
Then
address &=
" "
& PostalCode.ToString.Trim & vbCr
End
If
If
Not
IsDBNull(Country)
AndAlso
Country IsNot
Nothing
AndAlso
Country.ToString.Trim.Length > 0
Then
address &= Country.ToString.Trim & vbCr
End
If
address &= vbCr &
"Carrier: "
If
Not
IsDBNull(Carrier)
AndAlso
Carrier IsNot
Nothing
Then
address &= Carrier.ToString.Trim
End
If
address &= vbCr
address &=
"Ship Dt: "
If
Not
IsDBNull(ShipDate)
AndAlso
ShipDate IsNot
Nothing
Then
address &=
CDate
(ShipDate).ToString(
"d"
)
End
If
Return
address
End
Function
The Issue:
When this information is displayed in the Web Report Viewer, I see all of the information; however, there should be an empty line between the last line of the address and the "Carrier". In the Web Report Viewer, this does not occur. In addition, when you print the report (or export to PDF -- the same thing), the empty line occurs between the last line of the address and the "Carrier" (which matches the user function) BUT the Ship Dt goes misssing.
See the attached files UserFunctionAddress_In_Viewer.jpg and UserFunctionAddress_As_PDF.jpg. Check out the Ship To Address information about 1/2 way across the image to see what I am talking about.
I went back through the main report and subreport and checked height settings for textbox report controls, sections, etc. In addition, I confirmed that the textbox control has CanGrow=True. All settings appear to be set correctly. Certainly, the web report viewer agrees since the user can visually see all the information...but the export to PDF drops some information (in this case the Ship Dt).
Learnings:
- If you are using User Functions to build text (especially if you are adding carriage returns) do not rely on the visual look in the Telerik Report Viewer. You must check the visual representation of the report as a PDF. [Note: When Telerik Reporting prints a report, it renders it as a PDF first.]
- Again, if you are using User Functions, you should set the size of any Textbox Reporting Control to the maximum size you expect to see from your data set. You cannot rely on the CanGrow property to handle the data overflow.
Hopefully this may help some of the other Telerik Reporting developers out there. The key is...ALWAYS ALWAYS ALWAYS check the report as a PDF before deploying reports to your user community.