Skip to content

Instantly share code, notes, and snippets.

@conholdate-gists
Last active August 8, 2022 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conholdate-gists/c3f1983e7738e6c459bf48841df9b16a to your computer and use it in GitHub Desktop.
Save conholdate-gists/c3f1983e7738e6c459bf48841df9b16a to your computer and use it in GitHub Desktop.
Convert Excel to XML in Node.js
var aspose = aspose || {};
aspose.cells = require("aspose.cells");
// Create an object of the Workbook class and load the source excel file
var wb = new aspose.cells.Workbook("sample.xlsx");
// Instantiate an instance of the XmlSaveOptions() class that will be used to save a file in XML file format.
var XmlSaveOptions = new aspose.cells.XmlSaveOptions();
// Invoke the save method to save the file
wb.save("DocumentConversionProgress.xml", XmlSaveOptions);
var aspose = aspose || {};
aspose.cells = require("aspose.cells");
// instantiate an object of the Workbook class and load the source excel file
var wb = new aspose.cells.Workbook("sample.xlsx");
// creaste an instance of the XmlSaveOptions() class that will be used to save a file in XML file format.
var XmlSaveOptions = new aspose.cells.XmlSaveOptions();
// Call the setClearData method that makes the workbook empty after saving the file.
XmlSaveOptions.setClearData(flase);
// if value of setCreateDirectory is true, the directory will be automatically created before saving the file.
XmlSaveOptions.setCreateDirectory(true);
// setCachedFileFolder method is used to store some large data.
XmlSaveOptions.setCachedFileFolder(true);
// Invoke the save method to save the file
wb.save("DocumentConversionProgress.xml", XmlSaveOptions);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment