Solved

to read and write to excel from java code not working

Posted on 2008-10-19
1
809 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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 learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

726 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