FieldAddressBlock.ExcludedCountryOrRegionName property

Gets or sets the excluded country/region name.

public string ExcludedCountryOrRegionName { get; set; }


Shows how to insert an ADDRESSBLOCK field.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

FieldAddressBlock field = (FieldAddressBlock)builder.InsertField(FieldType.FieldAddressBlock, true);

Assert.AreEqual(" ADDRESSBLOCK ", field.GetFieldCode());

// Setting this to "2" will include all countries and regions,
// unless it is the one specified in the ExcludedCountryOrRegionName property.
field.IncludeCountryOrRegionName = "2";
field.FormatAddressOnCountryOrRegion = true;
field.ExcludedCountryOrRegionName = "United States";
field.NameAndAddressFormat = "<Title> <Forename> <Surname> <Address Line 1> <Region> <Postcode> <Country>";

// By default, this property will contain the language ID of the first character of the document.
// We can set a different culture for the field to format the result with like this.
field.LanguageId = new CultureInfo("en-US").LCID.ToString();

    " ADDRESSBLOCK  \\c 2 \\d \\e \"United States\" \\f \"<Title> <Forename> <Surname> <Address Line 1> <Region> <Postcode> <Country>\" \\l 1033",

See Also