إضافة توقيع رقمي إلى ملف Excel موقع بالفعل باستخدام Node.js عبر C++

سيناريوهات الاستخدام المحتملة

يقدم Aspose.Cells for Node.js via C++ أسلوب Workbook.addDigitalSignature(digitalSignatureCollection) الذي يمكنك استخدامه لإضافة توقيع رقمي إلى ملف Excel موقع سابقًا.

كيفية إضافة توقيع رقمي إلى ملف Excel تم توقيعه مسبقًا

يعرض رمز النموذج التالي كيفية استخدام أسلوب Workbook.addDigitalSignature(digitalSignatureCollection) لإضافة توقيع رقمي إلى ملف Excel موقّع مسبقًا. يرجى التحقق من ملف Excel النموذجي المستخدم في هذا الكود. هذا الملف موقع رقميًا مسبقًا. يرجى التحقق من ملف Excel الناتج الذي تم إنشاؤه بواسطة الكود. لقد استخدمنا شهادة عرضية باسم AsposeDemo.pfx بكلمة مرور aspose في هذا الكود، وتظهر لقطة الشاشة تأثير رمز النموذج على ملف Excel النموذجي بعد التنفيذ.

todo:image_alt_text

الكود المثالي

const AsposeCells = require("aspose.cells.node");
const path = require("path");

const dataDir = path.join(__dirname, "data");
// Certificate file path and password
const certFileName = path.join(dataDir, "AsposeDemo.pfx");
const password = "aspose";

// Load the workbook which is already digitally signed to add new digital signature
const workbook = new AsposeCells.Workbook(path.join(dataDir, "sampleDigitallySignedByCells.xlsx"));

// Create the digital signature collection
const dsCollection = new AsposeCells.DigitalSignatureCollection();


// Create new digital signature and add it in digital signature collection
const signature = new AsposeCells.DigitalSignature(certFileName, password, "Aspose.Cells added new digital signature in existing digitally signed workbook.", new Date());
dsCollection.add(signature);

// Add digital signature collection inside the workbook
workbook.addDigitalSignature(dsCollection);

// Save the workbook and dispose of it.
workbook.save(path.join(__dirname, "outputDigitallySignedByCells.xlsx"));
workbook.dispose();