Create Signature Line in an Excel Workbook using Aspose.Cells
Microsoft Excel provides a feature to add Signature Line in Excel workbooks. You can add a Signature Line by clicking the Insert Tab and then selecting Signature Line from the Text group.
Aspose.Cells also provides this feature and has exposed the Picture.setSignatureLine() property for this purpose. This article will explain how to use this property to add a Signature Line using Aspose.Cells.
Java code to create Signature Line in an Excel Workbook using Aspose.Cells
The following sample code adds a Signature Line using Picture.setSignatureLine() property and saves the workbook. The screenshot shows how the output workbook looks like in Microsoft Excel.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(CreateSignatureLine.class); | |
// Create workbook object | |
Workbook workbook = new Workbook(); | |
// Insert picture of your choice | |
int index = workbook.getWorksheets().get(0).getPictures().add(0, 0, "signature.jpg"); | |
// Access picture and add signature line inside it | |
Picture pic = workbook.getWorksheets().get(0).getPictures().get(index); | |
// Create signature line object | |
SignatureLine s = new SignatureLine(); | |
s.setSigner("Simon Zhao"); | |
s.setTitle("Development Lead"); | |
s.setEmail("Simon.Zhao@aspose.com"); | |
// Assign the signature line object to Picture.SignatureLine property | |
pic.setSignatureLine(s); | |
// Save the workbook | |
workbook.save(dataDir + "output.xlsx"); |