[]
An ISignature represents either a visible signature line in a worksheet or a non-visible signature attached to a workbook. Use this interface to configure signature line information, inspect signature details, validate whether a document has been signed successfully, and remove or countersign an existing signature.
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
ISignatureSetup setup = signature.getSetup();
setup.setSuggestedSigner("Shinzo Nagama");
setup.setSigningInstructions("Please check the content before signing.");
voidcountersign(KeyStore certificate,
String certificatePassword) voiddelete()booleanbooleanbooleanbooleangetSetup()ISignatureSetup object used to access various properties of a signature packet.IShape object associated with an ISignature object that is a signature line.voidsign(KeyStore certificate,
String certificatePassword,
SignatureDetails details) voidsign(KeyStore certificate,
String certificatePassword,
InputStream signatureImage,
SignatureDetails details) voidsign(KeyStore certificate,
String certificatePassword,
String signatureText,
SignatureDetails details) This value can be checked before working with the setup information returned by getSetup().
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
boolean canSetup = signature.getCanSetup();
ISignatureSetup setup = canSetup ? signature.getSetup() : null;
true if the user can set properties of the ISignature object; otherwise, false.Use this method to read the persisted signature metadata associated with this ISignature, such as the signature text, image, and certificate information exposed by IReadOnlySignatureDetails.
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
IReadOnlySignatureDetails details = signature.getDetails();
String signatureText = details != null ? details.getSignatureText() : null;
null if this signature does not contain stored signature details.Use this property to distinguish a visible signature line added by ISignatureSet.addSignatureLine(IWorksheet,double,double) from a non-visible signature created by ISignatureSet.addNonVisibleSignature().
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
boolean isSignatureLine = signature.getIsSignatureLine();
true if this ISignature represents a signature line; otherwise, false.Use this property to determine whether the ISignature currently has a completed digital signature. To determine whether an existing signature is valid, use getIsValid().
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
boolean isSigned = signature.getIsSigned();
true if the document was signed successfully; otherwise, false.This value is true only when the signature has been signed and the signature is considered valid for the current workbook.
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
boolean isValid = signature.getIsValid();
true if the digital signature corresponding to this ISignature is valid; otherwise, false.The returned parent is the ISignatureSet that contains this signature.
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
ISignatureSet parent = signature.getParent();
int count = parent.getCount();
ISignatureSet that contains this signature.ISignatureSetup object used to access various properties of a signature packet. Read-only. Use the returned object to configure signature line information such as the suggested signer, signing instructions, comment permission, and whether the signing date is displayed.
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
ISignatureSetup setup = signature.getSetup();
setup.setSuggestedSigner("Test User");
setup.setSigningInstructions("Review the workbook before signing.");
ISignatureSetup object for the signature packet.IShape object associated with an ISignature object that is a signature line.Use this method when you need to work with the signature line as a shape, for example to move, copy, or delete the visible signature line. This property is read-only.
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
IShape shape = signature.getSignatureLineShape();
shape.setTop(shape.getTop() + 20);
This method returns the signing date for the current digital signature.
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
Calendar signDate = signature.getSignDate();
Calendar that represents the date and time when the digital certificate corresponding to the ISignature object was attached to the document.Use this method to remove the current signature from its parent ISignatureSet. For a visible signature line, deleting the signature removes that signature entry from the workbook. In digital signature only mode, this method can be used to remove the digital signature from a signed signature line or to remove a non-visible signature.
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
signature.getSetup().setSuggestedSigner("Kenji Tenzai");
signature.delete();
IllegalStateException - if the workbook is opened in digital signature only mode and the current signature is an unsigned visible signature line.
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
KeyStore certificate = getSigningCertificate();
String certificatePassword = getCertificatePasswordFromSecureSource();
InputStream signatureImage = getSignatureImageStream();
SignatureDetails details = new SignatureDetails();
details.setSignatureComments("Approved for release");
signature.sign(certificate, certificatePassword, signatureImage, details);
certificate - The certificate that will be used to sign the workbook.certificatePassword - The password that is used to open the certificate.signatureImage - The signature image of the signature line.details - The signature detail of the signature.IllegalStateException - Attempted to sign a non-visible signature
ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
KeyStore certificate = getSigningCertificate();
String certificatePassword = getCertificatePasswordFromSecureSource();
SignatureDetails details = new SignatureDetails();
details.setSignatureComments("Approved for release");
signature.sign(certificate, certificatePassword, "Approved by QA", details);
certificate - The certificate that will be used to sign the workbook.certificatePassword - The password that is used to open the certificate.signatureText - The signature text of the signature line.details - The signature detail of the signature.IllegalStateException - Attempted to sign a non-visible signature
ISignature signature = workbook.getSignatures().addNonVisibleSignature();
KeyStore certificate = getSigningCertificate();
String certificatePassword = getCertificatePasswordFromSecureSource();
SignatureDetails details = new SignatureDetails();
details.setSignatureComments("Approved for release");
signature.sign(certificate, certificatePassword, details);
certificate - The certificate that will be used to sign the workbook.certificatePassword - The password that is used to open the certificate.details - The signature detail of the signature.IllegalStateException - Attempted to sign a visible signature line
workbook.open(getSignedWorkbookStream());
ISignature signature = workbook.getSignatures().get(0);
KeyStore certificate = getSigningCertificate();
String certificatePassword = getCertificatePasswordFromSecureSource();
signature.countersign(certificate, certificatePassword);
certificate - The certificate that will be used to countersign the workbook.certificatePassword - The password that is used to open the certificate.IllegalStateException - The signature has not been signed.