使用XmlMapCollection.Add方法在工作簿中添加XML映射
Contents
[
Hide
]
可能的使用场景
Aspose.Cells提供了XmlMapCollection.Add()方法,您可以使用它来在工作簿中导入XML映射。
使用XmlMapCollection.Add方法在工作簿中添加XML映射
以下示例代码使用XmlMapCollection.Add()方法在工作簿内添加XML映射,并将其保存为输出excel文件。屏幕截图显示已从sample.xml中导入的XML映射在输出excel文件中的情况。
示例代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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.getSharedDataDir(AddXMLMapInsideWorkbook.class) + "articles/"; | |
// Create workbook object | |
Workbook wb = new Workbook(); | |
// Add xml map found inside the sample.xml inside the workbook | |
wb.getWorksheets().getXmlMaps().add(dataDir + "sample.xml"); | |
// Save the workbook in xlsx format | |
wb.save(dataDir + "AddXMLMapInsideWorkbook_out.xlsx"); |