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.
- 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.