Add Signature line to the worksheet with Node.js via C++
Contents
[
Hide
]
Introduction
Aspose.Cells provides the Picture.getSignatureLine() property to add the signature line of the worksheet.
How to Add Signature Line to Worksheet
The following sample code demonstrates how to make use of Picture.getSignatureLine() property to add the signature line of the worksheet. The screenshot shows the effect of the sample code on the sample Excel file after execution.
Sample Code
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Instantiating a Workbook object
const wb = new AsposeCells.Workbook();
const signatureLine = new AsposeCells.SignatureLine();
signatureLine.setSigner("Aspose.Cells");
signatureLine.setTitle("signed by Aspose.Cells");
wb.getWorksheets().get(0).getShapes().addSignatureLine(1, 1, signatureLine);
const certificatePath = path.join(dataDir, "AsposeDemo.pfx");
const signature = new AsposeCells.DigitalSignature(certificatePath, "aspose", "test Microsoft Office signature line", new Date());
const dsCollection = new AsposeCells.DigitalSignatureCollection();
dsCollection.add(signature);
wb.setDigitalSignature(dsCollection);
wb.save(path.join(dataDir, "signatureLine.xlsx"));