ReportViewer – How to format phone numbers

I am building a ReportViewer report and need to format phone numbers. For example, I want “5551234” to be formatted as “555-1234.”

Specify the phone number format

Use the following expression:

=Format(Convert.ToDouble(Fields!PhoneNumber.Value), "###-####")

Now when I run the report it looks like this:

Other formatting examples

In my example above I was using a very simple format. The general pattern is to use # as placeholders for numbers. They will be filled in from the right-to-left.

When the data looks like thisand I want thisFormat to use
5551234555-1234###-####
5555555555(555) 555-5555(###) ###-####
555555512 555-5555 Ext. 12###-#### Ext. ##

Leave a Comment