إضافة خط التوقيع إلى ورقة العمل
Contents
[
Hide
]
مقدمة
تقدم Aspose.Cells خاصية Picture.SignatureLine لإضافة خط التوقيع في ورقة العمل.
كيفية إضافة خط توقيع إلى الورقة
يوضح الكود النموذجي التالي كيفية استخدام خاصية Picture.SignatureLine لإضافة خط التوقيع في ورقة العمل. يظهر لقطة الشاشة تأثير الكود النموذجي على ملف Excel النموذجي بعد التنفيذ.
الكود المثالي
This file contains 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-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Instantiating a Workbook object | |
Workbook wb = new Workbook(); | |
SignatureLine signatureLine = new SignatureLine(); | |
signatureLine.Id = Guid.NewGuid(); | |
signatureLine.ProviderId = Guid.Empty; | |
signatureLine.Signer = "Aspose.Cells"; | |
signatureLine.Title = "signed by Aspose.Cells"; | |
wb.Worksheets[0].Shapes.AddSignatureLine(1, 1, signatureLine); | |
System.Security.Cryptography.X509Certificates.X509Certificate2 certificate = new System.Security.Cryptography.X509Certificates.X509Certificate2(dataDir + "rsa2048.pfx", "123456"); | |
Aspose.Cells.DigitalSignatures.DigitalSignature signature = | |
new Aspose.Cells.DigitalSignatures.DigitalSignature(certificate, "test Microsoft Office signature line", DateTime.UtcNow); | |
signature.Id = signatureLine.Id; | |
signature.ProviderId = signatureLine.ProviderId; | |
Aspose.Cells.DigitalSignatures.DigitalSignatureCollection dsCollection = new Aspose.Cells.DigitalSignatures.DigitalSignatureCollection(); | |
dsCollection.Add(signature); | |
wb.SetDigitalSignature(dsCollection); | |
wb.Save(dataDir + "signatureLine.xlsx"); |