XBrowsing Excel Data

Post Reply
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

XBrowsing Excel Data

Post by nageswaragunupudi »

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

#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
gkuhnert
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands
Contact:

Re: XBrowsing Excel Data

Post by gkuhnert »

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
Post Reply