Using Custom XML Parts in Aspose.Cells

Using Custom Xml Parts in Aspose.Cells

The following sample code makes use of Workbook.getContentTypeProperties().add() method and adds the Book Catalog Xml and its name is BookStore. The following image shows the result of this code. As you can see Book Catalog Xml is added inside the BookStore node which is the name of this property.

todo:image_alt_text

// 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.getDataDir(UsingCustomXmlParts.class);
String booksXML = "<catalog><book><title>Complete C#</title><price>44</price></book><book><title>Complete Java</title><price>76</price></book><book><title>Complete SharePoint</title><price>55</price></book><book><title>Complete PHP</title><price>63</price></book><book><title>Complete VB.NET</title><price>72</price></book></catalog>";
Workbook workbook = new Workbook();
workbook.getContentTypeProperties().add("BookStore", booksXML);
workbook.save(dataDir + "output.xlsx");

Related Article