Export XML Data linked to XML Map inside the Workbook

Export XML Data linked to XML Map inside the Workbook

Please use the Workbook.exportXml() method to export XML data linked to your XML Maps inside your workbook. The following sample code exports Xml data of all XML Maps from the workbook one by one. Please check the sample excel file used in this code and exported XML data of first XML Map.

Java code to export XML data linked to XML Map inside the workbook

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(ExportXmlDataOfXmlMap.class) + "articles/";
//Load source workbook
Workbook wb = new Workbook(dataDir + "sample_Export-Xml-Data-linked.xlsx");
//Export all XML data from all XML Maps inside the Workbook
for (int i = 0; i < wb.getWorksheets().getXmlMaps().getCount(); i++)
{
//Access the XML Map
XmlMap map = wb.getWorksheets().getXmlMaps().get(i);
//Exports its XML Data
wb.exportXml(map.getName(), dataDir + map.getName() + ".xml");
}