Solved

to read and write to excel from java code not working

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JUnit 4 @Before and @BeforeClass differences 3 62
servlet requestdispatcher include and forward differences 1 33
SHA2 certs for IIS AND Java? 2 98
jsp login check 12 32
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
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…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

825 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