I have had 2 errors when exporting to excel from an xbrowse.
1. Argument error: ALLTRIM which was called from xbrowse.prg => TXBRWCOLUMN:CLPTEXT(11406)
Original Code:-
- Code: Select all Expand view
- if ::bEditValue == nil
if ::bStrData == nil
RetVal := ""
else
RetVal := AllTrim(Eval( ::bStrData ))
endif
This was fixed by:-
- Code: Select all Expand view
- if ::bEditValue == nil
if ::bStrData == nil
RetVal := ""
else
RetVal := Eval( ::bStrData )
IF Valtype(RetVal) == "N"
RetVal := AllTrim(STR(RetVal) )
ELSEIF Valtype(RetVal) == "C"
RetVal := AllTrim(RetVal)
ENDIF
endif
2.Argument error: $ which was called from xbrowse.prg => TXBROWSE:TOEXCEL(6851)
Original Code:-
- Code: Select all Expand view
- if ::nDataType != DATATYPE_ARRAY
DO CASE
CASE cType == 'N'
cFormat := Clp2xlNumPic( oCol:cEditPicture )
oSheet:Columns( nCol ):NumberFormat := cFormat
oSheet:Columns( nCol ):HorizontalAlignment := - 4152 //xlRight
CASE cType == 'D'
if lxlEnglish
if ValType( oCol:cEditPicture ) == 'C' .and. Left( oCol:cEditPicture, 1 ) != '@'
oSheet:Columns( nCol ):NumberFormat := Lower( oCol:cEditPicture )
else
oSheet:Columns( nCol ):NumberFormat := Lower( Set( _SET_DATEFORMAT ) )
endif
oSheet:Columns( nCol ):HorizontalAlignment := - 4152 //xlRight
endif
CASE cType $ "LPFM"
// leave as general format
OTHERWISE
if ::nDataType != DATATYPE_ARRAY
oSheet:Columns( nCol ):NumberFormat := "@"
if ! Empty( oCol:nDataStrAlign )
oSheet:Columns( nCol ):HorizontalAlignment := If( oCol:nDataStrAlign == AL_CENTER, -4108, -4152 )
endif
endif
ENDCASE
endif
This was fixed by checking if ctype is empty as it seemed a null was being received.:-
- Code: Select all Expand view
- if ::nDataType != DATATYPE_ARRAY
IF!EMPTY(cType)
DO CASE
CASE cType == 'N'
cFormat := Clp2xlNumPic( oCol:cEditPicture )
oSheet:Columns( nCol ):NumberFormat := cFormat
oSheet:Columns( nCol ):HorizontalAlignment := - 4152 //xlRight
CASE cType == 'D'
if lxlEnglish
if ValType( oCol:cEditPicture ) == 'C' .and. Left( oCol:cEditPicture, 1 ) != '@'
oSheet:Columns( nCol ):NumberFormat := Lower( oCol:cEditPicture )
else
oSheet:Columns( nCol ):NumberFormat := Lower( Set( _SET_DATEFORMAT ) )
endif
oSheet:Columns( nCol ):HorizontalAlignment := - 4152 //xlRight
endif
CASE cType $ "LPFM"
// leave as general format
OTHERWISE
if ::nDataType != DATATYPE_ARRAY
oSheet:Columns( nCol ):NumberFormat := "@"
if ! Empty( oCol:nDataStrAlign )
oSheet:Columns( nCol ):HorizontalAlignment := If( oCol:nDataStrAlign == AL_CENTER, -4108, -4152 )
endif
endif
ENDCASE
ENDIF
endif
Could someone review this code to see if the changes are correct and then implement it in future FWH releases
Thanks
Gary