将VBA证书导出到文件或流
Contents
[
Hide
]
Aspose.Cells允许您将VBA数字证书导出到文件或内存流等流中。您可以使用Workbook.VbaProject.CertRawData属性访问VBA数字证书的原始数据。
在C#中将VBA证书导出到文件或流
请参阅以下示例代码,将VBA证书的原始数据保存到文件中。您可以从提供的链接下载使用此代码的示例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); | |
// 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); |