Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Read an Excel Sheet with the Services java Extention(Somewhere must be something wrong)
Read an Excel Sheet with the Services java Extention [message #1791071] Fri, 22 June 2018 11:25
Andreas Buchner is currently offline Andreas BuchnerFriend
Messages: 47
Registered: August 2017
Member
Hi everyone,

I think I have found a bug...

What i try is to read an Excel Sheet with the jxl.java Library.

The Code is quite simple but leads to an disturbance!
public void readExc() throws IOException  {
	
	File inputWorkbook = new File("C:\\Users\\buchan4\\desktop\\TestExcelforEclipseImport.xls");
    Workbook w = null;
    String Value = null;
    
    try {
        w = Workbook.getWorkbook(inputWorkbook);
  
    } catch (BiffException e) {
        e.printStackTrace();}
    Sheet sheet = w.getSheet(0);
    Cell cell = sheet.getCell(0,0);
    Value = cell.getContents();
    JOptionPane.showMessageDialog(null, Value + ",  Im called from Services"); 
}



If I have this peace of code in my Services Class, all of the methodes of the Service stops to work, when I call it from a representation (or the Sirius Interpreter). I know the Code is correct, it works elsewhere.

If I put the try and catch line as a comment, I can call the methods of the Services from the representation or the Interpreter again.
index.php/fa/33206/0/

That made me believe, that the Code would not work in the Service at all. But it does. I have created another class, which calls the Methode from the Service.

index.php/fa/33205/0/
heres the code of the other class:
public class ReadExcel1 {

	public void read() throws IOException  {
		
		File inputWorkbook = new File("C:\\Users\\buchan4\\desktop\\TestExcelforEclipseImport.xls");
        Workbook w;
        String Value = null;
        try {
            w = Workbook.getWorkbook(inputWorkbook);
            Sheet sheet = w.getSheet(0);
                    Cell cell = sheet.getCell(0,0);
                    Value = cell.getContents();
                    System.out.println(Value);
                    JOptionPane.showMessageDialog(null, Value+ ",  Im called from ReadExcel1");
                    Services s = new Services();
        	        s.readExc();
                    
            
        } catch (BiffException e) {
            e.printStackTrace();
        }
        
}
	
	 public static void main(String[] args) throws IOException {
		 ReadExcel1 test = new ReadExcel1();
			test.read();
	        }
}


I dont know exactly where the bug is, but somethings wrong I guess???

If you have better ways to read Excel files, please let me know?
Previous Topic:Read an Excel Sheet with the Services java Extention
Next Topic: [Solved] How to share a singleton between "Services.java" and other plugins ?
Goto Forum:
  


Current Time: Thu Apr 25 16:29:17 GMT 2024

Powered by FUDForum. Page generated in 0.02970 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top