Using XML Maps in Aspose Cells

Hi,

Please can you confirm whether or not Aspose Cells now supports Excel's XML Maps feature?

The release notes for Aspose.Cells for .NET 7.3.0 say "40448 - Support XML Maps". I've read some forum posts (such as this one) but they don't seem to be clear on exactly what is supported.

Specifically, I'd like to be able to do all the following programatically:
  • create a new XML Map in a workbook, specifying an XML schema
  • specify XPath for cells showing how they map to the schema
  • import an XML file, setting the cell values automatically
  • export an XML file, created from the cells in the map
Is this possible with Aspose Cells? It is straightforward to do this with Excel interop, but I'd rather use Aspose since I want to do this round-tripping on a server.

Many thanks,
Matthew

Hi,

Thanks for your posting and using Aspose.Cells.

We need to investigate if your requirements/requested features are fully/partially supported or totally unavailable.

Could you please explain your requirements with detail? Please provide us your xml mapping files, source xls/xlsx file and expected output xls/xlsx file. Also, screenshots would be helpful.

We will look into your query and help you asap.

Hi,


Thanks for your reply.

Please find attached a simple example. Original.xslx is an empty workbook.

Firstly, I want to be able to convert that to something like test.xslx, which contains an XML map (see also the attached screenshot). In other words, to upload a schema and specify the cells in the spreadsheet that map to parts of that schema.

Then I want to be able to import an XML file to get the mapped cells to update with values from the XML (like clicking the Import button shown in the screenshot).

The user may then make manual changes, so I also want to be able to generate an XML file from the changed content (like clicking the Export button in the screenshot).

I’ve also attached a sample code file which does what I want using Excel Interop. This contains smippets for both the schema and the XML (a cut-down version of what I’d actually need).

I hope this all makes sense. Please let me know if you need any more clarification. I think this feature would be useful to lots of developers wanting to get XML data into and back out of Excel.

Many thanks,
Matthew
aspose-1:
Hi,

Thanks for your reply.

Please find attached a simple example. Original.xslx is an empty workbook.

Firstly, I want to be able to convert that to something like test.xslx, which contains an XML map (see also the attached screenshot). In other words, to upload a schema and specify the cells in the spreadsheet that map to parts of that schema.
-----
I hope this all makes sense. Please let me know if you need any more clarification. I think this feature would be useful to lots of developers wanting to get XML data into and back out of Excel.

Many thanks,
Matthew
Hi,

Thanks for your sample files and providing us your detailed information about your requirements.

We will look into your queries and requirements and help/advise you asap.

We have logged this issue in our database. Once, we will have some update for you, we will let you know asap.

This issue has been logged as CELLSNET-41286.

Hi,


I’d like to vote for this issue.

Thanks,
Brecht

Hi,

Thanks for your posting and considering Aspose.Cells.

This issue is already logged. Once, we will have some update relating to it, we will inform you asap by posting on this thread.

@aspose-1, @brecht.yperman

The Xml Maps features are supported in the fix 21.7.7.
Aspose.Cells21.7.7 For .Net2_AuthenticodeSigned.Zip (5.6 MB)
Aspose.Cells21.7.7 For .Net4.0.Zip (5.6 MB)
Aspose.Cells21.7.7 For .NetStandard20.Zip (5.6 MB)

Code:

Workbook wb = new Workbook();

//create a new XML Map in a workbook, specifying an XML schema
int mapIndex = wb.Worksheets.XmlMaps.Add("bookstore.xsd");
XmlMap xmlMap = wb.Worksheets.XmlMaps[mapIndex];

Worksheet sheet = wb.Worksheets[0];
//specify XPath for cells showing how they map to the schema
sheet.Cells.LinkToXmlMap(xmlMap.Name, 0, 0, "/bookstore/book");

//import an XML file, setting the cell values automatically
wb.ImportXml("bookstoreData.xml", sheet.Name, 0, 0);

wb.Save("output.xlsx");

sheet.Cells["B2"].PutValue("p1_m");
//export an XML file, created from the cells in the map
wb.ExportXml(xmlMap.Name, "output.xml");

The files used in the sample code are attached: bookstore.zip (674 Bytes)

The issues you have found earlier (filed as CELLSNET-41286) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao