aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes convert Excel to XML format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "convert Excel to XML format" Watch "convert Excel to XML format" New topic
Author

convert Excel to XML format

fang eve
Greenhorn

Joined: Jun 22, 2006
Posts: 26
I have an excel file, which i want to convert it to xml using JAVA. anyway to do it?

My concept:
The excel is uploaded and the values are inserted into database. I need to grab the header and the values, and generate out 1 xml file. eg

excel file format:
header1 header2 header3
rs1 rs2 rs3
rs4 rs5 rs6

i would like to store the value in Vector either this way [[header1,header2,header3],[rs1,rs2,rs3]] OR
[[header1,rs1,rs4][header2,rs2,rs5]]

my code is as follow



my desired xml format is
<header1>
<content>rs1</content>
<content>rs4</content>
</header1>
<header2>
<content>rs2</content>
<content>rs5</content>
</header2>
<header3>
<content>rs3</content>
<content>rs6</content>
</header3>

[ July 05, 2006: Message edited by: fang eve ]
[ July 05, 2006: Message edited by: fang eve ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42263
    
  64
Generating XML isn't very different from genertaing HTML, which you seem to have implemented already. The XML format you're looking for is column-oriented, not row-oriented like the code you posted, so you need to adapt your iteration logic to that.

I don't understand what you're trying to do with the database, or what storing values in a Vector has to do with generating XML.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: convert Excel to XML format