lcXLSFile = Sys(5)+Curdir()+'CrsResult.xls' SELECT * from data03\okul2 INTO CURSOR CrsResult Copy To (m.lcXLSFile) Type Xls *Use oForm = Createobject('form1',m.lcXLSFile) oForm.Show() Read Events Define Class form1 As Form Top = 0 Left = 0 Height = 470 Width = 740 DoCreate = .T. Caption = "HTML sample" Name = "Form1" * This is IE control - you'd use webbrowser4 from gallery instead * just because it already has some checks, extra pem. ie: wouldn't need readystate part * for the sake of keeping code short here I directly use olecontrol itself Add Object htmlviewer As OleControl With ; Top = 12, ; Left = 12, ; Height = 396, ; Width = 708, ; Visible = .T., ; Name = "HTMLViewer", ; OleClass = 'Shell.Explorer' Add Object cmdExcel As CommandButton With ; Height = 25, ; Left = 12, ; Top = 432, ; Width = 60 Procedure Init Lparameters tcXLSFile With Thisform.htmlviewer .Navigate2('file://'+m.tcXLSFile) Do While .ReadyState # 4 && Wait for ready state Enddo Endwith Endproc Procedure cmdExcel.Click oXLS = Thisform.htmlviewer.Object.Document oExcel = oXLS.Application oExcel.CommandBars("Standard").Visible = .T. oExcel.CommandBars("Formatting").Visible = .T. *--- oExcel.selection.autofilter oExcel.Selection.Font.Color = RGB(255,255,255) oExcel.Columns().AutoFit *-------------- Lnfcount=FCOUNT('CrsREsult') lcRange = Trim(Thisform._GetChar(1))+'1:'+; Trim(Thisform._GetChar(m.LnFcount)+'1') oExcel.ActiveWorkbook.ActiveSheet.Range(m.lcRange).Interior.ColorIndex = 3 oExcel.ActiveWorkbook.ActiveSheet.Range(m.lcRange).Font.Color = RGB(255,255,255) Endproc Procedure QueryUnload Clear Events Endproc Procedure _GetChar Lparameters tnColumn && Convert tnvalue to Excel alpha notation If tnColumn = 0 Return "" Endif If tnColumn <= 26 Return Chr(Asc("A")-1+tnColumn) Else Return This._GetChar(Int(Iif(tnColumn % 26 = 0,tnColumn - 1, tnColumn) / 26)) + ; this._GetChar((tnColumn-1)%26+1) Endif Endproc Enddefine