logo       

Re: Calc C#CLI programming - Get the used range in a sheet - XUsedAreaCurs: msg#00132

openoffice.devel.general

Subject: Re: Calc C#CLI programming - Get the used range in a sheet - XUsedAreaCursor

Paul Veuve wrote:
Thanks for your help Juergen.

I try this.

unoidl.com.sun.star.sheet.XSheetCellCursor
xCursor = xSheet.createCursor();

unoidl.com.sun.star.sheet.XUsedAreaCursor
xUsedCursor =
(unoidl.com.sun.star.sheet.XUsedAreaCursor)xCursor;
xUsedCursor.gotoStartOfUsedArea(true);
xUsedCursor.gotoEndOfUsedArea(true);

But I don't find the way to extract the range of used cells.

Accessible methods for xUsedCursor are:
xUsedCursor.Equals()
xUsedCursor.GetHashCode()
xUsedCursor.GetType()
xUsedCursor.gotoStartOfUsedArea()
xUsedCursor.gotoEndOfUsedArea()
xUsedCursor.ToString()

I miss someting in the access principle.

Thank's for your help.

------------------------------
Paul Veuve
vep@xxxxxxxx
------------------------------
Paul,

You need the address. I use this function:

Function getLastUsedColRow(oSheet as Object) as Integer
Dim oCell As Object
Dim oCursor As Object
Dim aAddress As Variant
oCell = oSheet.GetCellbyPosition( 0, 0 )
oCursor = oSheet.createCursorByRange(oCell)
oCursor.GotoEndOfUsedArea(True)
aAddress = oCursor.RangeAddress
lastCol = aAddress.EndColumn lastRow = aAddress.EndRow
End Function

I hope this helps.
Sincerely,
Gerrit Jasper


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise