my dog learned polymorphism*
The moose likes Other Open Source Projects and the fly likes Basic Java API for creating Excel? 2 DIM table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Basic Java API for creating Excel? 2 DIM table" Watch "Basic Java API for creating Excel? 2 DIM table" New topic
Author

Basic Java API for creating Excel? 2 DIM table

H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 381
Hi,

What is the basic JAVA API for creating Excel? I need to create a simple 2 DIM table as below.

Item | Color | Quantity

XZY | RED | 100


1M Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
The easiest would be to use CSV - the http://www.coderanch.com/how-to/java/AccessingFileFormats page lists several libraries for that.


Ping & DNS - updated with new look and Ping home screen widget
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 381
(Used Apache POI)

For now the Name of header column is hard-coded as below. So is the data using the getters as below:



Question:

Is there a way where I can externalize the header name like Items, Dimension, Price in a file (properties)
so that within the JAVA source code will do the getter automatically?

By that I mean, if I need to add 2 extra header column, then all I need to add to the external file
and there is no need to change the JAVA source code.

OR is there any better way of doing what I did?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
I don't see why that should be a problem.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 381
It's not really a problem. It's just "static" in the sense
if I need some extra column/field, I need to modify the JAVA source code



I just to make the column/fields configured in an external file so that it's more "dynamic" so that JAVA read these fields and dynamically generate
Excel Header column and data column from corresponding getters.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
That's not what I meant. I meant that I don't see a problem with reading a properties file, and based on the information in it, generate a varaiable number of columns in the spreadsheet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic Java API for creating Excel? 2 DIM table
 
Similar Threads
code too long
java excel api
Login to ASP page
how to generate excel report from servlet
Servlet excel problems ...urgent help needed Pls. (MARK any help?)