Workbook.ExportXml

ExportXml(string, string)

Export XML data linked by the specified XML map.

public void ExportXml(string mapName, string path)
ParameterTypeDescription
mapNameStringname of the XML map that need to be exported
pathStringthe export path

Examples

using System;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class WorkbookMethodExportXmlWithStringStringDemo
    {
        public static void Run()
        {
            // Create a workbook and load the Excel file
            Workbook wb = new Workbook("Book1.xlsx");
            
            // Get the first XmlMap from the workbook
            if (wb.Worksheets.XmlMaps.Count > 0)
            {
                XmlMap xmlMap = wb.Worksheets.XmlMaps[0];
                
                // Export XML data using the XmlMap's name and output file path
                wb.ExportXml(xmlMap.Name, "output.xml");
                Console.WriteLine("XML exported successfully to output.xml");
            }
            else
            {
                Console.WriteLine("No XmlMap found in the workbook");
            }
        }
    }
}

See Also


ExportXml(string, Stream)

Export XML data.

public void ExportXml(string mapName, Stream stream)
ParameterTypeDescription
mapNameStringname of the XML map that need to be exported
streamStreamthe export stream

See Also