I have a requirement to convert OpenOffice Excel data into XML . I have Apache OpenOffice 4.1.1 in my machine (not MS- Office).
Sample Data. (First Row is of Tags )
CustData FirstName MiddleName LastName EMail PhoneNumber
abe x Park abe@mail.com 2323232323
poppy y Kaith Poppy@mail.com 2323232323
Need Result as :
<CustData>
<FirstName>abe</FirstName>
<MiddleName>x</MiddleName>
<LastName>Park</LastName>
<EMail>abe@mail.com</EMail>
<PhoneNumber>2323232323</PhoneNumber>
</CustData>
<CustData>
<FirstName>poppy</FirstName>
<MiddleName>y</MiddleName>
<LastName>Kaith</LastName>
<EMail>Poppy@mail.com </EMail>
<PhoneNumber>2323232323</PhoneNumber>
</CustData>
You can download OpenXmlSDK Open XML SDK It contains Productivity Tools which could help you to discover structure of excel documents, for example:
And then use any available XSLT tutorial to find out about approaches of conversion one XML structure to another
Tutorial 1
Java tutorial
And also this might help you:
https://github.com/foglcz/xsl-excel-engine
Openoffice and Libreoffice Calc is able transforming its XML via
XSLT
withExport Filters
. To do so with your example data, do the following:At first create the following XSL file and save it as
SampleDataExportFilter.xsl
:Now open Calc and select
Tools
-XML Filter Settings
:Select
New
and fill the dialogGeneral
:In the register
Transformation
select theSampleDataExportFilter.xsl
asXSLT for export
:Confirm with
OK
and the XML Filter Settings withClose
.Now create the following Calc file:
With
File
-Export
you shold now be able to export the spreadsheet data using theFile type
CustData (.xml)
as XML.