PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → Excel file in android
Excel file in android
Débuté par JOHNKEN, 22 juin 2015 08:43 - 6 réponses
Membre enregistré
26 messages
Posté le 22 juin 2015 - 08:43
Anyone who tried creating excel file in android?
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 24 juin 2015 - 20:13
//Relatorio Manual Excel

ok is boolean = False
CAB is int = 0
Lineprint is string = ""
sFileName is string = ""
contador is int = 0

IF GloAno = "" THEN
GloAno = CurrentYear()
END

Numero_Ano is string = GloNumFechamento +"_"+ GloAno

IF gnConvenioAdministrador <> "" THEN

Lineprint = ""

Ordem is string = ""

IF RADIO_OrdemImpressao..Value = 1
Ordem = "Funcionario"
ELSE IF RADIO_OrdemImpressao..Value = 2
Ordem = "Corrida"
ELSE IF RADIO_OrdemImpressao..Value = 3
Ordem = "CentroDeCusto"
ELSE IF RADIO_OrdemImpressao..Value = 4
Ordem = "Embarque"
ELSE IF RADIO_OrdemImpressao..Value = 5
Ordem = "RT"
ELSE
Ordem = "Funcionario"
END


ok = HExecuteQuery(QRY_Select_FechamentoDetalhado,hQueryDefault,gnConvenioAdministrador,GloAno,GloNumFechamento,GloCentroCusto, Ordem)
IF ok = True THEN

IF CAB = 0 THEN
CAB = 1

Lineprint = "AnoFechamento;NumeroFechamento;CentroDeCusto;DesCentroDeCusto;Diretoria;ClienteConvenio;Corrida;DataHora;RT;Funcionario;Embarque;Desembarque;Finalidade;Km;Vouchers;Valor"+Charact(13)+Charact(10)
END

FOR EACH QRY_Select_FechamentoDetalhado
contador += 1

Lineprint += QRY_Select_FechamentoDetalhado.AnoFechamento +";"
Lineprint += QRY_Select_FechamentoDetalhado.NumeroFechamento +";"
Lineprint += QRY_Select_FechamentoDetalhado.Vouchers +";"
Lineprint += QRY_Select_FechamentoDetalhado.Valor + Charact(13)+Charact(10)

END

END
//info(contador)
IF ok = True THEN

sFile is string
sFile = WS_ReturnGenerationDir()+"\FechamentoVoucher"+ gnConvenioAdministrador +"_"+ Numero_Ano +".xls"
IF sFile <> "" THEN
LooperToExcel(TABLE_QRY_Select_FechamentoDetalhado,sFile)
iDestination(iGenericXLS,sFile)
FileDisplay(sFile,"application/unknown",sFile)
fDelete(sFile)
END

END

END
Membre enregistré
26 messages
Posté le 26 juin 2015 - 15:44
Thanks Adriano,
LooperToExcel is not supported in android environment,
any other idea?
Posté le 26 juin 2015 - 16:45
Hi Johnken,

excel is not natively supported in android, so you will have to choose
between 2 methods :
1. create a csv file instead (it's just text, and excel will read it easily)
2. Send your data to a webservice that you wan write in webdev awp by
example, and create the excel file there.

It all depends of what you are going to do with that file (I suppose
that you are going to SEND it somewhere aterwards, which could be done
by the webservice too)

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Already there: WXShowroom.com, WXReplication (open source)
Coming soon: WXEDM (open source)
More information on http://www.fabriceharari.com


On 6/26/2015 7:44 AM, JOHNKEN wrote:
Thanks Adriano,
LooperToExcel is not supported in android environment,
any other idea?
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 26 juin 2015 - 17:45
Thank you very much Fabrice

:merci:
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 26 juin 2015 - 17:48
JOHNKEN...

info(Lineprint)

Check the contents of lineprint before the party there that gave error ... this is a separate csv by semicolons. Save it with FsaveText on your sdcard or send direct via webservice as Fabrice gave hint.

:merci:
Membre enregistré
26 messages
Posté le 27 juin 2015 - 01:46
Thanks Fabrice and Adriano,
I think csv file will do.