XBrowsing Excel Data

XBrowsing Excel Data

Postby nageswaragunupudi » Thu Aug 11, 2011 3:09 pm

XBrowse, supported by FWH function GetExelRange() simplifies browsing Data in Excel files.

Here is a sample worksheet.
Image

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  Expand view
#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:
Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBrowsing Excel Data

Postby gkuhnert » Thu Aug 11, 2011 3: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
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 39 guests