FW_DbfToExcel() problem

Post Reply
User avatar
damianodec
Posts: 372
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia
Contact:

FW_DbfToExcel() problem

Post by damianodec »

hi,
I have my dbf whit this field:

Code: Select all

...
DbCreate( "IMPLIG", { { "ARTIC"   ,"C", 15, 0 },;
              { "DESCR"   ,"C", 35, 0 },;
              { "TIPO"   ,"C",  1, 0 },;    
               { "CORRE"   ,"N", 13, 5 },;  
...
 
with this xbrowse:
Image

but when I use FW_DbfToExcel()...

Code: Select all

oSheet := IMPLIG->( FW_DbfToExcel())
I have this file excel but field artic is not char and loses initial zeros...
Image

any help?
thank you
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FW_DbfToExcel() problem

Post by nageswaragunupudi »

Please make this change to the function FW_DBFTOEXCEL() in the file \fwh\source\function\dbffunc2.prg

In the function FW_DBFTOEXCEL(), please locate these two lines of code:

Code: Select all

   oRange:Rows( 1 ):Value  := aHead
   nRow     := 2
 
Please insert one new line of code between these two lines as below:
oRange:Rows( 1 ):Value := aHead
AEval( Eval( bLine ), { |u,i| If( ValType( u ) == "C", oRange:Columns( i ):NumberFormat := "@", nil ) } )
nRow := 2
Please let us know if this resolves your issue.
Regards

G. N. Rao.
Hyderabad, India
User avatar
damianodec
Posts: 372
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia
Contact:

Re: FW_DbfToExcel() problem

Post by damianodec »

thank you Mr. Rao
Resolved!
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
Posts: 372
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia
Contact:

Re: FW_DbfToExcel() problem

Post by damianodec »

hi Mr. Rao
field ARTICOLO is 15 char len and FW_DbfToExcel() exports that field in column A without RTRIM blanks but with blanks until 15th character:
"0009533597 " and not "0009533597"
how can I to solve it inside function?
thank you
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
Posts: 372
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia
Contact:

Re: FW_DbfToExcel() problem

Post by damianodec »

hi,
I changed dbffunc2.prg from:

Code: Select all

AEval( DbStruct(), { |a| cFieldList += "," + a[ 1 ] } )
to:

Code: Select all

AEval( DbStruct(), { |a| cFieldList += "," + if(a[2]= "C","Alltrim("+a[ 1 ]+")",a[ 1 ]) } )
and now I have Alltrim for all char fields.
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FW_DbfToExcel() problem

Post by nageswaragunupudi »

good
Regards

G. N. Rao.
Hyderabad, India
Post Reply