FieldAddressBlockFormatAddressOnCountryOrRegion Property
Gets or sets whether to format the address according to the country/region of the recipient as defined by POST*CODE (Universal Postal Union 2006).

Namespace: Aspose.Words.Fields
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.12
Syntax
public bool FormatAddressOnCountryOrRegion { get; set; }

Property Value

Type: Boolean
Examples
Shows how to build a field address block.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Use a document builder to insert a field address block
FieldAddressBlock field = (FieldAddressBlock)builder.InsertField(FieldType.FieldAddressBlock, true);

// Initially our field is an empty address block field with null attributes
Assert.AreEqual(" ADDRESSBLOCK ", field.GetFieldCode());

// Setting this to "2" will cause all countries/regions to be included, unless it is the one specified in the ExcludedCountryOrRegionName attribute
field.IncludeCountryOrRegionName = "2";
field.FormatAddressOnCountryOrRegion = true;
field.ExcludedCountryOrRegionName = "United States";

// Specify our own name and address format
field.NameAndAddressFormat = "<Title> <Forename> <Surname> <Address Line 1> <Region> <Postcode> <Country>";

// By default, the language ID will be set to that of the first character of the document
// In this case we will specify it to be English
field.LanguageId = "1033";

// Our field code has changed according to the attribute values that we set
Assert.AreEqual(
    " ADDRESSBLOCK  \\c 2 \\d \\e \"United States\" \\f \"<Title> <Forename> <Surname> <Address Line 1> <Region> <Postcode> <Country>\" \\l 1033",
    field.GetFieldCode());
See Also