• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Excel steps -

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ...
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try Jxl API which is used to read or write the excel sheet
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ...

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 33
Google Web Toolkit Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic