Save Workbook to Strict Open XML Spreadsheet Format with C++
Possible Usage Scenarios
Aspose.Cells allows you to save the workbook in Strict Open XML Spreadsheet format. For that purpose, it provides the GetCompliance() property. If you set its value as OoxmlCompliance::Iso29500_2008_Strict, then the output Excel file will be saved in Strict Open XML Spreadsheet format.
Save Workbook to Strict Open XML Spreadsheet Format
The following sample code creates a workbook and sets the value of the GetCompliance() property as OoxmlCompliance::Iso29500_2008_Strict and saves it as output Excel file. If you open the output Excel file in Microsoft Excel and open the Save As… dialog box, you will see its format as Strict Open XML Spreadsheet as shown in this screenshot.
Sample Code
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Create workbook
Workbook wb;
// Specify - Strict Open XML Spreadsheet - Format
wb.GetSettings().SetCompliance(OoxmlCompliance::Iso29500_2008_Strict);
// Add message in cell B4 of first worksheet
Cell b4 = wb.GetWorksheets().Get(0).GetCells().Get(u"B4");
b4.PutValue(u"This Excel file has Strict Open XML Spreadsheet format.");
// Save to output Excel file
wb.Save(u"outputSaveWorkbookToStrictOpenXMLSpreadsheetFormat.xlsx", SaveFormat::Xlsx);
std::cout << "Workbook saved successfully with Strict Open XML Spreadsheet format!" << std::endl;
Aspose::Cells::Cleanup();
}