Installing jxls

dshrenik
dshrenik used Ask the Experts™
on
If anybody has tried out jxls, please let me know how I can get started. If possible, please give me a step-by-step procedure.
http://jxls.sourceforge.net/

Not sure where I need to copy the extracted folder (from downloads) and how I can set up the classpath and dependencies.

Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Awarded 2011
Awarded 2011
Commented:
Are you using any IDE?

You extract from zip file jxls-1.0-RC-2.zip
and then yu'll see ReadMe.txt file - you need to download all those libraries mentioned in there
Awarded 2011
Awarded 2011
Commented:
after that, if you are using IDE you need to add all these jars which you downloaded plus the
jxls-core-1.0-RC-2.jar to your project.

If no IDE you need to add the path to these jar to your CLASSPATH
Let me know about your environemnt and we'll go through it

Author

Commented:
I'm using Eclipse.
Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

Awarded 2011
Awarded 2011

Commented:
If you need the functionaliy described below, you'll also need to have jxls-reader-1.0-RC-2.jar
in your classpath or in your project. Chances are you would not need it

In addition to Excel generation functionality jXLS also contains jxls-reader module which provides a great help if you need to parse Excel files created in a predefined format to pull in the data. jXLS-reader allows you to describe parsing rules in a simple XML and all the other work on reading Excel file and population of your Java objects will be done automatically.

Author

Commented:
I don't need the reader. Just need to create xls files with charts.
Awarded 2011
Awarded 2011
Commented:

If you are using Eclipse,
after you have all these jar files downloaded nicely to   some folder on your local drive,
right-click your project inte list of projects in Eclipse and select Build Path --> add External Archive
then browse to your  folder and add the jars one by one.
Let me know if you encounter any problems.

Author

Commented:
When I try the code on http://jxls.sourceforge.net/samples/chartsample.html,
I get an errors saying "Syntax error on token "add", = expected after this token" on line 2.

Please let me know if I have to post this as a different question.
Awarded 2011
Awarded 2011

Commented:
This code is just a snippet - you need to put it within the class, etc.
Did you place it in a classwith main method .etc?

Author

Commented:
I did.
Awarded 2011
Awarded 2011

Commented:
Perhaps, something like that:
public class TestJXL{
public TestJXL(){
List staff = new ArrayList();
				        staff.add(new Employee("Derek", 35, 3000, 0.30));
				        staff.add(new Employee("Elsa", 28, 1500, 0.15));
				        staff.add(new Employee("Oleg", 32, 2300, 0.25));
				        staff.add(new Employee("Neil", 34, 2500, 0.00));
				        staff.add(new Employee("Maria", 34, 1700, 0.15));
				        staff.add(new Employee("John", 35, 2800, 0.20));
				        staff.add(new Employee("Leonid", 29, 1700, 0.20));
				        Map beans = new HashMap();
				        beans.put("employee", staff);
				        XLSTransformer transformer = new XLSTransformer();
				        transformer.markAsFixedSizeCollection("employee");
				        transformer.transformXLS(templateFileName, beans, destFileName);
}
public static void main(String [] args){

new TestJXL();
}
}

Open in new window

Awarded 2011
Awarded 2011

Commented:
Post your whole code, I'll have a look

Author

Commented:
Not sure why mine did not work. Yours does. Thanks!
Awarded 2011
Awarded 2011

Commented:
Great!
Mick BarryJava Developer
Top Expert 2010
Commented:
you'll find what you need to set things up here
http://jexcelapi.sourceforge.net/resources/faq/

Author

Commented:
Thanks all!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial