Solved

to read and write to excel from java code not working

Posted on 2008-10-19
1
779 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

707 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

12 Experts available now in Live!

Get 1:1 Help Now