Alle 01:17, venerdì 09 giugno 2006, Bart Aimar ha scritto:

discutiamola un po'....

>
> REM  *****  BASIC  *****
> Sub Main_valerio
> Duplica_Sheet1
> Riordina_A (2, true)'
>   'il numero 2 corrisponde
>   ' alla colonna C
> end sub
>
1.fin qui è chiarissima :-)

> Sub Duplica_Sheet1
> ' duplica un foglio e aggiunge un suffisso al nome
> dim iNumInser as integer
>       oDoc = thisComponent
>       sNomeSheet = oDoc.currentcontroller.activesheet.name
>       oSheet = oDoc.currentcontroller.activesheet
>     ''' Copy_PageStyle
>       print_area= oSheet.getPrintAreas
>       ' registro l'area di stampa
>
2.qui sopra: è necessario anche se si ricopia tutto il foglio?

>       RepeatRows = oSheet.getTitleRows
>       'registro le righe da ripetere (intestazione colonna)
>
3. qui sopra: posso decidere quante righe costituiscono l'intestazione?
potrei mettere una setTitleRows?

>       PrintRepeatRows = oSheet.PrintTitleRows
> ' i parametri "optional" devono essere verificati nell'ordine
> ' in cui vengono passati!!
>
???

>       if isMissing (sSuffix) Then
>                       sSuffix = "_print"
>               else
>                       sSuffix = "_copia"
>       end if
>       sRaggrup = sNomeSheet & sSuffix
>       If thisComponent.Sheets.hasByName(sNomeSheet & sSuffix) Then
>               If thisComponent.Sheets.hasByName(_
>               sNomeSheet & sSuffix & "_bk") Then
>                       thisComponent.Sheets.removebyname(_
>                       sNomeSheet &  sSuffix & "_bk")
>               end if
>               oSheet = oDoc.Sheets.getByName(sNomeSheet & sSuffix)
>               oSheet.Name = sNomeSheet &  sSuffix & "_bk"
>       end if
>
>                       oDoc = ThisComponent
>                       iNumInser = oDoc.Sheets.count
>       sNome = sNomeSheet & sSuffix
>       oDoc.Sheets.CopybyName(sNomeSheet,sNome, iNumInser)'
>       oSheet = oDoc.Sheets.getByName(sNomeSheet & sSuffix)
>       oDoc.CurrentController.SetActiveSheet(oSheet)
>       ' Salta al foglio duplicato
>       oSheet.setPrintAreas(print_area)
>       oSheet.setTitleRows(RepeatRows)
>       oSheet.setPrintTitleRows(PrintRepeatRows)
> END SUB
>
ok, mi sembra di averla digerita abbastanza bene

passiamo alla prossima :-)

> Function Riordina_A (_
>       ColRior as integer, AscDesc as boolean)as variant
> ' Riordina l'elenco prezzi con criteri
> ' a scelta...
>
4. è possibile impostare più criteri di ordinamento? tipo la finestra di 
dialogo: per col. C, quindi per col. D....?

> dim lrowF as long
> dim oSheet as object
> odoc = thiscomponent
> oSheet = odoc.Sheets.getByName(_
> odoc.currentcontroller.activesheet.name)
>
ok

> oLastCell = getLastUsedCell(oSheet)
> lcolEnd = oLastCell.Endcolumn
> lrowEnd = oLastCell.EndRow
> oMioRange = osheet.getCellRangeByPosition(0,1,lcolEnd,lrowEnd)
>
5. in fondo alla tabella ci sono commenti e schifezze varie, c'è un modo 
per determinare, anche interattivamente, il range di righe/colonne da 
riordinare?

> ' e poi lo riordina
>    Dim oSheetDSC,oDSCRange  As Object
>    Dim aSortFields(0) As New com.sun.star.util.SortField
>    Dim aSortDesc(0) As New com.sun.star.beans.PropertyValue
>    aSortFields(0).Field = ColRior ' 0
>    aSortFields(0).SortAscending =  AscDesc 'TRUE'FALSE
>    aSortDesc(0).Name = "SortFields"
>    aSortDesc(0).Value = aSortFields()
>    oMioRange.Sort(aSortDesc())
>
o.........k 

>       Riordina_A = lrowF
>
questa non l'ho capita: lrowF che valore dovrebbe avere? e che modo è di 
usare una funzione a sinistra dell'operatore di assegnazione?

> End Function
>
> Function getLastUsedCell(oSheet as Object)
>    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
>    GetLastUsedCell = aAddress'.EndRow
> End Function
>
ok, questa è funzionale ad una delle precedenti


-- 
A presto
-Valerio-

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Rispondere a