GroupDocsGists
10/24/2017 - 1:11 PM

signcellwithtext.java

// For complete examples and data files, please go to https://github.com/groupdocs-signature/GroupDocs.Signature-for-Java
// setup Signature configuration
SignatureConfig signConfig = CommonUtilities.getConfiguration();
// instantiating the conversion handler
SignatureHandler<String> handler = new SignatureHandler<String>(signConfig);
// setup options with text of signature
CellsSignTextOptions signOptions = new CellsSignTextOptions("John Smith");
// text position
signOptions.setRowNumber(2);
signOptions.setColumnNumber(2);
//// text rectangle size
signOptions.setHeight(100);
signOptions.setWidth(100);
//// if you need to sign all sheets set it to true
signOptions.setSignAllPages(false);
signOptions.setSheetNumber(1); // sign second sheet
final SaveOptions saveOptions = new SaveOptions();
saveOptions.setOutputType(OutputType.String);
saveOptions.setOutputFileName("signed_output.xlsx");
// sign document
String signedPath = handler.<String> sign(CommonUtilities.getStoragePath(fileName), signOptions, saveOptions);
System.out.println("Signed file path is: " + signedPath);