Vaadin Spreadsheet paste with integer

Hi,
When entering a value in a cell, I can intercept cell creation with a custom CellValueHandler. That’s nice, I like the design of this. My main use of this is to prevent vaadin from letting poi converting an integer like string from 1 to 1.0. It’s to late in CellValueChangeListener, the cell is created and poi has already added .0 to the entered string, this is a known poi thing.

But, for paste, no such design is implemented. Any other way to intercept cell creation/typing?

OlaM

Hi Ola,

This seems to be related to: https://dev.vaadin.com/ticket/19200

Having a custom handler for paste action would allow you to prevent default behavior, but hasn’t been implemented yet.

As a workaround you could change the cell type in CellValueChangeListener but I’m not sure if you can recognize if it’s the case.

Regards,

Guille

Hi Guillermo,

Thanks for you reply, that is exactly the issue.

No, as I wrote it’s not possible to see in CellValueChangeListener if the user wrote or pasted 1 or 1.0. the poi Cell has already a double value of 1.0. so that is no viable workaround. Changing the cell type here only allows me to do cell.getStringCellValue(), and get a string with .0 added to it.

Will have to hack it in to my local copy of vaadin spreadsheet that I have for overriding the hard coded 30 pixel height for cells with custom components :confused:

OlaM