FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBrowsing Excel Data
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
XBrowsing Excel Data
Posted: Thu Aug 11, 2011 03:09 PM
XBrowse, supported by FWH function GetExelRange() simplifies browsing Data in Excel files.

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 (fw): Select all Collapse
#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() )

XBrowse screenshot:
Regards



G. N. Rao.

Hyderabad, India
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Re: XBrowsing Excel Data
Posted: Thu Aug 11, 2011 03:47 PM

Rao,

this is a great sample. Maybe we should ask Antonio to enclose the sample together with your Excel-file in the samples-folder for the next build!

Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de

Continue the discussion