File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes xls to xml conversion application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "xls to xml conversion application" Watch "xls to xml conversion application" New topic
Author

xls to xml conversion application

sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 364
Hi,

I have a xls file with two sheets namely sheet1 and sheet2

sheet 1 having 3 columns say

1. product 2. total 3. cost
has about 100 records


sheet2 also having same 3 columns say

1. product 2. total 3. cost
has about 10 records.

I need to convert above xls to xml with similar structure as follows


<sheet1>
<product1>
<product></product>
<total></total>
<cost></cost>
</product1>
<product2>
<product></product>
<total></total>
<cost></cost>
</product2>
.....more products
</sheet1>

<sheet2>
<product1>
<product></product>
<total></total>
<cost></cost>
</product1>
<product2>
<product></product>
<total></total>
<cost></cost>
</product2>
.....more products
</sheet2>

what is the best way to achieve it. Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance



Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42956
    
  73
You can use Apache POI to read the file, and then use any number of XML APIs to write it, like DOM, JDom, XOM etc.
 
wood burning stoves
 
subject: xls to xml conversion application
 
It's not a secret anymore!