logo       

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

openoffice.devel.general

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

Hello,

This sample work nice in basic but in CLI - C#, I can not pass a cell as
argument in createCursorByRange() only XSheetCellRange type.

------------------------------
Paul Veuve
vep@xxxxxxxx
------------------------------
CDI CONSEILS ET DEVELOPPEMENTS
INDUSTRIELS SA
Chemin de la Justice 15
CH-2000 NEUCHATEL
------------------------------
http://www.cdisa.ch

Phone (+41 32) 733 31 31
or (+41 78) 600 31 31

Fax (+41 32) 733 31 32
------------------------------
-----Message d'origine-----
De : Gerrit Jasper [mailto:g.jasper@xxxxxxxxxx]
Envoyé : dimanche, 17. décembre 2006 00:27
À : dev@xxxxxxxxxxxxxx
Objet : Re: [dev] 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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xxxxxxxxxxxxxx For additional
commands, e-mail: dev-help@xxxxxxxxxxxxxx

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.21/589 - Release Date: 15.12.2006
17:10


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.21/589 - Release Date: 15.12.2006
17:10



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

News | FAQ | advertise