FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Leer importe con 6 decimales de un XLS
Posts: 582
Joined: Fri Oct 07, 2005 02:17 PM
Leer importe con 6 decimales de un XLS
Posted: Thu Aug 18, 2016 01:35 AM

Estimados, buenas noches

Tengo un problema, necesito leer un archivo Excel, lo leo sin problemas con TExcel, pero al leer un campo num茅rico que tiene 6 decimales, solo me guarda el valor en la variable redondeado a 2 decimales, ejemplo :

nNec:=0.000000
nNec:=oHoja:Cells(nRow, 11):Value // En esta posici贸n hay un valor en el Excel de : 3.105674768
? nNec
Me retorna 3.11, no conserva los decimales, gracias por su ayuda

Enrrique Vertiz Pitta

Lima-Peru

xHb 1.23.1026X, Fwh 25.01, BCC74, MySQL 8.0.X, SQLLIB 1.9m
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Leer importe con 6 decimales de un XLS
Posted: Thu Aug 18, 2016 08:55 AM
Sin probar, intenta asi:

Code (fw): Select all Collapse
#define _SET_DECIMALS 3
Local nSetDec:= Set( _SET_DECIMALS, 6 )

nNec:=0.000000
nNec:=oHoja:Cells(nRow, 11):Value // En esta posici贸n hay un valor en el Excel de : 3.105674768
? nNec

Set( _SET_DECIMALS, nSetDec )
Posts: 582
Joined: Fri Oct 07, 2005 02:17 PM
Re: Leer importe con 6 decimales de un XLS
Posted: Fri Aug 19, 2016 12:17 AM

Estimado, gracias, lo probe pero no funciona ...

Por favor alguien con alguna idea de como hacerlo, gracias

Enrrique Vertiz Pitta

Lima-Peru

xHb 1.23.1026X, Fwh 25.01, BCC74, MySQL 8.0.X, SQLLIB 1.9m
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Leer importe con 6 decimales de un XLS
Posted: Fri Aug 19, 2016 12:24 AM

Adem谩s del SET_DECIMAL en 6, prueba con ROUND( nVal, 6 )

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 582
Joined: Fri Oct 07, 2005 02:17 PM
Re: Leer importe con 6 decimales de un XLS
Posted: Fri Aug 19, 2016 04:39 AM

Gracias Crist贸bal

Aumentando el Round() funciono ...

Enrrique Vertiz Pitta

Lima-Peru

xHb 1.23.1026X, Fwh 25.01, BCC74, MySQL 8.0.X, SQLLIB 1.9m

Continue the discussion