Hello *Andrew ,*
*                             I  *have been using java as programming
language so I have not
                  found any CurrentSelection() method associated with
xSpreadsheet object.
                 The example you have provided seems to really good but I
have not found
                  any such using java.

              oOldSelection = ThisComponent.CurrentSelection

                What is "ThisComponent" in above line, How would this in
using java?

On 7/10/08, Andrew Douglas Pitonyak <[EMAIL PROTECTED]> wrote:
>
> If only one cell is selected, then you can simply obtain the
> CurrentSelection property from the document. Things are more complicated if
> you must worry about multiple things being selected... it looks like you can
> also grab the selection property from the current controller.
>
> If you want only the cell that contains the cursor, and you want to ignore
> the rest, you can tell the controller to select an empty range that was
> created by the document. The following subroutine does the following:
> 1.Save the current selection. This is useful if more than a single cell is
> active.
> 2.Select an empty range so that only the cell with the cursor is selected.
> The cell is selected with an outline around the cell, but it is not
> completely blacked out. If you use the controller to select a range, this
> method can also be used to change the selection from a completely selected
> cell, to merely an active cell.
> 3.Use the CellAddressConversion service to obtain the address of the active
> cell. This is new to 1.1.1, part of the "linked controls" implementation.
> Listing 2.12: Find the active cell.
> REM Author: Paolo Mantovani
> REM email: [EMAIL PROTECTED]
> Sub RetrieveTheActiveCell()
>  Dim oOldSelection 'The original selection of cell ranges
>  Dim oRanges        'A blank range created by the document
>  Dim oActiveCell   'The current active cell
>  Dim oConv          'The cell addres conversion service
>  REM store the current selection
>  oOldSelection = ThisComponent.CurrentSelection
>
>  oRanges =
> ThisComponent.createInstance("com.sun.star.sheet.SheetCellRanges")
>  ThisComponent.CurrentController.Select(oRanges)
>  'get the active cell!
>  oActiveCell = ThisComponent.CurrentSelection
>
>  REM a nice service I've just found!! :-)
>  oConv =
> ThisComponent.createInstance("com.sun.star.table.CellAddressConversion")
>  oConv.Address = oActiveCell.getCellAddress
>  Print oConv.UserInterfaceRepresentation
>  Print oConv.PersistentRepresentation
>
>  'restore the old selection (but loosing the previous active cell)
>  ThisComponent.CurrentController.Select(oOldSelection)
> End Sub
>
>
>
>
> Dinesh Chothe wrote:
>
>>    XTextViewCursorSupplier xViewCursorSupplier =
>>                ( XTextViewCursorSupplier )UnoRuntime.queryInterface (
>>                XTextViewCursorSupplier.class, xTextDocument );
>>         For getting current position from current document I did as above.
>>        Now while doing this same for spreadsheet it doesnt work by passing
>> xSpreadsheet instead of   xTextDocument.
>>        How would I access current active cell in spreadsheet?
>>
>> On Tue, Jul 8, 2008 at 5:26 PM, Andrew Douglas Pitonyak <
>> [EMAIL PROTECTED]>
>> wrote:
>>
>>
>>
>>> Dinesh Chothe wrote:
>>>
>>>
>>>
>>>> Hello,
>>>>         I want to get current position of cursor from documents XTable
>>>> or
>>>> XTextDocument
>>>>           also for calc I want to get current cells position. How do I?
>>>>         I am using OoSDK2.3 and java...
>>>>
>>>>
>>>>
>>>>
>>> I believe that the view cursor has a property TextTable and a property
>>> Cell. The cell has a property CellName.
>>>
>>> --
>>> Andrew Pitonyak
>>> My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
>>> My Book: http://www.hentzenwerke.com/catalog/oome.htm
>>> Info:  http://www.pitonyak.org/oo.php
>>> See Also: http://documentation.openoffice.org/HOW_TO/index.html
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
> --
> Andrew Pitonyak
> My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
> My Book: http://www.hentzenwerke.com/catalog/oome.htm
> Info:  http://www.pitonyak.org/oo.php
> See Also: http://documentation.openoffice.org/HOW_TO/index.html
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Thanks and Regards,



   Dinesh

Reply via email to