Aspose.Cells to customized xml output

Hi,
We tried below code from this link Convert Excel XLS XLSX to XML in C# | C# Excel (XLS, XLSX) to XML Converter,
Workbook workbook = new Workbook(“sample.xlsx”);
workbook.Save(“Spreadsheet.xml”);
XmlSaveOptions xmlSaveOptions = new XmlSaveOptions();
workbook.Save(“data.xml”, xmlSaveOptions);

It is producing xml output as shown there.

We have custom requirement where we are expecting xml output in below format or refer attached image,

<root>
	<Student ID=1>
		<NAME>Student1</NAME>
		<DateofBirth>10-mar-2012</DateofBirth>
	</fund>
	<Student ID=2>
		<NAME>Student2</NAME>
		<DateofBirth>21-mar-2012</DateofBirth>
	</fund>
	<Student ID=3>
		<NAME>Student3</NAME>
		<DateofBirth>15-mar-2012</DateofBirth>
	</fund>
</root> 

image.png (2.7 KB)

and my data input will look like below,
Student NAME DateOfBirth
1 Student1 10-mar-2012
2 Student2 21-mar-2012
3 Student3 15-mar-2012

Could you let us know if this is possible using Aspose.
Also If we can set the format using dynamic template then It will be more helpful.

@Umeshb,
May I ask if you are using Aspose.Cells Cloud or Aspose.Cells local components?
If you are using Aspose.Cells Cloud, you can try the Convert API or SaveAs API.
However, the current output result does not meet the output format you have proposed, so we need to evaluate it further.

@Umeshb,

You can implement your functionality with the following code:

string filename = “BookXML.xlsx”;
Workbook wb = new Workbook(InPutFloder + filename);
wb.ExportXml(wb.Worksheets.XmlMaps[0].Name, OutPutFloder + “output.xml”);

Currently, Aspose.Cells Cloud does not support this feature. If you need this feature, we will evaluate it and try to implement it as soon as possible.

Hi @wangtao,
Thank you for your quick response.
We are using Aspos.Cells local components.
I checked your code and had query in below line,
wb.ExportXml(wb.Worksheets.XmlMaps[0].Name, OutPutFloder + “output.xml”);
Could you share the input file you use to see what is inside wb.Worksheets.XmlMaps[0].Name

as you can see our first node

<Student ID=1>

has attribute ID, Could you guide us how can we set that in dynamic template?

@Umeshb,

I moved this post to Aspose.Cells Product Family - Free Support Forum - aspose.com.

This topic has been moved to the related forum: Aspose.Cells to customized xml output - Free Support Forum - aspose.com