OfficeSignatureLine Class
Represents the Office Signature Line in the document.
Inheritance
Namespace: Syncfusion.Office
Assembly: Syncfusion.Compression.Base.dll
Syntax
public class OfficeSignatureLine : Object
Constructors
OfficeSignatureLine()
Initializes a new instance of the OfficeSignatureLine class.
Declaration
public OfficeSignatureLine()
Examples
//Create a new Word document
WordDocument document = new WordDocument();
//Add a section into the word document
IWSection section = document.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//AppendSignatureLine internally creates an OfficeSignatureLine; here we
//read it back via the picture's SignatureLine property and configure it.
IWPicture picture = paragraph.AppendSignatureLine(new SignatureLineSettings(), 192, 96);
OfficeSignatureLine signatureLine = ((WPicture)picture).SignatureLine;
signatureLine.Signer = "John Smith";
signatureLine.SignerTitle = "Manager";
signatureLine.Instructions = "Please sign here";
Console.WriteLine(signatureLine.Signer);
document.Save(@"C:\Data\SampleDocument.docx", FormatType.Docx);
document.Close();
Properties
AllowComments
Gets or sets a value indicating that the signer can add comments in the Sign dialog.
Declaration
public bool AllowComments { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Examples
//Create a new Word document
WordDocument document = new WordDocument();
//Add a section into the word document
IWSection section = document.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//Append a signature line and allow the signer to add comments
IWPicture picture = paragraph.AppendSignatureLine(new SignatureLineSettings(), 192, 96);
((WPicture)picture).SignatureLine.AllowComments = true;
Console.WriteLine(((WPicture)picture).SignatureLine.AllowComments);
document.Save(@"C:\Data\SampleDocument.docx", FormatType.Docx);
document.Close();
DefaultInstructions
Gets or sets a value indicating that default instructions are shown in the Sign dialog.
Declaration
public bool DefaultInstructions { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Remarks
This property is ignored if Instructions is set.
Examples
//Create a new Word document
WordDocument document = new WordDocument();
//Add a section into the word document
IWSection section = document.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//Append a signature line and disable default instructions
IWPicture picture = paragraph.AppendSignatureLine(new SignatureLineSettings(), 192, 96);
((WPicture)picture).SignatureLine.DefaultInstructions = false;
Console.WriteLine(((WPicture)picture).SignatureLine.DefaultInstructions);
document.Save(@"C:\Data\SampleDocument.docx", FormatType.Docx);
document.Close();
Gets or sets the suggested signer's e-mail address.
Declaration
public string Email { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The string that represents the e-mail address. The default value is an empty string. |
Examples
//Create a new Word document
WordDocument document = new WordDocument();
//Add a section into the word document
IWSection section = document.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//Append a signature line with the suggested signer e-mail
IWPicture picture = paragraph.AppendSignatureLine(new SignatureLineSettings(), 192, 96);
((WPicture)picture).SignatureLine.Email = "[email protected]";
Console.WriteLine(((WPicture)picture).SignatureLine.Email);
document.Save(@"C:\Data\SampleDocument.docx", FormatType.Docx);
document.Close();
Id
Gets or sets the Id of the signature line.
Declaration
public Guid Id { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Guid | The Guid that represents the Id of the signature line. |
Examples
//Create a new Word document
WordDocument document = new WordDocument();
//Add a section into the word document
IWSection section = document.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//Append a signature line to the paragraph and bind a new Id
IWPicture picture = paragraph.AppendSignatureLine(new SignatureLineSettings(), 192, 96);
((WPicture)picture).SignatureLine.Id = Guid.NewGuid();
Console.WriteLine(((WPicture)picture).SignatureLine.Id);
document.Save(@"C:\Data\SampleDocument.docx", FormatType.Docx);
document.Close();
Instructions
Gets or sets the instructions for the signature line.
Declaration
public string Instructions { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The string that represents the instructions. |
Examples
//Create a new Word document
WordDocument document = new WordDocument();
//Add a section into the word document
IWSection section = document.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//Append a signature line and set its instructions
IWPicture picture = paragraph.AppendSignatureLine(new SignatureLineSettings(), 192, 96);
((WPicture)picture).SignatureLine.Instructions = "Please sign here before submitting.";
Console.WriteLine(((WPicture)picture).SignatureLine.Instructions);
document.Save(@"C:\Data\SampleDocument.docx", FormatType.Docx);
document.Close();
IsSigned
Indicates that the signature line is signed by a digital signature.
Declaration
public bool IsSigned { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Examples
//Open a signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Walk every section via Body.ChildEntities, filtering paragraphs and pictures, breaking at the first signature line found
OfficeSignatureLine signatureLine = null;
bool found = false;
foreach (WSection section in document.Sections)
{
foreach (IEntity bodyItem in section.Body.ChildEntities)
{
if (bodyItem.EntityType != EntityType.Paragraph)
continue;
WParagraph paragraph = bodyItem as WParagraph;
foreach (Entity item in paragraph.ChildEntities)
{
if (item.EntityType != EntityType.Picture)
continue;
WPicture picture = item as WPicture;
if (picture.IsSignatureLine)
{
signatureLine = picture.SignatureLine;
Console.WriteLine(signatureLine.IsSigned);
found = true;
break;
}
}
if (found)
break;
}
if (found)
break;
}
document.Close();
ProviderId
Gets or sets the signature provider identifier for this signature line.
Declaration
public Guid ProviderId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Guid | The Guid that represents the signature provider identifier. The default value is System.Guid.Empty ({00000000-0000-0000-0000-000000000000}). |
Examples
//Create a new Word document
WordDocument document = new WordDocument();
//Add a section into the word document
IWSection section = document.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//Append a signature line with a provider identifier
IWPicture picture = paragraph.AppendSignatureLine(new SignatureLineSettings(), 192, 96);
((WPicture)picture).SignatureLine.ProviderId = new Guid("12345678-1234-1234-1234-123456789012");
Console.WriteLine(((WPicture)picture).SignatureLine.ProviderId);
document.Save(@"C:\Data\SampleDocument.docx", FormatType.Docx);
document.Close();
ShowDate
Gets or sets a value indicating that the sign date is shown in the signature line.
Declaration
public bool ShowDate { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Examples
//Create a new Word document
WordDocument document = new WordDocument();
//Add a section into the word document
IWSection section = document.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//Append a signature line and hide the sign date
IWPicture picture = paragraph.AppendSignatureLine(new SignatureLineSettings(), 192, 96);
((WPicture)picture).SignatureLine.ShowDate = false;
Console.WriteLine(((WPicture)picture).SignatureLine.ShowDate);
document.Save(@"C:\Data\SampleDocument.docx", FormatType.Docx);
document.Close();
Signer
Gets or sets the suggested signer of the signature line.
Declaration
public string Signer { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The string that represents the signer. The default value is an empty string. |
Examples
//Create a new Word document
WordDocument document = new WordDocument();
//Add a section into the word document
IWSection section = document.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//Append a signature line with a suggested signer name
IWPicture picture = paragraph.AppendSignatureLine(new SignatureLineSettings(), 192, 96);
((WPicture)picture).SignatureLine.Signer = "John Smith";
Console.WriteLine(((WPicture)picture).SignatureLine.Signer);
document.Save(@"C:\Data\SampleDocument.docx", FormatType.Docx);
document.Close();
SignerTitle
Gets or sets the suggested signer's title (for example, Manager).
Declaration
public string SignerTitle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The string that represents the signer's title. The default value is an empty string. |
Examples
//Create a new Word document
WordDocument document = new WordDocument();
//Add a section into the word document
IWSection section = document.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//Append a signature line with a suggested signer title
IWPicture picture = paragraph.AppendSignatureLine(new SignatureLineSettings(), 192, 96);
((WPicture)picture).SignatureLine.SignerTitle = "Manager";
Console.WriteLine(((WPicture)picture).SignatureLine.SignerTitle);
document.Save(@"C:\Data\SampleDocument.docx", FormatType.Docx);
document.Close();