Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Excel steps -

 
Remaan Rem
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello every one ..

I was wondering if any one can help me with converting the results of my outputs to an excel file.
In other words,

The assignment was to implement 3-4 sorting algorithms - and test them using charts in Excel.
But the question, how to go from java (the output on the console) to excel .. ?

Is it that I am going to copy past from java to my excel file ?
If so, what type of data is required ?

Thanks alot, and hope hearing from very soon ...
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15490
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to work with Excel files in Java is a frequently asked question, so we have a page about it in our FAQ: Accessing File Formats.

One of the simplest ways to get data in a format that Excel understands is by writing it in a CSV file (comma-separated values). If you want to do more sophisticated things, then have a look at one of the libraries mentioned on the FAQ page.
 
Inder Kumar Rathore
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try Jxl API which is used to read or write the excel sheet
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to use Excel directly to make your charts is probably not the best option you have. If you want to make charts in Java, maybe you should look in libraries like JFreeChart.
 
Remaan Rem
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thaks ..
But the idea is to produce some code that writes the results into a file, and then open that file using Excel.

This is how the question is designed ..

I don't know if you can help me with that code ..

when I know how to write into a file, but reading - am not sure ...

 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a bit unclear to me what, exactly, you're asking help with, but APIs such jExcelApi and Apache POI both can create Excel files. I concur with Christophe that the way to add charts for embedding in an Excel file would be to create those using a Java library (such as JFreeChart) and add them as images to the Excel file. Both libraries mentioned above can do that.
 
Remaan Rem
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This question is asking to write the output into a file, and then open it via excel ..

Besides, I am not really familiar with the methods you've mentioned.

In other words, it's required to write code that does that ..

Thanks alot ..
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked out the web sites that go with those libraries? They contain plenty of example code to get you started. Or were you expecting that people here would write the code for you? That's not really how JavaRanch works.
 
Ganesh Shirsat
Ranch Hand
Posts: 33
Google Web Toolkit Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,

you can use poi library to create a excel file.

example :-

HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();

// --- Creating GridHeader Row for xls file ---
HSSFRow headerRow = sheet.createRow(0);
HSSFCell headerCell = null;
HSSFRichTextString richtextString = null;

poi library help



 
Remaan Rem
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Thanks alot ..

I really appreaite your help ..
I wasn't expecting a code, but rather a hint so I would start my code ..

I got it now !!

Thanks once again Ganesh Shirsat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic