Solved

to read and write to excel from java code not working

Posted on 2008-10-19
1
789 Views
Last Modified: 2013-11-23
In this prg if i write it is not writing it is blank  also please tell me hoe to read write a bunch of data
import java.io.File;
import java.io.IOException;
import java.util.Date;
import jxl.*;
import jxl.read.biff.BiffException;
import jxl.write.*;
import jxl.write.Number;
import jxl.write.biff.RowsExceededException;




 

public class RwExcel {

      /**
       * @param args
       */
      /**
       * @param args
       * @throws IOException
       * @throws BiffException
       * @throws WriteException
       * @throws RowsExceededException
       */
      public static void main(String[] args) throws BiffException, IOException, RowsExceededException, WriteException {
            
                  Workbook workbook = Workbook.getWorkbook(new File("test.xls"));
                  Sheet sheet = workbook.getSheet(0);
                  Cell a1 = sheet.getCell(0,0);
                  Cell b2 = sheet.getCell(1,1);
                  Cell c2 = sheet.getCell(2,1);

                  String stringa1 = a1.getContents();
                  String stringb2 = b2.getContents();
                  String stringc2 = c2.getContents();
            
                  System.out.println("Hai  "+ stringa1 +" " + stringb2);
            /*WritableWorkbook workbook = Workbook.createWorkbook(new File("output.xls"));

                  WritableSheet sheet = workbook.createSheet("First Sheet", 0);
                  Label label = new Label(0, 2,  "A label record");
                  
                  sheet.addCell(label);
                  

                  Number number = new Number(3, 4, 3.1459);
                  sheet.addCell(number); */

            

      }

}
0
Comment
Question by:cakurien
1 Comment
 
LVL 6

Accepted Solution

by:
wwnosal earned 500 total points
ID: 22751693
I don't know this jxl software but I'm using poi to write and read Excel files. You have a link here
http://poi.apache.org/
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This video teaches viewers about errors in exception handling.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now