Make a sheet scroll max left

1 Answer 69 Views
Spreadsheet
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Ian asked on 24 May 2023, 02:05 PM

For some reason - probably due to  me doing some re-sizing of columns - my sheets are now opening scrolled a bit to the right, which means my important left-hand columns are not visible without scrolling.

I assume this will be annoying to users - It certainly took me an hour to figure out what had happened to my left-hand columns. :-(

I tried to make the sheet scroll left in the control.load event:

 mySpreadsheetControl.HorizontalScroll.Value = 0

...but that didn't seem to work.

Does anyone know the right way to scroll left in a sheet?

Thanks

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 26 May 2023, 11:19 AM

Hi Ian,

What comes up to my mind is called the BringIntoView() method. You can pass the cell index and it will be brought into the view. 

CellIndex cellIndex = new CellIndex(rowIndex, columnIndex);
radSpreadsheet.SpreadsheetElement.ActiveWorksheetEditor.BringIntoView(cellIndex);

Can you try this approach and let me know if it works for you?

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Ian
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 31 May 2023, 11:34 AM

I've tried this, and nothing seems to happen.

In my example, there some hidden columns and rows, if that makes a difference:

So columns A and B are hidden, and rows 0, 1 and 3.,

I'm tring  ...BringIntoView(new CellIndex(4,2) , but it doesn't change anything.

What I need is:  

Any more ideas ? 

I know this seems like a trivial problem, but this is the first screen my users see, and right now it looks like there is a column missing, wihich is the column that tells them what's happening, so I need to find a fix.

Thanks

Dinko | Tech Support Engineer
Telerik team
commented on 01 Jun 2023, 09:02 PM

I have tested the code and the scrollbar is moving. To be on the same track, can you send me a sample xlsx file with the same setup but with dummy data to test it on my side? It seems that I am missing something here. 

I am looking forward to your reply.

Ian
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 05 Jun 2023, 11:37 AM

Did you try it with some hidden rows and columns ?
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 05 Jun 2023, 11:58 AM

I have not yet tried it in a stand-alone, simple test case, but it seems like a lots of these re-formatting actions (like feezing rows/columns, bringing rows/coumns into view) work perfectly when I get the user to press a button on a sheet which has already been populated, but don't work at all if I am doing the formatting as part of the setup of the sheet, before the user gets to see it.

Is this a possible explanation? Does your working case do the formatting/bring to view as part of the set, or in response to another button press?

Ian
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 05 Jun 2023, 01:12 PM

OK - I have tried this in a stand-alone test case and you are 100% correct: everything works.

Back to my code :-(

Dinko | Tech Support Engineer
Telerik team
commented on 07 Jun 2023, 08:26 AM

My test case involved pressing a button when the control has loaded a predefined xlsx file format customized to look similar to the one in your image. I am attaching the sample project with the file. I need to point out that initially, the scroll starts from the start of the spreadsheet. Moving the scrollbar to the right and pressing the button at the bottom will bring it back it its start position. That is why I assume that this is related to the settings in the document. You can check my test xlsx file in the zip file and modify it to mimic your document and send it back to me so that I can perform more tests.
Tags
Spreadsheet
Asked by
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or