ciao a tutti,
da Oracle Forms 10g devo creare un foglio Excel con 4 pagine e un grafico a torta che attinge i dati dall'ultimo foglio. Per la creazione del foglio non ho avuto difficoltà. Per il grafico a torta ho usato questo frammento
Questo codice crea il grafico, ma ci sono alcuni problemi.codice:... --creo fogli w1, w2, w3 w1 := OLE2.Invoke_Obj(worksheets, 'Add'); OLE2.set_property(w1,'Name',NVL(P_NOME_FOGLIO,'Foglio Dati')); ... --foglio dati w4. --definisco l'intervallo dati per il grafico args:=OLE2.create_arglist; STR_FORMULA := 'A' || (J-2) || ':D' || J; --es. A12:D14 OLE2.add_arg(args, STR_FORMULA); rang:=OLE2.get_obj_property(worksheet, 'Range', args); OLE2.destroy_arglist(args); OLE2.INVOKE(rang,'Select'); --creo il grafico workcharts:=OLE2.GET_OBJ_PROPERTY(workbook,'CHARTS'); WORKCHART := ole2.Invoke_obj(workcharts, 'Add'); OLE2.SET_PROPERTY(WORKCHART,'ChartType','xl3DPieExploded'); OLE2.SET_PROPERTY(workchart, 'NAME', 'RIPARTIZIONE LAVORI'); OLE2.SET_PROPERTY(workchart, 'ChartTitle', 'RIPARTIZIONE LAVORI'); --assegno al grafico l'intervallo di celle selezionato (rang) args := OLE2.CREATE_ARGLIST; OLE2.ADD_ARG(args, rang); OLE2.INVOKE(workchart, 'SetSourceData Source', args); OLE2.DESTROY_ARGLIST(args); OLE2.RELEASE_OBJ(RANG); OLE2.RELEASE_OBJ(workchart); OLE2.RELEASE_OBJ(workcharts); OLE2.SET_PROPERTY(workchart, 'HasLegend', 0);
1. Il grafico è corretto, ma è sempre nel formato a barre. Creando un grafico a mano, ho trovato che il tipo corrispondente al grafico a torta è 'xl3DPieExploded'; ma se lo assegno al workchart, il risultato è sempre un grafico a barre (istogramma)
2. L'ordine dei fogli è inverso rispetto a quello desiderato (grafico, w4, w3, w2, w1). Il grafico viene creato in un foglio a parte. E' possibile forzare l'ordine dei fogli con queste istruzioni
in questo modo, l'ordine dei fogli è corretto, ma il grafico mi appare all'inizio del file, ed è vuoto.codice:--creo un foglio in posizione 1 args := OLE2.CREATE_ARGLIST; OLE2.ADD_ARG( args, 1 ); worksheet := OLE2.GET_OBJ_PROPERTY( worksheets, 'Item', args); OLE2.DESTROY_ARGLIST( args); OLE2.set_property(w1,'Name',NVL(P_NOME_FOGLIO,'Foglio Dati'));
Ci sto sbattendo la testa da una settimana. Qualcuno ha qualche suggerimento per come risolvere questi problemi? grazie

Rispondi quotando