Query Cell Areas Mapped to XML Map Path using Worksheet.XmlMapQuery method

Possible Usage Scenarios

You can query cell areas mapped to XML map path with Aspose.Cells using the Worksheet.xmlMapQuery() method. If the path exists, it will return the list of cell areas related to that path inside the XML map. The first parameter of Worksheet.xmlMapQuery() method specifies the XML element path and the second parameter specifies an XML map you want to query.

Query Cell Areas Mapped to XML Map Path using Worksheet.XmlMapQuery method

The following screenshot shows the Microsoft Excel displaying XML Map inside the sample Excel file used in the code. The code queries the XML map two times and prints the list of cell areas returned by the Worksheet.xmlMapQuery() method on the console as shown below.


Sample Code

Console Output

Query Xml Map from Path - /MiscData






Query Xml Map from Path - /MiscData/row/Color


Get XML path from List Object/Table

XML data can be imported to worksheets. Sometimes XML path is required from the ListObjects of the worksheet. This feature is available in Excel by using an expression like Sheet1.ListObjects(1).XmlMap.DataBinding. The same feature is available in Aspose.Cells by calling ListObject.getXmlMap().getDataBinding().getUrl().  Following example demonstrates this feature. Template file and other source files can be downloaded from the following links:

  1. XMLData.xlsx
  2. CountryList.xml
  3. FoodList.xml