Friday 1 July 2016

Pad Char - In RDLC Report

Hello Everyone,

I was upgrading report from Nav 2009 R2 to Nav 2016. I found an interesting feature that I did in RDLC in correspondence to section property.

For one of the text box in Nav 2009 R2 I saw that a Pad Char property set to * as shown in snapshot 1. There is no such property in RDLC.

So I found a way to do this.


Snapshot 1 - Nav 2009 R2 - Section

Check

Snapshot 2 - Nav 2016 – RDLC – Code

RDLC

Code

Public Function MyPaddedString(ByVal Value As String)
    Return Value.PadLeft(27,"*")
End Function

Function Call

Function Call














Code
=Code.MyPaddedString(Choose(25,Split(Cstr(ReportItems!CompanyAddresses.Value),Chr(177))))

Snapshot 3 - Output – Nav 2009 R2

Check

Snapshot 4 - Output – Nav 2016

Check

And its done.

So similarly it can be done for Padding Right also.

Hope this thing some time helps in upgrading reports.


Your valuable comments and feedback are appreciated.

"Power is gained by Sharing Knowledge not hoarding it"