When the web service is asked to return a
FormattedAddress, it can do so in a number of ways according to your preferences. By default, the returned address will contain precisely six address lines followed by the postcode, with the town and county information always stored in lines 5 and 6. However, by providing
Options to the method that returns the address you can have complete control over how the address will be formatted. The list below describes the options that can be provided.
- Formatter. This option can be set to the name of a pre-defined formatting type that controls how the address is formatted. The following values are allowed:
- DefaultFormatter. This is the standard formatting type as described above.
- NoOrganisationFormatter. This works in the same way as the DefaultFormatter, but omits any organisation or departmental information from the address.
- PAFStandardFormatter. This produces an address in the standard format recommended by the Royal Mail for printing addresses on envelopes. It produces FormattedAddresses containing however many lines are necessary to hold the information stored in each particular address, and does not use any county information.
- MaxLines. When either the DefaultFormatter or NoOrganisationFormatter is selected, this option can be set to the maximum number of lines to be included in the address. The default value is 6. Note that the line for the postcode is not included in this number.
- MaxLineLength. When either the DefaultFormatter or NoOrganisationFormatter is selected, this option can be set to the maximum number of characters to be included on each line. The default value is 40. When a line in the address is over this limit, it will either be abbreviated where possible, or cut off at the maximum number of characters.
- FixTownCounty. When either the DefaultFormatter or NoOrganisationFormatter is selected, this option can be set to true to always reserve the last two lines before the postcode for the town and county information, or false to display the town and county in the lines immediately following the rest of the address.
- FixBuilding. Places the building name/number into the first line of the address, separate from any street information.
- ExcludeCounty. No county information will be included in the formatted addres.
- UseAnyAvailableCounty. If no postal county is available for the address, use the traditional or administrative county information to fill the gap.
- Casing. Specify as "Upper", "Lower" or "Proper" to enforce the case of all address information except town/city, or leave as "CountryDefault" to use the standard rules for the appropriate country.
- TownCasing. Specify as "Upper", "Lower" or "Proper" to enforce the case of the town/city information, or leave as "CountryDefault" to use the standard rules for the appropriate country.
- UnwantedPunctuation. If there are certain characters that are not allowed in your address fields, specify them all in this option and they will be removed from the formatted address.
- ConcatenateAddressLines. When this option is set to true the address is first formatted into multiple lines according to the other options described above, then those lines are concatenated together separated by spaces.
- PreferredLanguage. Set this to
cyto retrieve addresses in Welsh where available, or
ento prefer English. Addresses are returned in English when this option is not specified.