Renato Ferrari ha scritto:
> aggiungo dieci record (dieci righe) nella Tabella1, così l'area dati diventa 
> A1:G40.
>   
ecco il problema sta in come aggiungi le dieci righe ... se ti posizioni
alla riga 9 e da li inserisci le righe che ti occorrono, vedrai che
l'area dati del data pilot si aggiornerĂ  di conseguenza, e tu tramite
aggiorna, otterrai quello che ti proponi.
In effetti, io per modificare e/o realizzare data pilot complessi
preferisco usare le macro.
Ti posto, se dovesse interessarti, una macro classica che uso.

/Sub CreaDataPilot ()

    Dim sElenco As Object
    Dim sRiepil As Object

    Set sElenco = ThisComponent.Sheets.getByName("Elenco RPNC")
    Set sRiepil = ThisComponent.Sheets.getByName("Riepilogo RPNC")

    oDoc = ThisComponent
    If not oDoc.DatabaseRanges.hasByName("DBase") Then
        exit sub
    End If

    oDPSource = sElenco.getCellRangeByName("DBase").getRangeAddress()
    oDPDestRange = createUnoStruct("com.sun.star.table.CellAddress")
   
'
-----------------------------------------------------------------------------
'  Struttura Data Pilot - GENERALE x CLIENTE
'
-----------------------------------------------------------------------------

    oDPDestRange.Sheet =
sRiepil.getCellRangeByName("A1").getRangeAddress.Sheet
    oDPDestRange.column = 0
    oDPDestRange.row = 0
       
    If sRiepil.DataPilotTables.hasByName("DPClienti") Then
        sRiepil.getDataPilotTables.removeByName("DPClienti")
    End If
    oDPCtrl = sRiepil.DataPilotTables.createDataPilotDescriptor()
    oDPCtrl.setSourceRange(oDPSource)
    oDPCtrl.ColumnGrand = False
    rem oDPCtrl.RowGrand = False
   
    oDPCampi = oDPCtrl.getDataPilotFields()
    oDPCampi.getByName("Impianto").orientation =
com.sun.star.sheet.DataPilotFieldOrientation.PAGE
    oDPCampi.getByName("Finitura").orientation =
com.sun.star.sheet.DataPilotFieldOrientation.ROW
    oDPCampi.getByName("Fonte").orientation =
com.sun.star.sheet.DataPilotFieldOrientation.ROW
    oDPCampi.getByName("Cliente").orientation =
com.sun.star.sheet.DataPilotFieldOrientation.ROW
    oDPCampi.getByName("QTA NR").orientation =
com.sun.star.sheet.DataPilotFieldOrientation.DATA
    oDPCampi.getByName("QTA KG").orientation =
com.sun.star.sheet.DataPilotFieldOrientation.DATA

    oDPCampi.getByName("Finitura").function =
com.sun.star.sheet.GeneralFunction.SUM
    oDPCampi.getByName("Fonte").function =
com.sun.star.sheet.GeneralFunction.SUM

    sRiepil.DataPilotTables.insertNewByName("DP", oDPDestRange, oDPCtrl)

End Sub
/

-- 
Giordani Sergio

Linux User: 359205: http://counter.li.org
Sistema operativo: Slackware: http://www.slackware.com/

Rispondere a