FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FW_DbfToExcel() problem
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
FW_DbfToExcel() problem
Posted: Tue Jul 09, 2019 09:51 AM
hi,
I have my dbf whit this field:
Code (fw): Select all Collapse
...
DbCreate( "IMPLIG", { { "ARTIC"   ,"C", 15, 0 },;
              { "DESCR"   ,"C", 35, 0 },;
              { "TIPO"   ,"C",  1, 0 },;    
               { "CORRE"   ,"N", 13, 5 },;  
...


with this xbrowse:


but when I use FW_DbfToExcel()...
Code (fw): Select all Collapse
oSheet := IMPLIG->( FW_DbfToExcel())


I have this file excel but field artic is not char and loses initial zeros...


any help?
thank you
FiveWin for xHarbour 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FW_DbfToExcel() problem
Posted: Wed Jul 10, 2019 07:37 AM
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 (fw): Select all Collapse
   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
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: FW_DbfToExcel() problem
Posted: Wed Jul 10, 2019 10:28 AM

thank you Mr. Rao
Resolved!

FiveWin for xHarbour 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: FW_DbfToExcel() problem
Posted: Tue Aug 06, 2019 01:26 PM

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 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: FW_DbfToExcel() problem
Posted: Thu Aug 08, 2019 10:55 AM
hi,
I changed dbffunc2.prg from:
Code (fw): Select all Collapse
AEval( DbStruct(), { |a| cFieldList += "," + a[ 1 ] } )


to:
Code (fw): Select all Collapse
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 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FW_DbfToExcel() problem
Posted: Thu Aug 08, 2019 11:04 AM

good

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion