Esporta dati XML collegati alla mappa XML all interno del foglio di lavoro
Esporta dati XML collegati alla mappa XML all’interno del Workbook
Si prega di utilizzare il metodo Workbook.ExportXml() per esportare i dati XML collegati alle mappe XML all’interno del workbook. Il seguente codice di esempio esporta i dati XML di tutte le mappe XML dal workbook una per una. Si prega di controllare il file Excel di esempio utilizzato in questo codice e i dati XML esportati della prima mappa XML.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create directory if it is not already present. | |
bool IsExists = System.IO.Directory.Exists(dataDir); | |
if (!IsExists) | |
System.IO.Directory.CreateDirectory(dataDir); | |
// Instantiating a Workbook object. | |
Workbook workbook = new Workbook(dataDir + "sample.xlsx"); | |
// Export all XML data from all XML Maps from the Workbook. | |
for (int i = 0; i < workbook.Worksheets.XmlMaps.Count; i++) | |
{ | |
// Access the XML Map. | |
XmlMap map = workbook.Worksheets.XmlMaps[i]; | |
// Exports its XML Data to file. | |
workbook.ExportXml(map.Name, dataDir + map.Name + ".xml"); | |
} |