Page 1 of 1

FW_DbfToExcel() problem

Posted: Tue Jul 09, 2019 9:51 am
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

Re: FW_DbfToExcel() problem

Posted: Wed Jul 10, 2019 7:37 am
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.

Re: FW_DbfToExcel() problem

Posted: Wed Jul 10, 2019 10:28 am
by damianodec
thank you Mr. Rao
Resolved!

Re: FW_DbfToExcel() problem

Posted: Tue Aug 06, 2019 1:26 pm
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

Re: FW_DbfToExcel() problem

Posted: Thu Aug 08, 2019 10:55 am
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.

Re: FW_DbfToExcel() problem

Posted: Thu Aug 08, 2019 11:04 am
by nageswaragunupudi
good