Export VBA Certificate to File or Stream

Export VBA Certificate to File or Stream in C#

Please see the following sample code that saves the raw data of the VBA Certificate into a file. You can download the sample excel file used in this code from the provided link.

// 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);
// Load your source excel file into workbook object
Workbook workbook = new Workbook(dataDir + "sampleVBAProjectSigned.xlsm");
// Retrieve bytes data of Digital Certificate of VBA Project
byte[] certBytes = workbook.VbaProject.CertRawData;
// Save Certificate Data into FileStream
File.WriteAllBytes(dataDir + "Cert_out_", certBytes);