2

I'm working on struts 2 with hibernate 3. I've a functionality of Importing from excel doc in it. I found how to import from excel file once the file is uploaded by using the following code.

try {
    File uploadToBatch=new File("C:\\Users\\user\\Desktop\\Book2.xls");
    Workbook w;

    w = Workbook.getWorkbook(uploadToBatch);

    Sheet sheet = w.getSheet(0);

    System.out.println(sheet.getName()+"  "+sheet.getColumns()+"  "+sheet.getRows());

    for(int i=0;i<sheet.getRows();i++)
        for(int j=0;j<sheet.getColumns();j++)
            System.out.println(sheet.getCell(j, i).getContents());

} catch (Exception e) {
    e.printStackTrace();
    System.out.println(e.getMessage());
    //addActionError(e.getMessage());

    // return ERROR;

}

Now what I want is when the user drags some rows from excel file and drops into the webpage I have to get the values and pass it to server. I can't use an ActiveX object since it must support all operating systems and browsers as well.

Please give me some ideas.

Jean-François Corbett
  • 37,420
  • 30
  • 139
  • 188
Ram
  • 845
  • 1
  • 13
  • 26
  • probably this might help http://stackoverflow.com/questions/2006468/copy-paste-from-excel-to-a-web-page – basav Jan 29 '13 at 07:43
  • Thanks Basav.. That was useful. But I'm still searching for some more stuffs like that... – Ram Jan 29 '13 at 10:40
  • The only way is to split fields on tab and rows on newlines there isn't going to be anything more. – Quaternion Jan 29 '13 at 23:22

0 Answers0