PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV Mobile 2024 → Excel file in android
Excel file in android
Started by JOHNKEN, Jun., 22 2015 8:43 AM - 6 replies
Registered member
26 messages
Posted on June, 22 2015 - 8:43 AM
Anyone who tried creating excel file in android?
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on June, 24 2015 - 8:13 PM
//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
Registered member
26 messages
Posted on June, 26 2015 - 3:44 PM
Thanks Adriano,
LooperToExcel is not supported in android environment,
any other idea?
Posted on June, 26 2015 - 4:45 PM
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?
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on June, 26 2015 - 5:45 PM
Thank you very much Fabrice

:merci:
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on June, 26 2015 - 5:48 PM
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:
Registered member
26 messages
Posted on June, 27 2015 - 1:46 AM
Thanks Fabrice and Adriano,
I think csv file will do.