[api-dev] Re: Scrolling a spreadsheet with a macro

2011-03-05 Thread Niklas Nebel

On 05.03.2011 01:06, Johnny Rosenberg wrote:

I just ran into a problem doing this. The problem is that I have ”fixed”
the sheet, so I am always able to see the first rows and the first
column, so the A column and the 4 first rows are always visible.

I always want A1 to be selected, keeping the selection out of the
important area. However, A1 is above the ”fix point” and therefore I
can't scroll unless I first select a cell below the ”fix point” and then
reselect A1 again.


There's no need to change the selection. If the view is split or frozen, 
you can use the XIndexAccess interface to get the individual panes. 
Something like this:

oPane = oView(1)
oPane.FirstVisibleRow = 6

Niklas
--
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Scrolling a spreadsheet with a macro

2011-03-05 Thread Johnny Rosenberg

Den 2011-03-05 10:34:58 skrev Niklas Nebel niklas.ne...@oracle.com:


On 05.03.2011 01:06, Johnny Rosenberg wrote:

I just ran into a problem doing this. The problem is that I have ”fixed”
the sheet, so I am always able to see the first rows and the first
column, so the A column and the 4 first rows are always visible.

I always want A1 to be selected, keeping the selection out of the
important area. However, A1 is above the ”fix point” and therefore I
can't scroll unless I first select a cell below the ”fix point” and then
reselect A1 again.


There's no need to change the selection. If the view is split or frozen,  
you can use the XIndexAccess interface to get the individual panes.  
Something like this:

oPane = oView(1)
oPane.FirstVisibleRow = 6

Niklas
--


Okay, thanks. I did some searching and found some information, but I  
didn't really understand how to implement it in my case, for some reasons:
1. I'm a bloody guitarist, not a programmer (but I still try to do some  
”programming” now and then…)
2. My native language is not English, which does not stop me in most  
cases, but I might get somewhat confused sometimes…


So I guess I need to solve this by not including all the features that I  
want…


Thanks anyway, for trying…

--
Kind regards

Johnny Rosenberg
--
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Scrolling a spreadsheet with a macro

2011-03-04 Thread Niklas Nebel

On 04.03.2011 17:18, Johnny Rosenberg wrote:

Have been looking for it with Xray, but so far I didn't find anything
that I think does what I want.

What I want to do is to search for a cell. When I find it, I want it to
appear as the first row and the the first column. Let's say that I find
what I'm looking for in C7. Then I want the sheet to scroll so that it
appears like this:

C D E F G H I J…
7
8
9
10
11
12
13
14
15
⁝


Use the view's XViewPane interface. In Basic that's just
oView.FirstVisibleColumn = 2
oView.FirstVisibleRow = 6

Niklas
--
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Scrolling a spreadsheet with a macro

2011-03-04 Thread Johnny Rosenberg

Den 2011-03-04 17:56:12 skrev Niklas Nebel niklas.ne...@oracle.com:


On 04.03.2011 17:18, Johnny Rosenberg wrote:

Have been looking for it with Xray, but so far I didn't find anything
that I think does what I want.

What I want to do is to search for a cell. When I find it, I want it to
appear as the first row and the the first column. Let's say that I find
what I'm looking for in C7. Then I want the sheet to scroll so that it
appears like this:

C D E F G H I J…
7
8
9
10
11
12
13
14
15
⁝


Use the view's XViewPane interface. In Basic that's just
oView.FirstVisibleColumn = 2
oView.FirstVisibleRow = 6

Niklas


Thanks! Your answer eventually lead me to the following subroutine:


Sub Scroll(Col As Long, Row As Long)
ThisComponent.getCurrentController().setFirstVisibleColumn(Col)
ThisComponent.getCurrentController().setFirstVisibleRow(Row)
End Sub

Works like a charm!

--
Kind regards

Johnny Rosenberg
--
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Scrolling a spreadsheet with a macro

2011-03-04 Thread Bernard Marcelly

Hi,

I always want A1 to be selected, keeping the selection out of the important 
area.


Why select A1 ? Select any other far away cell, e.g. cell KK3000
_Then_ set the first visible row and column.

Regards
  Bernard

--
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help