OfficeDigitalSignatureCollection Class
Represents a collection of digital signatures from a document.
Inheritance
Implements
Namespace: Syncfusion.Office
Assembly: Syncfusion.Compression.Base.dll
Syntax
public class OfficeDigitalSignatureCollection : Object, IEnumerable<OfficeDigitalSignature>, IEnumerable
Constructors
OfficeDigitalSignatureCollection()
Initializes a new instance of the OfficeDigitalSignatureCollection class.
Declaration
public OfficeDigitalSignatureCollection()
Examples
//Open an existing Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SampleDocument.docx");
//Access the collection of digital signatures from the document
OfficeDigitalSignatureCollection signatures = document.DigitalSignatures;
Console.WriteLine(signatures.Count);
document.Close();
Properties
Count
Gets the number of digital signatures in the collection.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The total number of OfficeDigitalSignature items in the collection. |
Examples
//Open a signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Read the number of signatures in the document
int count = document.DigitalSignatures.Count;
Console.WriteLine(count);
document.Close();
IsValid
Gets a value indicating whether all digital signatures in the collection are valid.
Declaration
public bool IsValid { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Examples
//Open a signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Check whether every signature in the document is valid
bool allValid = document.DigitalSignatures.IsValid;
Console.WriteLine(allValid);
document.Close();
Item[Int32]
Gets the digital signature at the specified index.
Declaration
public OfficeDigitalSignature this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The zero-based index of the digital signature to retrieve. |
Property Value
| Type | Description |
|---|---|
| OfficeDigitalSignature | The OfficeDigitalSignature instance at the specified index. |
Examples
//Open a signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Retrieve the first signature by index
OfficeDigitalSignature signature = document.DigitalSignatures[0];
Console.WriteLine(signature.Comments);
document.Close();
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | The index is less than zero or greater than or equal to the collection count. |
Methods
GetEnumerator()
Returns an enumerator that iterates through the digital signatures in the collection.
Declaration
public IEnumerator<OfficeDigitalSignature> GetEnumerator()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerator<OfficeDigitalSignature> | An enumerator for the collection. |
Examples
//Open a signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Iterate over every signature in the document
foreach (OfficeDigitalSignature signature in document.DigitalSignatures)
{
Console.WriteLine(signature.Comments);
}
document.Close();