Here is a sample worksheet.
Assuming the Excel file is saved as "xbrtest.xls" ( can be xlsx extention too), here is a small sample to browse the data.
Code: Select all
#include "fivewin.ch"
#include "xbrowse.ch"
function Main()
local oWnd, oBrw, oBar, oFont
local oRange, u
SET DATE ITALIAN
SET CENTURY ON
fwNumFormat( 'E', .t. )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
DEFINE WINDOW oWnd TITLE "XBrowse Excel Sheet: FWH 11.07"
oWnd:SetFont( oFont )
DEFINE BUTTONBAR oBar OF oWnd 2007
SET MESSAGE OF oWnd TO '' 2007
oRange := GetExcelRange( ExePath() + "xbrtest.xls", "Customers", "A1:E12" )
@ 0,0 XBROWSE oBrw OF oWnd AUTOCOLS ;
PICTURES nil, nil, nil, 'dd-mmm-yyyy', NumPict( 12,2 ) ;
DATASOURCE oRange CELL LINES FOOTERS
oBrw:Sales:bFooter := { || oRange:Application:WorkSheetFunction:Sum(oRange:Columns(5)) }
oBrw:nStretchCol := 1
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd
RELEASE FONT oFont
oRange:WorkSheet:Parent:Close()
return nil
function ExePath()
return cFilePath( GetModuleFileName() )