Export datagrid .xls

martedì 03 ottobre 2006 - 12.13

VO2952 Profilo | Newbie

salve,

potreste darmi qualche dritta su come poter esportare un datareport in formato xls?

grazie

fasol Profilo | Junior Member

ti do la procedura ke ho creato io vedi se può esserti di aiuto

Private Sub mnuEsporta_Click()
Dim Nomefile As String
Dim nome, prodotto, codice, descrizione, ora_i, ora_f, Qt, Tdm, DT, Tm, Et, Cu, Ct, Au, Ce, Ceu, ctl, cel, data As String
Dim indexGrd As Integer
Dim dd, mm, yy As Integer
dd = DatePart("d", Now)
mm = DatePart("m", Now)
yy = DatePart("yyyy", Now)
indexGrd = 0
ctl = lblCtF
cel = lblCeL
data = lblInform

Nomefile = App.Path & "\Riass" & dd & "_" & mm & "_" & yy & ".csv"
nfile = FreeFile 'determino il primo numero di file disponibile
Open Nomefile For Output As nfile 'apro il file in modalità scrittura
'Intestazione del file csv
'Print #nfile, "campione_n"; ";"; "faseA_n"; ";"; "faseB_n"; ";"; "contatto1_n"; ";"; "contatto2_n"; ";"; "contatto3_n"; ";"; "freqRete_n"; ";"; "t_n"; ";"; "n_frontiSalita"; ";"; "teta_n"; ";"; "corrente" '; ";"; "spazio"
'salvo variabili
Do While Not (indexGrd = flgRisult.Rows)
flgRisult.Row = indexGrd
flgRisult.Col = 0
nome = flgRisult.Text
flgRisult.Col = 1
prodotto = flgRisult.Text
flgRisult.Col = 2
cod = flgRisult.Text
flgRisult.Col = 3
descrizione = flgRisult.Text
flgRisult.Col = 4
ora_i = flgRisult.Text
flgRisult.Col = 5
ora_f = flgRisult.Text
flgRisult.Col = 6
Qt = flgRisult.Text
flgRisult.Col = 7
Tdm = flgRisult.Text
flgRisult.Col = 8
DT = flgRisult.Text
flgRisult.Col = 9
Tm = flgRisult.Text
flgRisult.Col = 10
Et = flgRisult.Text
flgRisult.Col = 11
Cu = flgRisult.Text
flgRisult.Col = 12
Ct = flgRisult.Text
flgRisult.Col = 13
Au = flgRisult.Text
flgRisult.Col = 14
Ce = flgRisult.Text
flgRisult.Col = 15
Ceu = flgRisult.Text
Print #nfile, nome; ";"; prodotto; ";"; codice; ";"; descrizione; ";"; ora_i; ";"; ora_f; ";"; Qt; ";"; Tdm; ";"; DT; ";"; Tm; ";"; Et; ";"; Cu; ";"; Ct; ";"; Au; ";"; Ce; ";"; Ceu
indexGrd = indexGrd + 1
Loop
Print #nfile, ""
Print #nfile, ""

Print #nfile, "Costo totale lavorazione"; ";"; ctl; ";"; ""; ";"; "Costo extra lavorazione"; ";"; cel; ";"; ""; ";"; data

MsgBox "Esportazione completata", , "ESPORTAZIONE OK"

Close nfile

End Sub


DIMMI POI QLK COSA....


OKKIO CHE QST E' PER ESPORTARE UNA FLEX GRID MA PENSO CHE LA MODIFICHI UN PO RIESCI AD ESPORTARE UNA DATA GRID


meglio i perdenti xkè hanno la speranza di vincere...cosa che i vincenti nn hanno....
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5