我正在使用 Vaadin 10,我想向用户显示电子表格。但是,下面的方法给了我一个错误:
public class SomeUI extends VerticalLayout{
private SomeUI(){
// ... some add(Components)
String path = "C:\\Users\\MY_USERNAME\\Desktop";
Spreadsheet sp = ExcelOpener.openFile(path);
// this line does not work
// add(sp);
}
}
下面是 ExcelOpener 助手类:
public class ExcelOpener {
public static Spreadsheet openFile(String path){
// I will use the path to open given excel later.
// Right now I want to open an empty spreadsheet and show it to the user
Spreadsheet spreadsheet = null;
spreadsheet = new Spreadsheet();
return spreadsheet;
}
}
我的问题是:
如何解决 add(sp) 方法的错误:
无法解析方法“添加(com.vaadin.addon.spreadsheet.Spreadsheet)”
如何使用给定路径打开 Excel?我写的路径是否正确?或者应该是"C:/Users/MY_USERNAME/Desktop"
呼唤远方
相关分类