//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); // This file contains 2 already signed signature lines and // a not signed signature line. var signedFile = GetResourceStream(@"xlsx\SignatureLine2Signed1NotSigned.xlsx"); // Use DigitalSignatureOnly mode, because the workbook was already signed. // If you don't open it with digital signature only mode, // all existing signatures will be removed after saving the workbook. XlsxOpenOptions openOption = new XlsxOpenOptions { DigitalSignatureOnly = true }; workbook.Open(signedFile, openOption); // Remove signature of the first signed signature line. foreach (var signature in workbook.Signatures) { if (signature.IsSignatureLine && signature.IsSigned) { // Remove digital signature. // The signature line will not be removed from the SignatureSet // in digital signature only mode. // Because signature lines are shapes. signature.Delete(); break; } } // Commit signatures // Save to an excel file workbook.Save("DeleteSignatureFromSignatureLine.xlsx");
' Create a new Workbook Dim workbook As New Workbook ' This file contains 2 already signed signature lines and ' a not signed signature line. Dim signedFile = GetResourceStream("SignatureLine2Signed1NotSigned.xlsx") ' Use DigitalSignatureOnly mode, because the workbook was already signed. ' If you don't open it with digital signature only mode, ' all existing signatures will be removed after saving the workbook. Dim openOption As New XlsxOpenOptions With { .DigitalSignatureOnly = True } workbook.Open(signedFile, openOption) ' Remove signature of the first signed signature line. For Each signature In workbook.Signatures If signature.IsSignatureLine AndAlso signature.IsSigned Then ' Remove digital signature. ' The signature line will not be removed from the SignatureSet ' in digital signature only mode. ' Because signature lines are shapes. signature.Delete() Exit For End If Next ' Commit signatures ' save to an excel file workbook.Save("DeleteSignatureFromSignatureLine.xlsx")