0

Extract celldata from the last selected position in Spreadsheet (keikai 5.x)

asked 2020-09-11 01:42:33 +0800

bztom35 gravatar image bztom35
53 4

updated 2020-09-11 07:33:44 +0800

How to extract the end position of the selected cell? For example for A1:A10, I want to get the print out cell content of A10.

  public void onCellSelection$ss(CellSelectionEvent event){

   System.out.println("selected range: " +  Ranges.getAreaRefString(event.getSheet() , event.getArea()));

 Range selectedRange = Ranges.range(ss.getSelectedSheet(),event.getRow(),event.getColumn());
         System.out.println("Selected row: " +   selectedRange .toRowRange().getCellEditText() + " "  +   selectedRange.getCellEditText());

}

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-09-11 10:04:29 +0800

hawk gravatar image hawk
2655 1 5
http://hawkphoenix.blogsp... ZK Team
@Listen(Events.ON_CELL_SELECTION + " = #ss")
public void onCellSelection(CellSelectionEvent event){
    Ranges.getCellRefString(event.getArea().getLastRow(), event.getLastColumn());
    Ranges.getCellRefString(ss.getSelection().getLastRow(), ss.getSelection().getLastColumn());
}
link publish delete flag offensive edit

Comments

Yes. it worked. thank you for your help. I have to put it into two different listeners.

bztom35 ( 2020-09-11 11:57:27 +0800 )edit
0

answered 2020-09-11 12:01:58 +0800

bztom35 gravatar image bztom35
53 4
@Listen("onCellSelection = #ss")
 public void onCellSelection(CellSelectionEvent event){
  Range  selectedRangeStart = Ranges.range(ss.getSelectedSheet(),event.getRow(),event.getColumn());
 System.out.println("Selected row Start: " +   selectedRangeStart .toRowRange().getCellEditText() + " "  +   selectedRangeStart.getCellEditText());
        }


@Listen("onCellSelectionUpdate = #ss")
public void onCellSelectionUpdate(CellSelectionUpdateEvent event){                          
Range selectedLastRow = Ranges.range(ss.getSelectedSheet(),event.getArea().getLastRow(),event.getLastColumn());
  System.out.println("Selected row End: " +   selectedLastRow.toRowRange().getCellEditText() + " "  +  selectedLastRow.getCellEditText());

                    }
link publish delete flag offensive edit

Comments

unless you have a special need, you can put those 2 callings in one listener.

hawk ( 2020-09-21 09:44:09 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2020-09-11 01:42:33 +0800

Seen: 6 times

Last updated: Sep 11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More