xBrowse and oBrw:ToExcel() to Rao

xBrowse and oBrw:ToExcel() to Rao

Postby Maurizio » Thu Apr 22, 2021 1:10 pm

Hello Rao ,

When I have an xBrowse with a column :aEditListTxt and I need export :ToExcel() ,
the fields with :aEditListTxt are exported as a value and not with the field in :aEditListTxt

Code: Select all  Expand view
#include "fivewin.ch"

REQUEST DBFCDX

function xbtest()

   local aStates
   local oDlg, oBrw, oFont

   RDDSETDEFAULT( "DBFCDX" )

   USE STATES SHARED
   aStates  := FW_DbfToArray()
   CLOSE STATES

   USE CUSTOMER SHARED
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 700,400 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" ;
      COLUMNS "First", "City", "State" ;
      CELL LINES NOBORDER FASTEDIT

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      WITH OBJECT :State
         :nEditType     := EDIT_LISTBOX
         :aEditListTxt  := aStates
      END
      //
      :CreateFromCode()
   END
   oDlg:bStart := {|| oBrw:ToExcel() }  

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

 


I found a solution I wanted to ask Rao if it is possible to integrate it into xBrowse
(if it is correct)

Code: Select all  Expand view


METHOD ClpRow( lFullRow, aCols, lFormatted ) CLASS TXBrowse

....

if lFullRow
      for n := 1 to Len( aCols )
         if lFormatted
            if aCols[ n ]:bStrData == nil
               RetVal   += If( ValType( u := aCols[ n ]:Value ) == 'L', If( u, "True", "False" ), "" ) + Chr( 9 )
            else
               RetVal += StrTran( StrTran( aCols[ n ]:StrData, CRLF, " ; " ), Chr(9), ' ' ) + Chr( 9 )
            endif
         else
            //-------------------------------------------------------------------------------------------
            // My modi
     
            IF HB_IsArray(aCols[ n ]:aEditListTXT ) .and. len(aCols[ n ]:aEditListTXT ) > 0
               RetVal += cValToChar( aCols[n]:StrData )  + Chr( 9 )
            ELSE
               RetVal += aCols[ n ]:ClpText + Chr( 9 )
            ENDIF
         endif
      next
   else
      RetVal := ::SelectedCol():ClpText
     
           
   endif


....



 


Regards Maurizio
User avatar
Maurizio
 
Posts: 797
Joined: Mon Oct 10, 2005 1:29 pm

Return to FiveWin for Harbour/xHarbour

Who is online

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