Save Workbook to Strict Open XML Spreadsheet Format with JavaScript via C++
Contents
[
Hide
]
Possible Usage Scenarios
Aspose.Cells for JavaScript via C++ allows you to save the workbook in Strict Open XML Spreadsheet format. For that purpose, it provides the WorkbookSettings.compliance 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 WorkbookSettings.compliance 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
<!DOCTYPE html>
<html>
<head>
<title>Save Workbook to Strict Open XML Spreadsheet Format</title>
</head>
<body>
<h1>Save Workbook to Strict Open XML Spreadsheet Format</h1>
<input type="file" id="fileInput" accept=".xls,.xlsx,.csv" />
<button id="runExample">Run Example</button>
<a id="downloadLink" style="display: none;">Download Result</a>
<div id="result"></div>
</body>
<script src="aspose.cells.js.min.js"></script>
<script type="text/javascript">
const { Workbook, SaveFormat, OoxmlCompliance, Utils } = AsposeCells;
AsposeCells.onReady({
license: "/lic/aspose.cells.enc",
fontPath: "/fonts/",
fontList: [
"arial.ttf",
"NotoSansSC-Regular.ttf"
]
}).then(() => {
console.log("Aspose.Cells initialized");
});
document.getElementById('runExample').addEventListener('click', async () => {
// Create a new workbook
const workbook = new Workbook();
// Specify - Strict Open XML Spreadsheet - Format.
workbook.settings.compliance = OoxmlCompliance.Iso29500_2008_Strict;
// Access first worksheet and set value in B4
const worksheet = workbook.worksheets.get(0);
const b4 = worksheet.cells.get("B4");
b4.value = "This Excel file has Strict Open XML Spreadsheet format.";
// Save to output Excel file and provide download link
const outputData = workbook.save(SaveFormat.Xlsx);
const blob = new Blob([outputData]);
const downloadLink = document.getElementById('downloadLink');
downloadLink.href = URL.createObjectURL(blob);
downloadLink.download = 'outputSaveWorkbookToStrictOpenXMLSpreadsheetFormat.xlsx';
downloadLink.style.display = 'block';
downloadLink.textContent = 'Download Excel File';
document.getElementById('result').innerHTML = '<p style="color: green;">Workbook created and saved to Strict Open XML Spreadsheet format. Click the download link to get the file.</p>';
});
</script>
</html>