Hello Rao
it is possible with the function FW_AdoToExcel determine in which sheet to export ?
Maurizio
FW_AdoToExcel and sheet
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: FW_AdoToExcel and sheet
FW_AdoToExcel( cSql ) --> oSheet
This function creates a new Excel Book, exports to only sheet available, i.e., "Sheet1" and returns the Sheet object.
You can use the oSheet object and do anything with it, including rename it :
oSheet:Name := "SomeOtherName".
This function creates a new Excel Book, exports to only sheet available, i.e., "Sheet1" and returns the Sheet object.
You can use the oSheet object and do anything with it, including rename it :
oSheet:Name := "SomeOtherName".
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: FW_AdoToExcel and sheet
Thanks Rao
This Works
,
is there a possibility to export more recordest in different Sheets of the same Excel file?
Maurizio
This Works

is there a possibility to export more recordest in different Sheets of the same Excel file?
Maurizio
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: FW_AdoToExcel and sheet
Code: Select all | Expand
local oExcel, oBook, oSheet
local oCn, oRs, n
oCn := FW_MSSQLDB()
oRs := FW_OpenRecordSet( oCn, "states" )
xbrowser oRs
oExcel := ExcelObj()
oBook := oExcel:WorkBooks:Open( "c:\fwh\tests\testbook.xlsx" )
oSheet := oBook:WorkSheets( "two" )
oSheet:Activate()
oSheet:Cells:Clear()
for n := 1 to oRs:Fields:Count()
oSheet:Cells( 1, n ):Value := oRs:Fields( n - 1 ):Name
next
oSheet:Cells( 2, 1 ):CopyFromRecordSet( oRs )
oRs:Close()
oCn:Close()
oExcel:Visible := .t.
return nil
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India