FW_DbfToExcel() problem

FW_DbfToExcel() problem

Postby damianodec » Tue Jul 09, 2019 9:51 am

hi,
I have my dbf whit this field:
Code: Select all  Expand view
...
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  Expand view
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
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: FW_DbfToExcel() problem

Postby nageswaragunupudi » Wed Jul 10, 2019 7: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: Select all  Expand view
  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
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FW_DbfToExcel() problem

Postby damianodec » Wed Jul 10, 2019 10:28 am

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: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: FW_DbfToExcel() problem

Postby damianodec » Tue Aug 06, 2019 1: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 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: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: FW_DbfToExcel() problem

Postby damianodec » Thu Aug 08, 2019 10:55 am

hi,
I changed dbffunc2.prg from:
Code: Select all  Expand view
AEval( DbStruct(), { |a| cFieldList += "," + a[ 1 ] } )


to:
Code: Select all  Expand view
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
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: FW_DbfToExcel() problem

Postby nageswaragunupudi » Thu Aug 08, 2019 11:04 am

good
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 56 guests