Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
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.
#include <iostream>
#include <fstream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Source directory path
U16String srcDir(u"..\\Data\\01_SourceDirectory\\");
// Output directory path
U16String outDir(u"..\\Data\\02_OutputDirectory\\");
// Path of input excel file
U16String inputFilePath = srcDir + u"sampleVBAProjectSigned.xlsm";
// Create workbook
Workbook workbook(inputFilePath);
// Retrieve bytes data of Digital Certificate of VBA Project
Vector<uint8_t> certBytes = workbook.GetVbaProject().GetCertRawData();
// Save Certificate Data into FileStream
U16String outputFilePath = outDir + u"Cert_out_";
std::ofstream outFile(outputFilePath.ToUtf8(), std::ios::binary);
if (outFile.is_open())
{
outFile.write(reinterpret_cast<const char*>(certBytes.GetData()), certBytes.GetLength());
outFile.close();
}
Aspose::Cells::Cleanup();
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.