* TSBrowse testing Excel conections - c:\tsbrowse\samples\TESTXLS.PRG
#include "FiveWin.ch"
#include "\TSBrowse\Include\TSBrowse.ch"
#define CLR_PINK nRGB( 255, 128, 128)
#define CLR_NBLUE nRGB( 128, 128, 192)
Static oWnd, oBrw
Request DBFCDX
//--------------------------------------------------------------------------------------------------------------------//
Function Main()
Local oBmp, oBar, oFont, oFont1, oBrush, oCol, cTitle, lGrid
If File( "Employee.cdx" )
FErase( "Employee.cdx" )
EndIf
Use Employee Shared New Via "DBFCDX"
Index On First+Last Tag Name
Define Font oFont Name "Arial" Size 0, -13
Define Font oFont1 Name "Arial" Size 0, -13 NESCAPEMENT 900
Define Brush oBrush Resource "CoverBack"
Define BitMap oBmp Resource "Selector"
Define Window oWnd TITLE "TSBrowse/Excel conectivity. One Click From TSBrowse To Excel And more..." ;
Brush oBrush ;
MENU BuildMenu()
If Right( FWVERSION, 4 ) >= "7.12"
Define ButtonBar oBar OF oWnd Size 50, 50 3D 2007
Else
Define ButtonBar oBar OF oWnd Size 50, 50 3D
EndIf
cTitle := "Database: " + Trim( StrCapFirst( Alias() ) ) + ".dbf"
bExtern := {|oSheet| oSheet:Columns( 10 ):Set( "NumberFormat", "#,##0.00" ) }
Define Button OF oBar Resource "Excel" ;
Action oBrw:ExcelOle( "Test.xls", .T.,, cTitle,,, bExtern ) ;
ToolTip "Export Browse to Excel"
lGrid := .T.
Define Button OF oBar Resource "Print" ;
Action oBrw:Report( cTitle,,,,,,,, lGrid ) ;
ToolTip "Export Browse to Excel"
Define Button OF oBar Resource "Exit" ;
Action oWnd:End() ;
ToolTip "Exit"
@ 50, 0 Browse oBrw Alias "Employee" Of oWnd Size oWnd:nWidth, oWnd:nHeight Pixel ;
Font oFont AutoCols Transparent Selector oBmp Editable
Add Super Header To oBrw From Column 2 To Column 3 Color CLR_BLUE, { CLR_NBLUE, CLR_WHITE } ;
Title "Name" 3DLook
Add Super Header To oBrw FROM Column 4 TO Column 6 Color CLR_BLUE, { CLR_NBLUE, CLR_WHITE } ;
Title "Address" 3DLook
With Object oBrw
:nHeightCell += 4
:nHeightHead += 3
:nHeightSuper += 3
:SetColor( { CLR_HEADF, CLR_HEADB, CLR_FOCUSF, CLR_FOCUSB }, { CLR_BLUE, { CLR_WHITE, CLR_NBLUE, 2 }, ;
CLR_BLACK, -1 } )
:ChangeFont( oFont1, 9, 2 )
:aColumns[ 9 ]:nHAlign := DT_VERT
End With
oWnd:oClient := oBrw
If Right( FWVERSION, 4 ) >= "7.12"
Set Message Of oWnd Clock Date Keyboard Noinset 2007
Else
SET Message Of oWnd Clock Date Keyboard Noinset
EndIf
Activate Window oWnd Maximized
oFont:End()
oFont1:End()
oBrush:End()
oBmp:End()
DbCloseAll()
Return Nil
//--------------------------------------------------------------------------------------------------------------------//
Static Function BuildMenu()
Local oMenu
If Right( FWVERSION, 4 ) >= "7.12"
MENU oMenu
Else
MENU oMenu
EndIf
MENUITEM "TSBrowse"
MENU
MENUITEM "Excel" Resource "Excel16" ;
Action oBrw:ExcelOle( "Test.xls", .T.,, "Here you are" )
MENUITEM "Exit" Resource "Exit16" ;
Action oWnd:End()
ENDMENU
MENUITEM "&Exit" Action oWnd:End()
MENUITEM "&Help" Action WinExec( "Start ..\doc\Help.htm", 0 )
ENDMENU
Return oMenu