0

I'm using Vaadin 10 and I want to show a spreadsheet to the user. However, the method below is giving me an error:

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);
   }
}

Below is the ExcelOpener helper class:

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;
    }
}

My questions are:

  • How can I solve add(sp) method's error:

Cannot resolve method 'add(com.vaadin.addon.spreadsheet.Spreadsheet)'

  • How can I open an excel with the given path? Is the path I have written is correct? Or should it be "C:/Users/MY_USERNAME/Desktop"
retatu
  • 453
  • 1
  • 9
  • 22
q293439
  • 3
  • 1

1 Answers1

4

The Spreadsheet component is not compatible with Vaadin 10+ (only Vaadin7/8).

As you can see in the comments here https://vaadin.com/blog/vaadin-s-frontend-direction it is said:

Last part is Spreadsheet, and that one is a bit tricky. It is built on top of POI directly, and most of the logic happens on the server side, so it can't really work as a stand-alone client-side web component without a major shift in architecture. We don't have plans today to make it into a web component, but we have a couple promising avenues that we are looking into which could bring it to Flow. First one is that we are looking into a migration tool, or wrapper, from 8 to 10. It basically embeds a Vaadin 8 app within a Vaadin 10 app. We have a proof of concept with Spreadsheet for FW8 wrapped alone and embedded within a full Vaadin 10 app. The other option is a proof of concept of taking a compiled Vaadin 8 GWT widget and building a web component around that, found here: https://github.com/Legioth/connector-element. In it's essence, it replaces the server-side counterpart of Vaadin 8 and hooks itself up to the connector of the widget. This could enable us to compile the Spreadsheet widget into an web component, migrate the server side of Spreadsheet to Flow, and connect the server side back to the web component. We do not, however, any concrete plans on if we are going to do this.

codinghaus
  • 2,218
  • 1
  • 14
  • 19