OdsoRecipientData

OdsoRecipientData class

Represents information about a single record within an external data source that is to be excluded from the mail merge.

To learn more, visit the Mail Merge and Reporting documentation article.

public class OdsoRecipientData

Constructors

NameDescription
OdsoRecipientData()The default constructor.

Properties

NameDescription
Active { get; set; }Specifies whether the record from the data source shall be imported into a document when the mail merge is performed. The default value is true.
Column { get; set; }Specifies the column within the data source that contains unique data for the current record. The default value is 0.
Hash { get; set; }Represents the hash code for this record. Sometimes Microsoft Word uses Hash of a whole record instead of a UniqueTag value. The default value is 0.
UniqueTag { get; set; }Specifies the contents of a given record in the column containing unique data. The default value is null.

Methods

NameDescription
Clone()Returns a deep clone of this object.

Remarks

If a record shall be merged into a merged document, then no information is needed about that record. However, if a given record shall not be merged into a merged document, then the value of the unique key for that record shall be stored in the UniqueTag property of this object to indicate this exclusion.

Examples

Shows how to access the collection of data that designates which merge data source records a mail merge will exclude.

Document doc = new Document(MyDir + "Odso data.docx");

OdsoRecipientDataCollection dataCollection = doc.MailMergeSettings.Odso.RecipientDatas;

Assert.AreEqual(70, dataCollection.Count);

using (IEnumerator<OdsoRecipientData> enumerator = dataCollection.GetEnumerator())
{
    int index = 0;
    while (enumerator.MoveNext())
    {
        Console.WriteLine(
            $"Odso recipient data index {index++} will {(enumerator.Current.Active ? "" : "not ")}be imported upon mail merge.");
        Console.WriteLine($"\tColumn #{enumerator.Current.Column}");
        Console.WriteLine($"\tHash code: {enumerator.Current.Hash}");
        Console.WriteLine($"\tContents array length: {enumerator.Current.UniqueTag.Length}");
    }
}

// We can clone the elements in this collection.
Assert.AreNotEqual(dataCollection[0], dataCollection[0].Clone());

// We can also remove elements individually, or clear the entire collection at once.
dataCollection.RemoveAt(0);

Assert.AreEqual(69, dataCollection.Count);

dataCollection.Clear();

Assert.AreEqual(0, dataCollection.Count);

See Also