GetFieldNames

FieldAddressBlock.GetFieldNames method

返回字段使用的邮件合并字段名称的集合。

public string[] GetFieldNames()

例子

显示如何获取字段使用的邮件合并字段名称。

Document doc = new Document(MyDir + "Field sample - ADDRESSBLOCK.docx");

string[] addressFieldsExpect =
{
    "Company", "First Name", "Middle Name", "Last Name", "Suffix", "Address 1", "City", "State",
    "Country or Region", "Postal Code"
};

FieldAddressBlock addressBlockField = (FieldAddressBlock) doc.Range.Fields[0];
string[] addressBlockFieldNames = addressBlockField.GetFieldNames();

也可以看看