Cree una línea de firma en un libro de Excel usando Aspose.Cells
Contents
[
Hide
]
Microsoft Excel ofrece una función para agregarLínea de la firma en libros de Excel. Puede agregar una línea de firma haciendo clic en elInsertar Tabulador y luego seleccionandoLínea de la firma desde elTexto grupo.
Aspose.Cells también proporciona esta función y ha expuesto laImagen.setSignatureLine() propiedad para este fin. Este artículo explicará cómo usar esta propiedad para agregar una línea de firma usando Aspose.Cells.
Código Java para crear una línea de firma en un libro de Excel usando Aspose.Cells
El siguiente código de ejemplo agrega una línea de firma usandoImagen.setSignatureLine()propiedad y guarda el libro de trabajo. La captura de pantalla muestra cómo se ve el libro de trabajo de salida en Microsoft Excel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |